# Sample Standard Deviation - Rapid Calculation Methods - Weighted Calculation

Weighted Calculation

When the values xi are weighted with unequal weights wi, the power sums s0, s1, s2 are each computed as:

And the standard deviation equations remain unchanged. Note that s0 is now the sum of the weights and not the number of samples 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 k from 1 to n:

begin{align} W_0 &= 0\ W_k &= W_{k-1} + w_k end{align}

and places where 1/n is used above must be replaced by wi/Wn:

begin{align} A_0 &= 0\ A_k &= A_{k-1}+frac{w_k}{W_k}(x_k-A_{k-1})\ Q_0 &= 0\ Q_k &= Q _{k-1} + frac{w_k_W_{k-1}}{W_k}(x_k-A_{k-1})^2 = Q_{k-1}+w_k(x_k-A_{k-1})(x_k-A_k) end{align}

In the final division,

and

where n is the total number of elements, and 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.

Read more about this topic:  Sample Standard Deviation, Rapid Calculation Methods

### Famous quotes containing the word calculation:

“To my thinking” boomed the Professor, begging the question as usual, “the greatest triumph of the human mind was the calculation of Neptune from the observed vagaries of the orbit of Uranus.”
“And yours,” said the P.B.
Samuel Beckett (1906–1989)