Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have a list of values of a random variable $x \in \mathbb R$. Is it possible to find the varience $\overline{(x - \overline x)^2}$ without computing the mean $\overline x$ first? That is to process the list only once.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You can use that the variance is $\overline{x^2} - \overline {x}^2$, which takes only one pass (computing the mean and the mean of the squares simultaneously), but can be more prone to roundoff error if the variance is small compared with the mean.

share|improve this answer
    
oh, how could I forget this. –  Yrogirg Jan 24 '12 at 17:24
    
And should have stated from wikipedia en.wikipedia.org/wiki/Algorithms_for_calculating_variance At first I thought it would be impossible and there would be no such algorithm. –  Yrogirg Jan 24 '12 at 18:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.