How do I calculate the standard deviation between weighted measurements?

Steven C. Howell picture Steven C. Howell · May 21, 2015 · Viewed 15.5k times · Source

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.

enter image description here

When I simply use each weighted value for 'x' and the weighted average for '\bar{x}', the result seems smaller than it should be.

Answer

Steven C. Howell picture Steven C. Howell · May 21, 2015

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

.