There's an archaic trick that people used for keeping running tallies of all the information needed for SD in the days of mechanical calculators. If a measurement is, say, 239.87, you enter something like 10000239.87, square it, then add to the previous sum. You end up with a long number that has N (the sample size) followed by a bunch of 0's, followed by twice the sum of the data, followed by a bunch of 0's, followed by the sum of the squares of the data. I've forgotten the capabilities of the mechanical calculators, but I think when you wanted the actual SD there was a way to get it without re-entering the data --- probably doing square roots by iterating divide and average. There's a related trick for doing the running tallies needed for correlations. I did a bunch of this as an undergraduate, as well as factor analysis, on a mechanical calculator, around 1965 or so. It's a lot easier now! Bill On Thursday, July 10, 2003, at 11:20 AM, Bernie Cosell wrote:
I thought *SURE* I knew an algorithm once, long ago, for calculating the SD "on the fly", but I can't remember any details of any such trickery and a quick Google search only came up with algorithms that I already know and that start with the obvious "calculate the mean..." Basically, I have a largish data set that it will only be convenient to read once and I'd like to be able to calculate [or at least estimate] the SD as the data comes by and avoid having to scroll it into a temp file and then do a second pass over the data from the temp file... Is there such an algorithm or am I just misremembering?
Thanks!
/Bernie\
-- Bernie Cosell Fantasy Farm Fibers mailto:bernie@fantasyfarm.com Pearisburg, VA --> Too many people, too few sheep <--
_______________________________________________ math-fun mailing list math-fun@mailman.xmission.com http://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun