if we have an updated set of data ... why can't we just have the routine ... take the updated set of data ... and, find the mean and/or variance and/or standard deviation ... ?

say we set it up so col 1 has the first batch ... and, the update is one new value that goes in the top row of column 1 ... we still have a column 1 ... the routine should be ONLY to replace some value there ... with a new value ... or, if we are continually adding values without dropping any ... we just have a longer and longer column ... but we still do the same "stats" on THAT column

it's not exactly clear from the original post what is meant by "recursive" in this situation ... but none the less, i think there is a simpler solution ... presumably, you won't be doing this by hand for sure

At 12:39 PM 1/8/2003, Donald Burrill wrote:
On Wed, 8 Jan 2003, Scott S wrote:

> Does anyone know the formula for recursively calculating standard
> deviation?

There are several.  Which to prefer depends on how you're doing the
calculating (by hand, by hand calculator, by computer), what precision
you need in the result, and what information you are (or can be)
carrying along with each observation.  Might help if you described a
little of the background of your situation, including the number of
variables to which you want to apply the procedure (and if more than
one, whether you want to update covariances or correlations as well).

I would recommend updating the variance rather than the standard
deviation, since otherwise there are potential rounding-error problems
arising from repeatedly squaring and then taking the square root;
whether these problems are worrisome depends on the precision with which
you choose to calculate.

OTOH, my personal preference is to carry along the sum and sum of
squares of the variable (possibly after subtracting a baseline value);
the updating is much easier, and one is less likely to error in the
application of a more involved formula than one of the standard ones.

In any case, you will need to carry along at a minimum information
equivalent to the number of cases so far, the current sum, and the
current sum of squares;  e.g., the number of cases, the current mean,
and the current variance (or, if you insist, standard deviation).

If you're doing this in a computer, it's hard to imagine that your
storage capacity would not permit carrying sum & sum of squares as well
as current mean and s.d.

 -----------------------------------------------------------------------
 Donald F. Burrill                                            [EMAIL PROTECTED]
 56 Sebbins Pond Drive, Bedford, NH 03110                 (603) 626-0816
 [was:  184 Nashua Road, Bedford, NH 03110               (603) 471-7128]

.
.
=================================================================
Instructions for joining and leaving this list, remarks about the
problem of INAPPROPRIATE MESSAGES, and archives are available at:
.                  http://jse.stat.ncsu.edu/                    .
=================================================================
_________________________________________________________
dennis roberts, educational psychology, penn state university
208 cedar, AC 8148632401, mailto:[EMAIL PROTECTED]
http://roberts.ed.psu.edu/users/droberts/drober~1.htm
.
.
=================================================================
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