Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

The standard sum of squares as I know it is:

Σ (X-m)2

where m is the mean. I ran into a different one which can be written two ways:

Σ(X2) - (ΣX)2/n = Σ(X2) - m ΣX

I believe the latter is called the "correction term for the mean" (e.g. here). My algebra seems to be inadequate to show these are equivalent, so I was looking for a derivation. Thanks.

share|improve this question

2 Answers

up vote 4 down vote accepted

Expanding the square we get:

$\sum_i(X_i-m)^2 = \sum_i(X_i^2 + m^2 - 2 X_i m)$

Thus,

$\sum_i(X_i-m)^2 = \sum_i{X_i^2} + \sum_i{m^2} - 2 \sum_i{X_i m}$

Since $m$ is a constant, we have:

$\sum_i(X_i-m)^2 = \sum_i{X_i^2} + n m^2 - 2 m \sum_i{X_i}$

But,

$\sum_i{X_i} = n m$.

Thus,

$\sum_i(X_i-m)^2 = \sum_i{X_i^2} + n m^2 - 2 n m^2$

Which on simplifying gets us:

$\sum_i(X_i-m)^2 = \sum_i{X_i^2} - n m^2$

Thus, we get can rewrite the rhs of the above in two ways:

$\sum_i{X_i^2} - m (n m) = \sum_i{X_i^2} - m \sum_i{X_i}$

(as $n m = \sum_i{X_i}$)

and

$\sum_i{X_i^2} - n (m)^2 = \sum_i{X_i^2} - \frac{(\sum_i{X_i})^2}{n}$

(as $m = \frac{\sum_i{X_i}}{n}$)

share|improve this answer
Thanks. Very pretty. – telliott99 Nov 11 '10 at 15:29

Although the formula are equal, the practical difference is ease-of-calculation if you're doing it by hand. If all I had was a piece of paper and a pencil, I'd prefer the second formula--- $\sum X^2$ and $\sum X$ together take less time and are less error prone to calculate than $\sum (X - m)^2$.

share|improve this answer
1  
But note that the first formula is less prone to round-off error. – onestop Nov 12 '10 at 13:25

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.