4.2.6
Adjusted R²
Summary
- Adjusted R² compensates the plain R² for the number of features, reducing optimism when models grow more complex.
- Compute both R² and adjusted R² in Python to see how they diverge as features are added.
- Understand the limitations with small sample sizes and how to combine adjusted R² with other criteria.
1. Definition #
$$ \mathrm{Adjusted}\;R^2 = 1 - (1 - R^2)\frac{n - 1}{n - p - 1} $$- \(n\): number of samples, \(p\): number of predictors.
- As \(p\) increases, the denominator shrinks; unless the new feature improves fit, adjusted R² decreases.
2. Python example #
| |
Ensure \(n - p - 1 > 0\); otherwise shrink the feature set or enlarge the validation sample.
3. When to use it #
- Feature selection: discourages unnecessary variables; if adjusted R² drops, the new feature adds noise.
- Small samples: values fluctuate more; cross-validate to confirm improvements.
- Model comparison: among models fitted to the same dataset, adjusted R² rewards parsimonious solutions.
4. Relation to other metrics #
| Metric | Strength | Caveat |
|---|---|---|
| R² | Intuitive variance explanation | Always increases with more features |
| Adjusted R² | Accounts for feature count | Unstable for tiny sample sizes |
| AIC / BIC | Likelihood + penalty | Need correct likelihood assumptions |
Summary #
- Adjusted R² tempers R² by penalising complexity, revealing whether added features truly help.
- Use it alongside R², AIC/BIC, or cross-validation to form a well-rounded view of model quality.
- Pay attention to the sample-to-feature ratio; the metric only behaves well when the denominator stays positive.