I have a dataset of 10 participants. These participants conducted different walking tests and physiological responses (i.e., heart rate, breathing frequency) were collected.
I want to detect outliers with a 3 standard deviation rule in Stata. What is usually used is a moving window of 30 seconds. For a data point at time t, the mean and standard deviation are calculated for the values of t-15 until t+15. If the value at time t is higher than the mean + 3 SD or lower than mean - 3 SD, it is considered as an outlier.
What is the command for it? Also, what do I do with the outliers, how do I handle them?
I tried this command: egen stdvar = std(var)