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.
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.
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.
Visualizing the Trade-off
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.
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.
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
\( 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.
Never decreases when variables are added. Can be misleading.
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.
Penalty: \( 2k \). Favors more complex models.
Penalty: \( k\ln(n) \). Stronger penalty; prefers simpler models.
How to Select a Model
Example 1: Ice Cream Sales
A shop models daily sales (\( y \)) based on temperature (\( x \)). Which model is better?
\( R^2 = 0.82 \), Adj \( R^2 = 0.81 \)
Test error: \( 15.2 \)
\( 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?
Common Mistakes in Model Selection
Key Takeaways
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?