Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Standard deviation
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Weighted calculation=== <!--N.B. the apparently superfluous trailing \0 in the <math> equations prevents conversion of simple formulas to HTML, resulting in more consistent formatting.--> When the values <math>x_k</math> are weighted with unequal weights <math>w_k</math>, the power sums {{math|{{var|s}}{{sub|0}}, {{mvar|s}}{{sub|1}}, {{var|s}}{{sub|2}}}} are each computed as: <math display="block">s_j = \sum_{k=1}^N w_k x_k^j.\,</math> And the standard deviation equations remain unchanged. {{math|{{var|s}}{{sub|0}}}} is now the sum of the weights and not the number of samples {{mvar|N}}. The incremental method with reduced rounding errors can also be applied, with some additional complexity. A running sum of weights must be computed for each {{mvar|k}} from 1 to {{mvar|n}}: <math display="block">\begin{align} W_0 &= 0 \\ W_k &= W_{k-1} + w_k \end{align}</math> and places where {{math|1/{{var|k}}}} is used above must be replaced by <math>w_k/W_k</math>: <math display="block">\begin{align} A_0 &= 0 \\ A_k &= A_{k-1} + \frac{w_k}{W_k}\left(x_k - A_{k-1}\right) \\ Q_0 &= 0 \\ Q_k &= Q_{k-1} + \frac{w_k W_{k-1}}{W_k}\left(x_k -A_{k-1}\right)^2 = Q_{k-1} + w_k\left(x_k-A_{k-1}\right)\left(x_k - A_k\right) \end{align}</math> In the final division, <math display="block">\sigma^2_n = \frac{Q_n}{W_n}\,</math> and <math display="block">s^2_n = \frac{Q_n}{W_n - 1},</math> or <math display="block">s^2_n = \frac{n'}{n' - 1} \sigma^2_n,</math> where {{mvar|n}} is the total number of elements, and {{mvar|{{prime|n}}}} is the number of elements with non-zero weights. The above formulas become equal to the simpler formulas given above if weights are taken as equal to one.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)