Regression Foundations

Partitioning the Variance of Y

A reading guide for lecture p-02 — how one algebraic trick splits the variance of Y, and why both R2 and the standard error come out of it.

Section one

Key concepts

The formulas and definitions the slides depend on, each stated as a claim.

Key concepts

Inserting the regression line splits every deviation in two.

Take the distance from a point to the mean and add and subtract ŷi:

(yiy)total =  (ŷiy)explained +  (yiŷi)unexplained
  • ŷiy = how far the model moved you off the mean
  • yiŷi = ei = how far it still missed by

Squaring and summing gives three sums of squares.

  • Total SS = (yiy)2
  • Regression SS = (ŷiy)2
  • Error SS = (yiŷi)2
  • TSS = RSS + ESS

Divide any of them by n − 1 and you have a variance. The slides often work with the raw sums because the divisors cancel.

R2 is the explained share of the total.

R2 = RSSTSS = Explained SSTotal SS = 1 − ESSTSS

Note: these slides use RSS = Regression SS and ESS = Error SS. The deck flags this itself — some textbooks use RSS for residual and ESS for explained.

In Venn terms, the overlap between X and Y is the explained part.

  • The circle Y is var(y); the overlap with X is cov(x, y).
  • More overlap = more covariance = stronger correlation = higher R2.
  • cov(x, y) = 0 means the circles do not touch and X explains nothing.

The standard error of the slope is built from the unexplained part.

SSE = ei2     σ2ε = SSEn − 2     SEb1 = σ2ε(xix)2

The same standard error can be written two ways.

Because (xix)2 = (n − 1) · var(x):

SEb1 = sε(n − 1) · var(x) = sε(xix)2

The first form is preferred in the slides because it names its three moving parts out loud:

Standard Error of the Slope  ≈  residualsample size · variance X

Compare the standard error of the mean, which has only two moving parts: SEx = sx / n.

Section two

Key relationships

The mental map. How the pieces connect, and how to read the deck.

The whole lecture is one algebraic trick

Add and subtract ŷi. That is it.

The distance from a data point to the mean is the only thing we had before this lecture. By inserting the fitted value in the middle of that distance, it becomes two distances: the part the model accounts for, and the part it does not. Everything downstream — R2, the standard error, the confidence interval, the p-value — is bookkeeping on those two pieces.

Notice what is not being assumed here. This is an identity, not a modeling choice. Any line drawn through the data would split the deviations this way. What makes the regression line special is that it is the line that makes the unexplained piece as small as possible.

Worth knowing if a student asks why TSS = RSS + ESS holds exactly rather than approximately: when you square the sum of the two pieces, the cross-product term sums to zero, because least squares forces the residuals to be uncorrelated with the fitted values. The slides do not derive this — they present the partition as a given — but that orthogonality is what makes it clean.

Three pictures of the same partition

The deck shows the split three different ways, and the exercise is to be able to move between them:

If you can look at a scatterplot and sketch its bar and its Venn diagram, you have the lecture.

The Venn diagram connects this lecture back to p-01

The overlap region is labelled cov(x, y), and that is not decoration. In p-01 the slope was cov(x, y) / var(x). Here the same covariance is the part of Y that X can account for.

So covariance is doing two jobs at once: it sets the size of the slope and it sets the share of variance explained. When the circles barely overlap you get a small b1 and a small R2 together. When they overlap a lot you get both large. That is why “more correlation” and “better fit” feel like the same thing — in simple regression with one X, they are.

R2 and the standard error read the same split in opposite directions

This is the relationship worth carrying forward. One partition, two consumers:

UsesReports
R2 = RSS/TSS the explained piecehow well the model fits
SEb1 the unexplained piecehow precise the estimate is

They are complements, not competitors: R2 goes up exactly when the residual goes down, which is exactly when the standard error shrinks. A model that explains more of Y produces a tighter estimate of the slope. Fit and precision are two readings of the same number.

This is also the honest answer to “why do we care about R2?” On its own it is a description. What matters is that the other half of the same split is what determines whether your finding is statistically significant.

Where the standard error gets its three levers

Writing the standard error with (n − 1) · var(x) in the denominator makes visible what the compact (xix)2 version hides. Three things, and only three, move it:

Contrast the standard error of the mean, sx/n, which has only the first two. The third lever is new, and it is the one with consequences for research design: how you assign or sample your explanatory variable matters as much as how many cases you collect.

Where this sits in the sequence

p-01 produced the slope out of covariance and variance. This lecture takes the variance of Y apart and finds the standard error inside the leftover piece. p-03 and p-04 take that standard error and turn it into a confidence interval and a significance test. The road map slide near the end is the same one from p-01, and by now three of its four rungs are built.

How to read the slides

SlidesWhat they are doingWhat to take away
1–2Variance recapSquared distances from the mean, divided by n − 1. Nothing new yet.
3–7The partition and R2TSS = RSS + ESS. This is the core.
8, 14One point, close upThe bracket picture. Explained is mean-to-line; unexplained is line-to-point.
9–10The two extremesPerfect fit explains everything; the typical case explains some.
11–12The stacked-bar versionR2 as the orange fraction of the column.
13, 15–17The Venn versionOverlap = cov(x, y) = explained. Note the RSS/ESS footnote on slide 15.
18–21Standard error of the slopeBuilt from the residual; three levers.
22The road mapSame map as p-01. Rung three is now in place.
23The checklistTwo items, both about the split.

The repetition across slides 4, 6, 11, and 12 is not padding — the same diagram is being re-shown with a different annotation layered on each time. Read them as one slide seen four ways.

Section three

What should be clear in my mind?

The two things this deck exists to settle.

  1. We split the variance of Y into explained and unexplained portions with a trick — inserting the regression line ŷ. The distance from a point to the mean becomes the distance from the mean to the line, plus the distance from the line to the point. Square and sum, and TSS = RSS + ESS.
  2. The standard error of the slope is derived from the unexplained portion of Y, the residual. Everything the model failed to explain becomes uncertainty about the slope. Improving fit and tightening your estimate are the same act.

Key takeaways