Lecture13-14 RSS

📚 Lecture13-14_RSS.pdf

Brief overview

This document introduces the mathematical underpinnings of regression models, focusing on the concept and calculation of residual sum of squares. Understanding RSS is crucial for evaluating the fit of regression models to data.

Key points

  • Mathematical formulation of regression models
  • Definition and calculation of residuals
  • The formula for residual sum of squares (RSS)
  • Relationship between observed and predicted values

1. Mathematical formulation of regression models

1.1 Model definition and residuals

Regression models aim to predict an observed value, yy, using a set of input features, XX, and model parameters, ww. The model's prediction for yy is denoted by y^\hat{y}.

This prediction is calculated as a linear combination of the features and their corresponding weights.

  • Model prediction: y^=Xw\hat{y} = Xw
  • Features matrix (XX): Contains the input variables.
  • Parameter vector (ww): Contains the model weights.

The difference between the observed value yy and the predicted value y^\hat{y} is called the residual. Residuals represent the error of the model for a specific observation.

  • Residual for an observation: e=y−y^e = y - \hat{y}
  • Residual vector (ee): Contains residuals for all observations. e=y−Xwe = y - Xw. This is a vector where each element is yi−⟨xi,w⟩y_i - \langle x_i, w \rangle.

1.2 Residual sum of squares (RSS)

The Residual Sum of Squares (RSS) quantifies the total error of the model across all observations. It is calculated by summing the squares of all individual residuals.

Minimizing RSS is a common objective in regression to find the best-fitting parameters.

RSS(w)=∑i=1Mei2=∑i=1M(yi−⟨xi,w⟩)2RSS(w) = \sum_{i=1}^{M} e_i^2 = \sum_{i=1}^{M} (y_i - \langle x_i, w \rangle)^2

This can also be expressed in matrix notation as:

RSS(w)=(y−Xw)T(y−Xw)RSS(w) = (y - Xw)^T (y - Xw)

  • yy: Vector of observed values.
  • XX: Matrix of input features.
  • ww: Vector of model parameters (weights) 1.

🔑 Important: The goal in many regression analyses is to find the parameter vector ww that minimizes the Residual Sum of Squares (RSS), effectively making the model's predictions as close as possible to the actual observed data.

📝 Example: If a model predicts a house price of 300,000 dollars and the actual price was 320,000 dollars, the residual is 20,000 dollars. Squaring this and summing across all houses helps us evaluate the overall model performance.

🔑 Important: Minimizing RSS(w)RSS(w) is equivalent to minimizing the squared error between observed and predicted values. This is the foundation of Ordinary Least Squares (OLS) regression.

🔑 Important: The dimension of the residual vector ee is M×1M \times 1, where MM is the number of observations. The dimension of the parameter vector ww is (d+1)×1(d+1) \times 1, where dd is the number of features.

© 2026 Maeve. All rights reserved. This content is protected by copyright.

See also