Curious Minds

Clear answers to science and history questions

How to Find SS in Statistics: A Step-by-Step Guide

· 6 min read · Science

To find SS (sum of squares) in statistics, you calculate the squared deviation of each data point from a relevant mean, then add those squared deviations together. The most common version is the total sum of squares (SST), which uses the grand mean, but you will also encounter the sum of squares for regression (SSR) and the sum of squares for error (SSE) in regression and ANOVA contexts. The calculation itself is straightforward arithmetic; the challenge is knowing which mean to use and how to organize the work so you do not lose track of signs, rounding, or the difference between the three sums of squares.

What You'll Need

  • A data set with at least one numeric variable (for regression, you need paired x and y values).
  • The mean of the relevant values — the grand mean for total SS, the group means for within-group SS, or the predicted values for regression SS.
  • A calculator or spreadsheet; a spreadsheet is strongly recommended for anything beyond a handful of points.
  • Patience with signs: squared deviations are always non-negative, so any negative SS is a sign of an arithmetic slip.

Step-by-Step

  1. Clarify which SS you need. In a one-variable setting, total SS is the sum of squared deviations from the mean. In regression, total SS splits into regression SS (explained) and error SS (unexplained). In ANOVA, total SS splits into between-group SS and within-group SS. Write down the definition before touching numbers; mixing them up is the most common source of wrong answers.
  2. Compute the relevant mean(s). For total SS, add all observations and divide by n. For regression, compute the mean of x and the mean of y, then fit the least-squares line (or use given predicted values). For ANOVA, compute each group mean and the grand mean. Keep at least four decimal places during intermediate steps to avoid rounding drift.
  3. Form each deviation. Subtract the mean from each observation: di = xi − x̄. In regression, the residuals are yi − ŷi, where ŷi is the predicted value from the fitted line. In ANOVA, within-group deviations use the group mean, and between-group deviations use the grand mean.
  4. Square each deviation. This removes the sign and gives more weight to points far from the mean. A deviation of −3 and +3 both contribute 9. Do not square the mean or the original value — only the deviation.
  5. Sum the squared deviations. Add all squared values. For total SS: SST = Σ(xi − x̄)². For regression: SSR = Σ(ŷi − ȳ)² and SSE = Σ(yi − ŷi)². For ANOVA: SSB = Σ nj(x̄j − x̄)² and SSW = ΣΣ(xij − x̄j)². The identity SST = SSR + SSE (or SST = SSB + SSW) is a useful check.
  6. Check your work with the computational formula. SST can also be computed as Σxi² − (Σxi)²/n. This avoids subtracting the mean for every point and is less prone to rounding error in large data sets. If the two methods disagree beyond rounding, recheck your arithmetic.
  7. Report SS with its degrees of freedom. SS alone is not a variance; it grows with sample size. In ANOVA, total df = n − 1, between-group df = k − 1, and within-group df = n − k, where k is the number of groups. In regression, regression df = 1 for a simple linear model and error df = n − 2. Mean squares are SS divided by df, and those are what F-tests use.

Common Mistakes

  • Squaring the original values instead of the deviations. Σxi² is not SS; it is an intermediate term in the computational formula. The definition always involves a deviation from a mean.
  • Using the wrong mean. Total SS uses the grand mean; within-group SS uses each group mean. Swapping them produces a number that looks plausible but answers a different question.
  • Rounding too early. Rounding the mean to two decimals before squaring can shift SS noticeably in small samples. Carry more digits than you plan to report.
  • Forgetting the sample-size weights in ANOVA. Between-group SS uses nj(x̄j − x̄)², not just (x̄j − x̄)². Unequal group sizes make this error especially costly.
  • Reporting SS as if it were variance. SS is in squared units and depends on n. Divide by the appropriate df to get a mean square before comparing variability across studies.

Tips

  • Build a table with columns for the observation, the deviation, and the squared deviation. This makes errors visible and lets you sum with a single spreadsheet formula.
  • Use the identity SST = SSR + SSE as a built-in audit. If the parts do not add up, one of the three is wrong.
  • Keep units in mind: if your data are in meters, SS is in square meters. That is normal, but it explains why SS values look large.
  • For large data sets, use the computational formula or a spreadsheet function (for example, DEVSQ in many spreadsheet programs) and verify against a hand calculation on a small subset.
  • When comparing models, report SS alongside df and mean squares; SS alone can mislead because adding predictors always reduces SSE.

Troubleshooting

  • SS comes out negative. This is impossible for a true sum of squares. Check for a sign error in the deviation or a misplaced parenthesis in the computational formula.
  • SST does not equal SSR + SSE. Recompute the predicted values and confirm you used the same data points in all three sums. A single omitted point breaks the identity.
  • Results differ between hand calculation and software. Compare intermediate values (mean, each squared deviation) rather than final totals. Software usually carries full precision; your hand work may have rounded.
  • ANOVA SS looks too large or too small. Verify group sizes and whether the design is balanced. With unequal n, the weighted formula is required.
  • Unsure which SS a textbook question wants. Look for the phrase “from the mean,” “explained by regression,” or “within groups.” If it is ambiguous, compute total SS first and state your definition.

Frequently Asked Questions

What does SS stand for in statistics?

SS stands for sum of squares: the sum of squared deviations of data points from a mean or from predicted values. It is a building block for variance, standard deviation, and ANOVA.

Is SS the same as variance?

No. Variance is SS divided by degrees of freedom (for a sample, n − 1). SS grows with sample size; variance is scaled to be comparable across sample sizes.

How do I calculate SS in Excel or Google Sheets?

Use DEVSQ for the sum of squared deviations from the mean of a range. For regression SS and error SS, compute predicted values and residuals first, then use SUMSQ on the appropriate columns.

What is the difference between SST, SSR, and SSE?

SST is total variation around the mean. SSR is the part explained by the regression line. SSE is the unexplained residual part. In a model with an intercept, SST = SSR + SSE.

Can SS be zero?

Yes, if every observation equals the mean (or every residual is zero), all deviations are zero and so is SS. In practice this is rare with real data.

Why do we square deviations instead of taking absolute values?

Squaring makes the function differentiable and gives a variance measure with convenient mathematical properties. Absolute deviations are used in some robust methods, but standard SS and ANOVA rely on squares.

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions