Understanding the sum of squares calculator — concept and principle
This calculator finds the sum of squared deviations from the mean, SS = Σ(x − x̄)², along with the mean, the raw sum of squares, the correction term, the sample and population variance and the sample standard deviation. Use it for statistics homework, ANOVA tables, regression and checking variance calculations by hand.
How it is calculated
- Mean: x̄ = Σx ÷ n.
- Sum of squares: SS = Σ(x − x̄)².
- Shortcut (equal): SS = Σx² − (Σx)² ÷ n, the raw sum of squares minus the correction term.
- Sample variance s² = SS ÷ (n − 1); population variance σ² = SS ÷ n.
- Standard deviation = square root of the variance.
The page computes SS from the deviations directly, which avoids rounding loss in the shortcut for large numbers.
The principle
Deviations from the mean always add up to zero, so they cannot measure spread directly. Squaring them makes every deviation count positively and gives more weight to values far from the mean. SS is the total squared spread; dividing by the number of values (or by n − 1 for a sample) turns it into the variance. The shortcut formula comes from expanding (x − x̄)² and using Σx = n·x̄. In ANOVA and regression, the total SS is split into parts explained by the model and parts left over.
Worked example
Default data: 4, 7, 6, 9, 3, 7.
- Σx = 36, n = 6, mean = 6.
- Deviations: −2, 1, 0, 3, −3, 1.
- Squares: 4, 1, 0, 9, 9, 1; SS = 24.
- Check: Σx² = 240, correction (36)² ÷ 6 = 216, 240 − 216 = 24.
- Sample variance = 24 ÷ 5 = 4.8, s ≈ 2.19089023; population variance = 24 ÷ 6 = 4.
How to read the result
SS on its own grows with the number of values, so compare data sets using the variance or standard deviation instead. A SS of 0 means every value equals the mean. Use the sample variance when your data are a sample from a larger population, and the population variance when you have every member.
Common mistakes
- Squaring the sum instead of summing the squares: (Σx)² ≠ Σx².
- Forgetting to subtract the mean.
- Dividing by n for a sample variance instead of n − 1.
- Rounding the mean before computing deviations, which adds error.
Frequently asked questions
Why divide by n − 1 for a sample?
Deviations are measured from the sample mean, which is fitted to the data, so dividing by n would underestimate the population variance on average.
What is the difference between SS and variance?
Variance is SS divided by n or n − 1; SS is the undivided total.
What is the total sum of squares in regression?
Σ(y − ȳ)², the total variation of y, which the model splits into explained and residual parts.
Sources: NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.6 Measures of Scale