01 / 21

Model Selection
& Overfitting

Learn why a model that fits training data perfectly can still fail on new data, and how to choose the right level of complexity.

Business Statistics

What Is a Statistical Model?

A statistical model is a mathematical equation that describes the relationship between variables. In business, we use models to predict outcomes like revenue, customer churn, or demand.

Simple Model
A straight line: \( y = b_0 + b_1 x \). Easy to interpret, but may miss patterns.
Complex Model
A polynomial: \( y = b_0 + b_1 x + b_2 x^2 + \cdots \). Captures more detail, but risks fitting to noise.

The Bias-Variance Trade-off

A model's prediction error comes from three sources, two of which are in competition: Bias and Variance. Reducing one often increases the other.

Bias
Error from oversimplifying the model. A line fit to curved data consistently misses the pattern.
Variance
Error from being too sensitive to training data. The model changes dramatically with different samples.

Visualizing the Trade-off

Model Complexity Error Simple Complex
\( \text{Bias}^2 \)
Variance
Total Error
Optimal

What Is Overfitting?

Overfitting occurs when a model learns the noise in the training data instead of the underlying pattern. It performs well on training data but poorly on new, unseen data.

Good Fit Overfit Training Data Training Data

What Is Underfitting?

Underfitting occurs when a model is too simple to capture the underlying pattern. It performs poorly on both training and new data.

Underfit: Flat Line True pattern

Overfitting vs Underfitting

Underfitting Just Right Overfitting
Complexity Too low Balanced Too high
Training Error High Low Very low
Test Error High Low High
Bias High Moderate Low
Variance Low Moderate High

Training vs Test Error

Model Complexity Error Training Test Gap Best Model Underfitting Overfitting

\( R^2 \) vs Adjusted \( R^2 \)

\( R^2 \) measures how well a model fits the training data, but it always increases when you add more variables, even useless ones. Adjusted \( R^2 \) penalizes unnecessary complexity.

\( R^2 \)
\( R^2 = 1 - \frac{SS_{\text{res}}}{SS_{\text{tot}}} \)
Never decreases when variables are added. Can be misleading.
Adjusted \( R^2 \)
\( R^2_{\text{adj}} = 1 - \frac{(1-R^2)(n-1)}{n-k-1} \)
Here, \( n \) is sample size and \( k \) is number of predictors. Penalizes extra predictors.

Information Criteria: AIC & BIC

Information criteria balance model fit against complexity using a single number. Lower values indicate a better model.

AIC
\( \text{AIC} = 2k - 2\ln(\hat{L}) \)
Penalty: \( 2k \). Favors more complex models.
BIC
\( \text{BIC} = k\ln(n) - 2\ln(\hat{L}) \)
Penalty: \( k\ln(n) \). Stronger penalty; prefers simpler models.

How to Select a Model

1
Start simple. Begin with a model using few predictors. Establish a baseline.
2
Add variables one at a time. Check whether adjusted \( R^2 \) increases and AIC/BIC decreases.
3
Split your data. Use a training set to build the model and a test set to evaluate it.
4
Compare training vs test error. A large gap signals overfitting: step back to a simpler model.
5
Choose the simplest adequate model. Among models with similar test performance, pick the one with fewer parameters.

Example 1: Ice Cream Sales

A shop models daily sales (\( y \)) based on temperature (\( x \)). Which model is better?

Model A (Linear)
\( y = 20 + 3x \)
\( R^2 = 0.82 \), Adj \( R^2 = 0.81 \)
Test error: \( 15.2 \)
Model B (Degree 7)
\( y = b_0 + b_1 x + \cdots + b_7 x^7 \)
\( R^2 = 0.98 \), Adj \( R^2 = 0.79 \)
Test error: \( 42.6 \)

Example 2: Predicting Revenue

A company tests three regression models for quarterly revenue. Here are the results on \( n = 40 \) observations:

Metric Model 1 (\( k=2 \)) Model 2 (\( k=4 \)) Model 3 (\( k=12 \))
\( R^2 \) 0.71 0.86 0.97
Adjusted \( R^2 \) 0.70 0.84 0.83
AIC 215 188 196
BIC 220 198 218
Test Error 34.1 22.5 39.8

Example 3: Polynomial Degree

Six data points. Three fits. Which polynomial degree generalizes best?

Degree 1 Degree 2 Degree 5

Common Mistakes in Model Selection

✕ Chasing \( R^2 \)
Adding more variables always raises \( R^2 \). Use adjusted \( R^2 \) or information criteria instead.
✕ No Test Set
Evaluating the model only on training data gives an overly optimistic view of performance.
✕ Too Many Predictors
Using \( k \) close to \( n \) almost guarantees overfitting. Keep \( k \ll n \).

Key Takeaways

1
Overfitting = model learns noise. Low training error, high test error.
2
Underfitting = model misses signal. High training error, high test error.
3
Bias-Variance trade-off: simple models have high bias; complex models have high variance.
4
Use adjusted \( R^2 \), AIC, and BIC to compare models: they penalize unnecessary complexity.
5
Always validate on a test set. The gap between training and test error reveals overfitting.

Question 1 of 5

A model has very low training error but very high test error. This is a sign of:

Question 2 of 5

Adding a random, unrelated variable to a regression will most likely:

Question 3 of 5

Compared to AIC, the BIC criterion:

Question 4 of 5

A model with high bias and low variance is best described as:

Question 5 of 5

You are comparing three models. Model A: AIC = 210, BIC = 218. Model B: AIC = 195, BIC = 208. Model C: AIC = 198, BIC = 225. Using both criteria, which model is preferred?