How do I calculate the standard deviation between weighted measurements?
I just found this wikipedia page discussing data of equal significance vs weighted data. The correct way to calculate the biased weighted estimator of variance is
,
though the following, on-the-fly implementation, is more efficient computationally as it does not require calculating the weighted average before looping over the sum on the weighted differences squared
.
Despite my skepticism, I tried both and got the exact same results.
Note, be sure to use the weighted average
.
Related videos on Youtube
Steven C. Howell
Researching novel test and evaluation solutions to foster broader confidence in artificial intelligence and autonomous systems.
Updated on September 16, 2022Comments
-
Steven C. Howell over 1 year
I have several weighted values for which I am taking a weighted average. I want to calculate a weighted standard deviation using the weighted values and weighted average. How would I modify the typical standard deviation to include weights on each measurement?
This is the standard deviation formula I am using.
When I simply use each weighted value for 'x' and the weighted average for '\bar{x}', the result seems smaller than it should be.
-
Steven C. Howell about 9 years@DavidArenburg This is something I am trying to program and likely others have/will also use in the future. I just added more to the answer I posted to identify how to efficiently code this.
-
-
Robert Dodier about 9 yearsNote that the mean is also calculated using the weights (i.e. be careful to use the weighted mean in that formula, not the usual unweighted mean).
-
Steven C. Howell about 9 years@RobertDodier good point. I did not make that explicit but I will for completeness sake.
-
akavalar over 6 yearsThat last sentence should say "weighted mean", not "weighted error", right? I suppose the weighted error would be the difference between x_i and this value.