"Scott S" <[EMAIL PROTECTED]> wrote in message
B7XS9.241514$[EMAIL PROTECTED]">news:B7XS9.241514$[EMAIL PROTECTED]...
> Does anyone know the formula for recursively calculating standard
deviation?
>
> Thanks in advance,
>
> -Scott S
>
>

In the following, x is the new value of the variable.
sumsq is the sum of squares of deviations from the sample average.

dev = x - average
n = n + 1
average = average + dev / n
sumsq = sumsq + dev * (x - average)

The above is the basic updating algorithm.
N.B. The sum of squares is incremented by the product of the deviation from
the old average with the deviation from the new average.   This avoids the
use of factors such as n/(n+1).

The std. deviation is then estimated as sqrt( sumsq / (n-1) )

Cheers

--
Alan Miller
http://users.bigpond.net.au/amiller
Retired Statistician



.
.
=================================================================
Instructions for joining and leaving this list, remarks about the
problem of INAPPROPRIATE MESSAGES, and archives are available at:
.                  http://jse.stat.ncsu.edu/                    .
=================================================================

Reply via email to