using excel to calculate the weighted standard deviation

David Wayne

New Member
Joined
Dec 4, 2012
Messages
10
Does anyone know the formula for computing the weighted standard deviation? I was able to calculate the weighted average (16.4) but have been unsuccessful in computing the weighted SD. I conducted numerous searches and have not been able to find a posted formula that actually works.
My data are as follows:

Year Shootings Weight*
2003 4 1
2004 17 2
2005 14 3
2006 19 4
2007 18 5

*The reason I set up the weights the way I did is because I want to give more weight to the more recent years of shootings when comparing them to other years such as 2008, 2009, 2010 and so on.

Someone please help.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
With your data in A2:C6 (headers in row 1), try the following:

Weighted Average (in cell G2) =SUMPRODUCT(B2:B6,C2:C6)/SUM(C2:C6)

Variance column (I used D2 and copied down to D6) =($B2-$G$2)^2

Weighted Standard Deviation (Sample)
=SQRT(SUMPRODUCT(D2:D6,C2:C6)/(SUM(C2:C6)-1))

Weighted Standard Deviation (Population)
=SQRT(SUMPRODUCT(D2:D6,C2:C6)/(SUM(C2:C6)))
 
Upvote 0
With your data in A2:C6 (headers in row 1), try the following:

Weighted Average (in cell G2) =SUMPRODUCT(B2:B6,C2:C6)/SUM(C2:C6)

Variance column (I used D2 and copied down to D6) =($B2-$G$2)^2

Weighted Standard Deviation (Sample)
=SQRT(SUMPRODUCT(D2:D6,C2:C6)/(SUM(C2:C6)-1))

Weighted Standard Deviation (Population)
=SQRT(SUMPRODUCT(D2:D6,C2:C6)/(SUM(C2:C6)))

===============================================================================================================

Thank you for your reply. However, I know the answer for these data should be 2.61. I just dont know how they got that answer. I plugged in the formulas you provided and came up with 3.89 for the weighted SD.
 
Upvote 0
However, I know the answer for these data should be 2.61.
You sure about that? I think it's 4.2.

Code:
       --A--- B- --C-- ----------------------------D-----------------------------
   1    Year  xi  wi                                                             
   2     2003  4     1                                                           
   3     2004 17     2                                                           
   4     2005 14     3                                                           
   5     2006 19     4                                                           
   6     2007 18     5                                                           
   7                                                                             
   8   WgtAvg     16.4 C8: =SUMPRODUCT(xi, wi)/SUM(wi)                           
   9   N             5 C9: =COUNT(xi)                                            
  10   SDw       4.199 C10: =SQRT(SUMPRODUCT(wi*(xi-WgtAvg)^2)/SUM(wi) * N/(N-1))
See http://www.itl.nist.gov/div898/software/dataplot/refman2/ch2/weightsd.pdf.
 
Upvote 0
You sure about that? I think it's 4.2.

Code:
       --A--- B- --C-- ----------------------------D-----------------------------
   1    Year  xi  wi                                                             
   2     2003  4     1                                                           
   3     2004 17     2                                                           
   4     2005 14     3                                                           
   5     2006 19     4                                                           
   6     2007 18     5                                                           
   7                                                                             
   8   WgtAvg     16.4 C8: =SUMPRODUCT(xi, wi)/SUM(wi)                           
   9   N             5 C9: =COUNT(xi)                                            
  10   SDw       4.199 C10: =SQRT(SUMPRODUCT(wi*(xi-WgtAvg)^2)/SUM(wi) * N/(N-1))
See http://www.itl.nist.gov/div898/software/dataplot/refman2/ch2/weightsd.pdf.

================================================================================================================================


Thank you very much for your reply and assistance. The only issue I'm wondering about is based on the weighted SD attachment that you appended, shouldnt the last part of the formula be: SUM(wi)*(N-1)/N

Thanks again for your help as it was very useful.
 
Upvote 0
BTW, if the wights were actually frequencies of observations (versus random old weights), the other formula ...

=SQRT(SUMPRODUCT(D2:D6,C2:C6)/(SUM(C2:C6)-1))

would give the same result.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top