Mathwords logoMathwords

Total Sum of Squares — Definition, Formula & Example

The total sum of squares (SST) is a single number that measures how spread out the response values yy are around their own mean, before any regression line is used. It is the baseline variation that a regression model tries to explain.

For observed response values y1,y2,…,yny_1, y_2, \ldots, y_n with sample mean yˉ\bar{y}, the total sum of squares is SST=∑i=1n(yi−yˉ)2\text{SST} = \sum_{i=1}^{n} (y_i - \bar{y})^2. For a least-squares line with an intercept, it splits exactly as SST=SSR+SSE\text{SST} = \text{SSR} + \text{SSE}. Here SSR is the regression (explained) sum of squares and SSE is the residual (unexplained) sum of squares. It is also called the total variation sum of squares.

Key Formula

SST=∑i=1n(yi−yˉ)2=SSR+SSE,R2=1−SSESST\text{SST} = \sum_{i=1}^{n} (y_i - \bar{y})^2 = \text{SSR} + \text{SSE}, \qquad R^2 = 1 - \frac{\text{SSE}}{\text{SST}}
Where:
  • yiy_i = the i-th observed response value
  • yˉ\bar{y} = the mean of all n response values
  • nn = the number of data points
  • SSR\text{SSR} = regression sum of squares, the variation explained by the line
  • SSE\text{SSE} = sum of squared residuals, the variation the line leaves unexplained
  • R2R^2 = coefficient of determination, the fraction of SST explained by the line

Worked Example

Problem: A runner records her Saturday run for 4 weeks. Week xx = 1, 2, 3, 4 gives distances yy = 3, 7, 5, 9 miles. The least-squares line is y^=1.6x+2\hat{y} = 1.6x + 2, and its sum of squared residuals is SSE = 7.2. Find SST and use it to find R2R^2.
Step 1: Find the mean of the y-values only. SST never uses the x-values or the line.
yˉ=3+7+5+94=6\bar{y} = \frac{3 + 7 + 5 + 9}{4} = 6
Step 2: Subtract the mean from each y-value, square each deviation, and add the squares.
SST=(−3)2+12+(−1)2+32=9+1+1+9=20\text{SST} = (-3)^2 + 1^2 + (-1)^2 + 3^2 = 9 + 1 + 1 + 9 = 20
Step 3: Compare the leftover variation (SSE) with the total variation (SST).
R2=1−7.220=1−0.36=0.64R^2 = 1 - \frac{7.2}{20} = 1 - 0.36 = 0.64
Answer: SST = 20 (in units of miles squared). The line explains 20 − 7.2 = 12.8 of that variation, so R2=0.64R^2 = 0.64: week number accounts for 64% of the variation in distance.

Why It Matters

SST is the denominator of R2R^2, the fit statistic that graphing calculators and statistics software report for a least-squares line. Because SST depends only on the y-values, it stays the same when you compare different models fit to the same data. That shared baseline is what lets you compare their fits fairly.

Common Mistakes

Mistake: Subtracting the predicted values y^i\hat{y}_i instead of the mean yˉ\bar{y} when computing SST.
Correction: Using y^i\hat{y}_i gives SSE, the unexplained variation. SST measures distance from the horizontal line y=yˉy = \bar{y}, so always subtract the mean.

Related Terms