Regression &
Model Comparison
Master further regression models, learn to analyse residuals, and use goodness-of-fit measures to choose the best model for your data.
What Is Regression?
Regression is the process of fitting a mathematical model to a set of bivariate data. The goal: find the function \( \hat{y} = f(x) \) that best describes the relationship between two variables.
Types of Regression Models
Understanding Residuals
A residual is the vertical distance between a data point and its predicted value on the regression curve:
The \( R^2 \) Coefficient
The coefficient of determination \( R^2 \) measures how much of the variation in \( y \) is explained by the regression model:
\( R^2 \) vs \( r \): Key Distinction
| \( r \) (Pearson's) | \( R^2 \) (Determination) | |
|---|---|---|
| Range | \( -1 \leq r \leq 1 \) | \( 0 \leq R^2 \leq 1 \) |
| Direction? | Yes: sign shows +/ − | No: always non-negative |
| Model type | Linear only | Any regression model |
| Relationship | For linear models: \( R^2 = r^2 \) | |
Reading Residual Plots
A residual plot graphs residuals \( e_i \) against the independent variable \( x \). It reveals whether your model is appropriate.
How to Compare Models
Worked Example: Bacteria Growth
A biologist records the number of bacteria \( N \) (thousands) over time \( t \) (hours):
| \( t \) | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| \( N \) | 2.0 | 3.1 | 4.8 | 7.5 | 11.6 | 18.0 |
Fitting Two Models
\( R^2 = 0.957 \)
\( R^2 = 0.999 \)
Residual Analysis
Example 2: Quadratic vs Power
The distance \( d \) (metres) a ball rolls down a slope is recorded against time \( t \) (seconds):
| \( t \) | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| \( d \) | 0.5 | 2.1 | 4.6 | 8.1 | 12.7 | 18.2 |
\( R^2 = 0.9998 \)
\( R^2 = 0.9996 \)
Example 3: Sinusoidal Data
Average monthly temperature \( T \) (°C) in a city over 12 months shows a clear periodic pattern. A sinusoidal regression gives:
Beware of Overfitting
A model with too many parameters will pass through every data point (\( R^2 = 1 \)) but make terrible predictions. This is called overfitting.
Common Mistakes
Model Comparison Summary
| Model | Equation Form | Best For |
|---|---|---|
| Linear | \( y = ax + b \) | Constant rate of change |
| Quadratic | \( y = ax^2 + bx + c \) | One turning point |
| Exponential | \( y = a \cdot e^{bx} \) | Growth / decay |
| Power | \( y = ax^n \) | Scaling laws |
| Sinusoidal | \( y = a\sin(bx+c)+d \) | Periodic / seasonal |
Question 1 of 5
A residual is defined as:
Question 2 of 5
A linear regression gives \( R^2 = 0.82 \) and an exponential regression gives \( R^2 = 0.97 \). The residual plot for the exponential model shows random scatter. Which model should you choose?
Question 3 of 5
If a residual plot shows a clear U-shaped curve, what does this indicate?
Question 4 of 5
For a linear regression with \( r = -0.9 \), what is \( R^2 \)?
Question 5 of 5
A data set has 6 points. A polynomial of degree 5 gives \( R^2 = 1 \). Is this model necessarily the best choice?