Before we start, let me re-anchor the three quantities so nothing below uses a symbol you haven't seen defined on this page.
Look at the figure: the red vertical stubs are the residuals (yi−y^i) that build SSres; the grey stubs to the flat line build SStot. Every exercise below is really about the size of those red stubs — the smaller they are compared to the grey stubs, the closer R2 climbs to 1.
State, in one sentence each, what SSres, SStot, and R2 measure. Then: if a model predicts the mean yˉ for every point, what is R2?
Recall Solution
SSres = total squared distance between actual points and the model's predictions (leftover error).
SStot = total squared distance between actual points and their average (the whole spread).
R2 = the fraction of that spread the model removed.
If the model predicts yˉ everywhere, then y^i=yˉ, so SSres=∑(yi−yˉ)2=SStot. Then
R2=1−SStotSStot=1−1=0.
A useless model scores exactly 0 — this is the baseline the whole idea is built on. In the first figure, this is the case where every red stub matches its grey stub exactly.
Without computing anything, decide: as you add more useless features p (with n fixed and R2 unchanged), does Radj2 go up or down? Say why using the formula Radj2=1−(1−R2)n−p−1n−1.
Recall Solution
Increasing p shrinks the denominator n−p−1, so the fraction n−p−1n−1grows (fewer free numbers left — see the second figure's right side). That makes (1−R2)×(bigger number) larger, and we subtract it, so Radj2goes down. Useless features are punished even when R2 stays flat.
Actuals y=[10,12,14,16,18], predictions y^=[11,11,15,15,19]. Compute yˉ, SStot, SSres, and R2.
Recall Solution
yˉ=510+12+14+16+18=570=14.SStot=(−4)2+(−2)2+02+22+42=16+4+0+4+16=40.
Residuals yi−y^i=[−1,1,−1,1,−1] (these are exactly the red stubs in the first figure):
SSres=1+1+1+1+1=5.R2=1−405=1−0.125=0.875.
Using R2=0.875 from L2.1, with n=5 and p=2 features, compute Radj2.
Recall Solution
Radj2=1−(1−0.875)5−2−15−1=1−0.125⋅24=1−0.125⋅2=1−0.25=0.75.
The two features cost us 0.875→0.75. Note the free numbers left: n−p−1=2, so the fee 24=2 is already sizeable.
Model A: R2=0.80, p=3. You add one feature, giving Model B: R2=0.82, p=4. Both use n=30. Compute Radj2 for each and decide which model to keep.
Recall Solution
Model A:
Radj,A2=1−(1−0.80)30−3−129=1−0.20⋅2629=1−0.20⋅1.11538…=1−0.223077=0.776923.
Model B:
Radj,B2=1−(1−0.82)30−4−129=1−0.18⋅2529=1−0.18⋅1.16=1−0.2088=0.7912.Radj,B2(0.7912)>Radj,A2(0.7769), so the new feature earned its place — keep Model B. The R2 rise from 0.80 to 0.82 was big enough to beat the extra-parameter fee.
n=20, and a model achieves R2=0.95 using p=18 features. Compute Radj2. What does it reveal?
Recall Solution
Radj2=1−(1−0.95)20−18−120−1=1−0.05⋅119=1−0.95=0.05.
A dazzling R2=0.95 collapses to Radj2=0.05. With only 20−18−1=1 residual degree of freedom, the model is memorising noise, not learning signal — the adjusted score has stripped away almost all of the apparent fit. This is textbook Overfitting — the adjusted score refuses to be fooled.
A no-intercept model (see the "What intercept means" box above) on data with SStot=500 produces predictions with SSres=650. Compute R2 and interpret.
Recall Solution
R2=1−500650=1−1.3=−0.3.R2 is negative — the model is worse than just predicting the mean (which would score 0). Because the intercept b0 was forced to 0, the line cannot match the data's average level, so SSres (error from predictions) exceeds SStot (error from the flat mean line). Not a bug; a verdict.
Ranking: M2 (0.7367) > M3 (0.7269) > M1 (0.6938).
M3 has the highest raw R2 but its 7 extra features over M2 buy only 0.01 more explained variance — not worth the degrees of freedom. Recommend M2. This is exactly what Feature Selection and Model Selection aim to formalise.
Show algebraically that Radj2=R2−(1−R2)n−p−1p, starting from Radj2=1−(1−R2)n−p−1n−1. Then verify with R2=0.80, n=30, p=3 (matches L3.1's Model A).
Recall Solution
Start:
Radj2=1−(1−R2)n−p−1n−1.
Write n−1=(n−p−1)+p:
n−p−1n−1=n−p−1(n−p−1)+p=1+n−p−1p.
Substitute:
Radj2=1−(1−R2)(1+n−p−1p)=1−(1−R2)−(1−R2)n−p−1p.
Since 1−(1−R2)=R2:
Radj2=R2−(1−R2)n−p−1p.
Check (R2=0.80,n=30,p=3): 0.80−0.20⋅263=0.80−0.20⋅0.115385=0.80−0.023077=0.776923 — matches L3.1's Radj,A2 exactly. The subtracted term is literally the "gap" between R2 and Radj2.
Raw data, two competing fits on the samen=6 points.
y=[3,5,7,9,11,13].
Model A (1 feature) predicts y^A=[3,5,7,9,11,13] — a perfect line.
Model B (3 features) predicts y^B=[3.5,4.5,7,9,10.5,13.5].
(a) Compute R2 and Radj2 for both. (b) Which model wins, and what deeper lesson does the pair teach?
Model A — residuals all 0:
SSres,A=0,RA2=1−700=1.0.Radj,A2=1−(1−1)6−1−16−1=1−0=1.0.
Model B — residuals yi−y^B,i=[−0.5,0.5,0,0,0.5,−0.5]:
SSres,B=0.25+0.25+0+0+0.25+0.25=1.0.RB2=1−701.0=1−0.0142857=0.985714.Radj,B2=1−(1−0.985714)6−3−16−1=1−0.0142857⋅25=1−0.0142857⋅2.5=1−0.0357143=0.964286.
(b) Winner: Model A on every metric (R2=1, Radj2=1). The lesson: Model B used 3 features to do a worse job than Model A's 1 feature. More parameters bought nothing — in fact they slightly increased error. Radj2 makes the waste explicit (0.9643 vs 1.0). Simpler wins when it fits; this is the whole spirit of Model Selection and guards against Overfitting. (See Linear Regression for why a straight generating rule like y=2x+1 is captured exactly by one feature, and Mean Squared Error for the per-point view of these same residuals.)
With n=25 and a genuine R2=0.90 that stays fixed, find the largest integer p for which Radj2 is still positive. (Assume adding features keeps R2 at 0.90 — the pessimistic "useless features" case.)
Recall Solution
Radj2=1−(1−0.90)25−p−124=1−0.10⋅24−p24=1−24−p2.4.
Positivity requires 24−p2.4<1, i.e. 24−p>2.4, i.e. p<21.6. Since p is an integer and we need 24−p>0 (positive residual df), the largest is
p=21.
Check p=21: Radj2=1−32.4=1−0.8=0.2>0. ✔
Check p=22: Radj2=1−22.4=1−1.2=−0.2<0. ✘
So even a strong R2=0.90 turns worthless once you cram in 22 useless features on 25 points — the degrees of freedom run out.