Actuarial Notes

Residual Sum of Squares

Study guides: Exam MAS-I, Exam MAS-II

The Residual Sum of Squares (RSS) is the sum of the squared residuals of a fitted model, the variation in the response that the model leaves unexplained. For n observations it is

\text{RSS} = \sum_{i=1}^{n} (y_i - \hat{y}_i)^2

  • y_i is the observed response and \hat{y}_i is its fitted value.

The RSS is also called the sum of squared errors (SSE). As a sum of squares it is never negative. Least squares chooses the coefficients that minimize it, so adding a predictor to a model can never increase the RSS.

Observed claim severities are 200, 210 and 270, and a model's fitted values are 180, 220 and 260. What is the RSS?

  • The residuals are 200 - 180 = 20, 210 - 220 = -10 and 270 - 260 = 10.
  • The RSS is 20^2 + (-10)^2 + 10^2 = 600.

Total sum of squares

The total sum of squares measures the variation of the response about its mean:

\text{TSS} = \sum_{i=1}^{n} (y_i - \bar{y})^2

  • \bar{y} is the sample mean of the responses.

The TSS depends only on the responses, so it does not change with the predictors in the model. A model with only an intercept has every fitted value equal to \bar{y}, so its RSS equals the TSS. For a least squares fit with an intercept, the total variation splits into the part the regression explains and the residual part:

\sum_{i=1}^{n} (y_i - \bar{y})^2 = \sum_{i=1}^{n} (\hat{y}_i - \bar{y})^2 + \sum_{i=1}^{n} (y_i - \hat{y}_i)^2

The regression sum of squares is therefore \text{TSS} - \text{RSS}, and R^2 = 1 - \text{RSS}/\text{TSS} is the share of the TSS the regression explains. The ANOVA table lays out this split.

A least squares line fitted to the points (1, 2), (2, 3) and (3, 5) has fitted values 1.8333, 3.3333 and 4.8333. What are the TSS, the RSS and the regression sum of squares?

  • The mean response is \bar{y} = 10/3 = 3.3333.
  • \text{TSS} = 1.3333^2 + 0.3333^2 + 1.6667^2 = 4.6667.
  • The residuals are 0.1667, -0.3333 and 0.1667, so \text{RSS} = 0.1667.
  • The regression sum of squares is \text{TSS} - \text{RSS} = 4.5, which equals \sum (\hat{y}_i - \bar{y})^2 = 1.5^2 + 0 + 1.5^2.

Residual standard error

For a linear regression with an intercept and p predictors, the estimate of the error variance \sigma^2 is

\hat\sigma^2 = \frac{\text{RSS}}{n - p - 1}

  • n - p - 1 is the residual degrees of freedom: n minus the number of estimated coefficients.

The residual standard error is \hat\sigma = \sqrt{\text{RSS}/(n - p - 1)}, the estimate of the error standard deviation \sigma that regression software prints.

Software reports "Residual standard error: 4.74 on 493 degrees of freedom". What are \hat\sigma^2 and the RSS?

  • Squaring the residual standard error gives \hat\sigma^2 = 4.74^2 = 22.47.
  • Multiplying by the residual degrees of freedom gives \text{RSS} = 22.47 \times 493 = 11{,}077.

Residual sum of squares of a regression tree

A regression tree divides the predictor space into regions R_1, \ldots, R_J and predicts the mean response of the region an observation falls in. Its RSS is

\text{RSS} = \sum_{j=1}^{J} \sum_{i \in R_j} (y_i - \bar{y}_{R_j})^2

  • \bar{y}_{R_j} is the mean response of the training observations in region R_j.

Recursive binary splitting grows the tree one split at a time. At each step it compares the splits of the form x_k < s against x_k \ge s over every predictor x_k and cutpoint s, and makes the one with the lowest RSS.

A split puts responses 5, 7 and 6 in one region and 15, 14 and 16 in the other. What is the RSS of the split?

  • The first region's mean is 6, so its RSS is 1 + 1 + 0 = 2.
  • The second region's mean is 15, so its RSS is 0 + 1 + 1 = 2.
  • The RSS of the split is 2 + 2 = 4. The split is chosen if no other predictor and cutpoint gives less.

Practice questions

Actuarial Notes