Sum of Squares Calculator

Sum of Squares Calculator

Calculate the sum of squared deviations from the mean, the raw sum of squares Σx², and the sum of squares about any target value you choose.

SS = Σ(x − x̄)² = Σx² − (Σx)² ÷ n

Separate values with commas, spaces or new lines.

Enter some values to find their sum of squares

What is the Sum of Squares?

The sum of squares (SS) adds up the squared distance of every value from the mean. It's the raw total of variation in a dataset before dividing by anything; divide by n − 1 and you have the sample variance.

It's the currency of much of statistics. ANOVA splits the total sum of squares into the part explained by the groups and the part left over. Regression splits it into the part explained by the line and the residuals, and R² is the ratio of the two.

"Sum of squares" can also mean the uncorrected Σx², the plain total of the squared values, so check which one a formula wants. This calculator gives both.

Sum of Squares Formula

Definitions as given in the NIST/SEMATECH e-Handbook of Statistical Methods. See Sources.

1. By definition

SS = Σ(x − x̄)²

2. The hand-calculation shortcut

SS = Σx² − (Σx)² ÷ n

Quicker by hand because you never work out individual deviations, but less accurate on a computer when the values are large and close together.

3. About any other value c

Σ(x − c)² = SS + n(x̄ − c)²

The extra term is zero only when c is the mean, so no other value gives a smaller total. That is the idea behind "least squares".

Worked Example: Five Values Two Ways

Given:
The values 5, 7, 8, 10, 15 and a target of 10.
Step 1:
By definition (mean 45 ÷ 5 = 9):
16 + 4 + 1 + 1 + 36 = 58
Step 2:
By the shortcut:
Σx² = 463 → 463 − 45² ÷ 5 = 463 − 405 = 58
Step 3:
About the target of 10:
58 + 5 × (9 − 10)² = 63
Result:
SS = 58

Both routes agree, and dividing by 4 gives a sample variance of 14.5. Measured from the target of 10 instead, the total rises to 63: the extra 5 is the cost of the mean being 1 away from target.

Why the Mean Gives the Smallest Sum of Squares

The worked example's values, with squared distances measured from different reference points. The mean always wins.

Sum of squares about different reference values
Measured fromSum of squares
0 (uncorrected)463
Median, 863
Mean, 958
Target, 1063

Common Sum of Squares Mistakes

  • Confusing Σx² with (Σx)². Square each value then add, against add then square. For the example that's 463 against 2,025.
  • Using the uncorrected sum where the corrected one is needed. Variance, ANOVA and regression all need deviations from the mean.
  • Losing precision with the shortcut. For large values close together, Σx² and (Σx)² ÷ n are huge and nearly equal, and rounding wipes out the difference.
  • Calling SS a variance. It hasn't been divided by anything yet, so it keeps growing as you add data.

Sum of Squares FAQs

Why square the deviations?

So they don’t cancel out, and because squared deviations add up neatly, which lets ANOVA and regression split total variation into parts.

What are SST, SSR and SSE?

In regression, the total sum of squares (SST) splits into the regression sum of squares (SSR, explained) and the error sum of squares (SSE, residual): SST = SSR + SSE.

Which Excel function gives the sum of squares?

=DEVSQ(range) gives Σ(x − x̄)². =SUMSQ(range) gives the uncorrected Σx².

Can the sum of squares be negative?

No. It’s a sum of squares, so it’s zero when every value is equal and positive otherwise.

How is it related to the standard deviation?

SD = √(SS ÷ (n − 1)) for a sample. For the example, √(58 ÷ 4) = 3.81.

What is the sum of squares about a target used for?

In quality control, the squared distance from a target value combines spread and bias in one figure. Dividing it by n gives the mean squared error.

Why is it called the “corrected” sum of squares?

Because the uncorrected Σx² is corrected by subtracting (Σx)² ÷ n, the correction for the mean.

Does adding a constant to every value change SS?

No. Shifting all values moves the mean by the same amount, so every deviation stays the same. Multiplying every value by k multiplies SS by k².

Sources

Related Tools