Egor Kraev: 6) How Not to Estimate Standard Deviations
To finish off this series, let me cover a very common mistake in estimating standard deviation. Say you’ve got a daily series, going back 1.5 years (say 382 points), and you want to compute its one-year (252-day) rolling moving average. That gives you 130 points of rolling moving average, each representing the average of one year prior to a given date. Now, how do you estimate the standard deviation of the last point in that series?
Did you think ‘take the std of the 130 points’? If so, congratulations - you just made the mistake I’m talkng about. The above approach would work if the errors in the 130 points were independent - but of course in reality they are heavily correlated. They are, after all, averages over largely overlapping periods. Therefore, the std of the 130 points will be much lower than the std of the last point.
What should you do instead? Why, just treat that last point (and each other point in the rolling series) as a point estimate, and apply the methods I discussed earlier.
Let’s illustrate this with the following MATLAB simulation. We generate 382 points with mean 2.0 and std of 1.0, compute the rolling averages, and repeat that simulation 1000 times. My previous posts suggest the std of the final point should be 1
252) ≈ 0.063.
for n=1:1000 x=2+randn([1 382]); % generate iid numbers with mean=2 and std=1 y=cumsum(x)/252; y=y(253:end)-y(1:130); % compute rolling average final(n)=y(end); rollstd(n)=std(y); end std(final) % the ’true’ standard deviation of the final point mean(rollstd) % the average std of the 130 rolling points |
The simulation gives the std of the final point of 0.067, and the average std of the rolling series of 0.024. So using the rolling series can lead us to underestimate our margin of error by almost a factor of 3!
This is the last post in this series. The next series will be about MATLAB - why I love it, why I hate it, and what I miss most in it.
Send in your comments please!
Egor














. Suppose this function is a black box, that is all you know about it is you
can feed 












Recent Forum Discussions