Hi everyone,
I need to create a 50 day rolling average and standard deviation for variable low, where I'm expected to lose the first 50 observations (that is, the rolling average/st. deviation variable only starts at observation 51).
I've tried a number of commands, namely:
But all of them just start at observation 1. What are the rolling windows at observation 1? I'm confused because observation 1 doesn't have 50 past observations? Are any of these codes still legitimate to use? Any advice on a rolling standard deviation too?
I'm using Stata 14.1 on Mac.
Thankful for any help!
I need to create a 50 day rolling average and standard deviation for variable low, where I'm expected to lose the first 50 observations (that is, the rolling average/st. deviation variable only starts at observation 51).
I've tried a number of commands, namely:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear tsegen average = rowmean(L(0/49).low) tssmooth ma average = low, window(50) mvsumm low, generate(average) stat(mean) window(50) movavg average = low, lags(50) rangestat (mean) low (sd) low, interval(date -49 0) end
I'm using Stata 14.1 on Mac.
Thankful for any help!
Comment