How to calculate Standard Deviation without detailed historical data?

7.3k Views Asked by At

i'm taking some measurements... Let's say i don't have the luxury to store each individual value but i can only store the sum of all measures and their number (and any other such aggregate data). For example, when a new measurement comes in i do this:

sum = sum + newValue; number = number + 1; average = sum / number;

So i can keep basically any such info like the sum and number but not individual values. Is there a way that allows me to calculate standard deviation like this as well? Incrementally? Is there something else similar to standard deviation that i can calculate like this?

Thanks!

UPDATE: From @Chinny i understand this is called a rolling standard deviation and @user121049 gave me an answer.

I ended up using what is called a "running standard deviation" as called on Wikipedia: http://en.wikipedia.org/wiki/Standard_deviation#Rapid_calculation_methods

1

There are 1 best solutions below

2
On BEST ANSWER

Yes if you keep the sum of the squares. $\sum(x_i-\bar{x})^2=\sum x_i^2 -n \bar{x}^2$