Sum of squares
By Jude Wallis · Updated
The sum of squares is the total of the squared deviations from the mean, and it is the numerator that sits on top of the variance formula.
The sum of squares adds up each observation's squared distance from the mean: , where are the values and (x-bar) is their mean. Squaring is what stops the raw deviations from cancelling, since they always add to zero. The result is never negative and it is in squared units, so it is a step inside a calculation rather than a number you report.
For 10, 12, 15, 19 the mean is . The deviations are -4, -2, 1, and 5, their squares are 16, 4, 1, and 25, and . Divide by and the sample variance is ; take the square root and the sample standard deviation is .
The name invites the wrong calculation, and "square each value and add them up" is the version to name out loud. For those four numbers that gives , not 46. The squaring happens after the subtraction, never before it. Anything called a sum of squares in statistics is a sum of squared distances from something, and in this formula that something is the mean.
The mean is not an arbitrary reference point either. The quantity is smallest when : for those four values, and each give 50, while gives 46. That is the property least-squares regression generalizes when it picks the line that minimizes the sum of squared residuals.
One boundary catches people out. SS is not itself a measure of spread, because it grows with the number of observations. Write those same four values twice, 10, 10, 12, 12, 15, 15, 19, 19, and the spread has not changed while SS doubles to 92. Only after dividing by does the number describe the data instead of the size of the data set. SS reaches 0 in exactly one situation: every value equals the mean, which means every value is the same.
Where this comes up
More describing data terms, or browse the full statistics glossary.