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: SS=(xixˉ)2\text{SS} = \sum (x_i - \bar{x})^2, where xix_i are the values and xˉ\bar{x} (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 56/4=1456/4 = 14. The deviations are -4, -2, 1, and 5, their squares are 16, 4, 1, and 25, and SS=46\text{SS} = 46. Divide by n1=3n - 1 = 3 and the sample variance is s2=15.33s^2 = 15.33; take the square root and the sample standard deviation is s=3.92s = 3.92.

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 100+144+225+361=830100 + 144 + 225 + 361 = 830, 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 (xic)2\sum (x_i - c)^2 is smallest when c=xˉc = \bar{x}: for those four values, c=13c = 13 and c=15c = 15 each give 50, while c=14c = 14 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 n1n - 1 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.