Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

This appendix collects every named formula from Chapters 1 through 16, in the order each chapter introduces it. Each formula keeps the ALRM notation used throughout the book: YiY_i for a response, XiX_i for a predictor, β0,β1,\beta_0, \beta_1, \dots for population parameters, b0,b1,b_0, b_1, \dots for their least-squares estimates, eie_i for a residual, X\mathbf{X} for the design matrix, and a prime for transpose. One plain-language line under each formula states what it claims, so this page works as a quick lookup during homework and exams rather than a replacement for the chapter’s derivation. For full context, definitions, and worked examples, follow the chapter link in each heading.

A.1 Chapter 1: Regression as a way of thinking

Anatomy of a statistical model

Y=f(X)+εY = f(X) + \varepsilon

Any response splits into a systematic part f(X)f(X) that depends on the predictor and a random part ε\varepsilon that does not.

Simple linear regression function

E{Y}=β0+β1XE\{Y\} = \beta_0 + \beta_1 X

The average response at a given XX falls on a straight line with intercept β0\beta_0 and slope β1\beta_1.

Fitted line (estimates)

Y^=b0+b1X\hat{Y} = b_0 + b_1 X

The fitted line uses sample estimates b0b_0 and b1b_1 in place of the unknown β0\beta_0 and β1\beta_1 to predict a response from XX.

Galton’s fitted height line

child^=22.64+0.637midparent\widehat{\text{child}} = 22.64 + 0.637\,\text{midparent}

A child’s predicted height rises by about 0.637 inch for each extra inch of average parent height, the historical example that gave regression its name.

A.2 Chapter 2: Simple linear regression

SLR model

Yi=β0+β1Xi+εiY_i = \beta_0 + \beta_1 X_i + \varepsilon_i

Each observed response is the true line at XiX_i plus a random error εi\varepsilon_i.

Error assumptions

E{εi}=0, Var{εi}=σ2, Cov{εi,εj}=0E\{\varepsilon_i\}=0,\ \operatorname{Var}\{\varepsilon_i\}=\sigma^2,\ \operatorname{Cov}\{\varepsilon_i,\varepsilon_j\}=0

Errors average to zero, share one variance σ2\sigma^2 across all observations, and do not correlate with each other.

Mean response

E{Y}=β0+β1XE\{Y\} = \beta_0 + \beta_1 X

The population line traces the average of YY at each value of XX.

Least-squares criterion

Q(b0,b1)=i=1n(Yib0b1Xi)2Q(b_0,b_1)=\sum_{i=1}^n (Y_i - b_0 - b_1 X_i)^2

Least squares picks the intercept and slope that make the sum of squared vertical gaps to the data as small as possible.

Deviation sums

Sxx=(XiXˉ)2, Sxy=(XiXˉ)(YiYˉ), Syy=(YiYˉ)2S_{xx}=\sum (X_i-\bar X)^2,\ S_{xy}=\sum (X_i-\bar X)(Y_i-\bar Y),\ S_{yy}=\sum (Y_i-\bar Y)^2

SxxS_{xx} measures spread in XX, SyyS_{yy} measures spread in YY, and SxyS_{xy} measures how XX and YY move together; every least-squares formula below is built from these three numbers.

Normal equations

(Yib0b1Xi)=0,Xi(Yib0b1Xi)=0\sum (Y_i - b_0 - b_1 X_i)=0,\quad \sum X_i (Y_i - b_0 - b_1 X_i)=0

Setting the calculus derivatives of QQ to zero gives two linear equations in b0b_0 and b1b_1 whose solution is the least-squares line.

Slope estimate

b1=Sxy/Sxxb_1 = S_{xy}/S_{xx}

The estimated slope is the covariance of XX and YY scaled by the spread of XX.

Intercept estimate

b0=Yˉb1Xˉb_0 = \bar Y - b_1 \bar X

The estimated intercept forces the fitted line through the point of averages (Xˉ,Yˉ)(\bar X, \bar Y).

Fitted value

Y^i=b0+b1Xi\hat Y_i = b_0 + b_1 X_i

The fitted value is where the estimated line sits above (or below) observation ii’s predictor value.

Residual

ei=YiY^ie_i = Y_i - \hat Y_i

The residual is the vertical gap between an observed response and its fitted value.

Residual identities

ei=0, Xiei=0, Y^iei=0, Y^i=Yi\sum e_i = 0,\ \sum X_i e_i = 0,\ \sum \hat Y_i e_i = 0,\ \sum \hat Y_i = \sum Y_i

The least-squares residuals sum to zero, are uncorrelated with XX and with the fitted values, and preserve the total of YY, four automatic checks on any regression fit.

Error sum of squares

SSE=ei2=Syyb12Sxx\mathrm{SSE}=\sum e_i^2 = S_{yy} - b_1^2 S_{xx}

SSE\mathrm{SSE} totals the squared residuals, the leftover variation the line does not explain.

Error variance estimate

s2=MSE=SSE/(n2)s^2 = \mathrm{MSE} = \mathrm{SSE}/(n-2)

Dividing SSE\mathrm{SSE} by n2n-2, the degrees of freedom left after estimating two parameters, gives an unbiased estimate of the error variance σ2\sigma^2.

Unbiasedness of MSE

E{MSE}=σ2E\{\mathrm{MSE}\} = \sigma^2

On average, across repeated samples, MSE\mathrm{MSE} hits the true error variance exactly.

Mean and variance of b1b_1

E{b1}=β1, Var{b1}=σ2/SxxE\{b_1\}=\beta_1,\ \operatorname{Var}\{b_1\}=\sigma^2/S_{xx}

The slope estimate is unbiased, and it grows less variable as the predictor spreads out more.

Mean and variance of b0b_0

E{b0}=β0, Var{b0}=σ2(1/n+Xˉ2/Sxx)E\{b_0\}=\beta_0,\ \operatorname{Var}\{b_0\}=\sigma^2(1/n + \bar X^2/S_{xx})

The intercept estimate is unbiased, with variance that grows if Xˉ\bar X sits far from zero.

Estimated standard errors

s{b1}=MSE/Sxx, s{b0}=MSE(1/n+Xˉ2/Sxx)s\{b_1\}=\sqrt{\mathrm{MSE}/S_{xx}},\ s\{b_0\}=\sqrt{\mathrm{MSE}(1/n+\bar X^2/S_{xx})}

Replacing σ2\sigma^2 with MSE\mathrm{MSE} in the variance formulas gives the standard errors software reports.

b1b_1 as a linear estimator

b1=kiYi, ki=(XiXˉ)/Sxxb_1=\sum k_i Y_i,\ k_i=(X_i-\bar X)/S_{xx}

The slope estimate is a weighted sum of the responses, which is the fact the Gauss-Markov proof builds on.

Normal likelihood

L=i=1n12πσ2exp ⁣((Yiβ0β1Xi)22σ2)L=\prod_{i=1}^n \frac{1}{\sqrt{2\pi\sigma^2}}\exp\!\left(-\frac{(Y_i-\beta_0-\beta_1 X_i)^2}{2\sigma^2}\right)

Under normal errors, this product measures how plausible a candidate (β0,β1,σ2)(\beta_0, \beta_1, \sigma^2) is given the observed data.

MLE of variance

σ^MLE2=SSE/n\hat\sigma^2_{\text{MLE}} = \mathrm{SSE}/n

Maximizing the likelihood over σ2\sigma^2 gives a variance estimate that divides by nn instead of n2n-2, which is why it is slightly biased low.

A.3 Chapter 3: Inference for simple linear regression

Sampling distribution of b1b_1

b1N(β1,σ2/Sxx)b_1 \sim N(\beta_1, \sigma^2/S_{xx})

Across repeated samples, the slope estimate follows a normal distribution centered at the true slope.

Sampling distribution of b0b_0

b0N(β0,σ2(1/n+Xˉ2/Sxx))b_0 \sim N(\beta_0, \sigma^2(1/n + \bar X^2/S_{xx}))

The intercept estimate is likewise normal and unbiased, with the variance derived in Chapter 2.

tt statistic for the slope

(b1β1)/s{b1}tn2(b_1 - \beta_1)/s\{b_1\} \sim t_{n-2}

Standardizing the slope estimate by its estimated standard error gives a tt distribution with n2n-2 degrees of freedom, the basis for every slope interval and test.

Confidence interval for the slope

b1±t1α/2,n2s{b1}b_1 \pm t_{1-\alpha/2,\,n-2}\, s\{b_1\}

This interval is a range of plausible values for the true slope β1\beta_1, built from the estimate plus or minus a tt multiple of its standard error.

Slope test statistic

t=b1/s{b1}t^{\ast} = b_1/s\{b_1\}

This ratio measures how many standard errors the estimated slope sits from zero, used to test whether XX predicts YY at all.

Estimated standard error of the slope

s{b1}=MSE/Sxxs\{b_1\} = \sqrt{\mathrm{MSE}/S_{xx}}

This is the number software reports next to b1b_1, an estimate of how much the slope would bounce around across repeated samples.

Estimated standard error of the intercept

s{b0}=MSE(1/n+Xˉ2/Sxx)s\{b_0\} = \sqrt{\mathrm{MSE}(1/n + \bar X^2/S_{xx})}

This is the corresponding uncertainty measure for the intercept estimate.

Variance of the fitted mean

s2{Y^h}=MSE(1/n+(XhXˉ)2/Sxx)s^2\{\hat Y_h\} = \mathrm{MSE}(1/n + (X_h - \bar X)^2/S_{xx})

The uncertainty in a fitted mean response grows the farther XhX_h sits from the center of the data.

Confidence interval for a mean response

Y^h±t1α/2,n2s{Y^h}\hat Y_h \pm t_{1-\alpha/2,\,n-2}\, s\{\hat Y_h\}

This interval traps the true average response at XhX_h, not a single new observation.

Variance of a prediction

s2{pred}=MSE(1+1/n+(XhXˉ)2/Sxx)s^2\{\mathrm{pred}\} = \mathrm{MSE}(1 + 1/n + (X_h - \bar X)^2/S_{xx})

Predicting one new observation carries an extra unit of variance beyond estimating the mean, because a single case also carries its own random error.

Prediction interval for a new observation

Y^h±t1α/2,n2s{pred}\hat Y_h \pm t_{1-\alpha/2,\,n-2}\, s\{\mathrm{pred}\}

This wider interval is built to cover one future observation at XhX_h, not the population average.

ANOVA decomposition

SSTO=SSR+SSE\mathrm{SSTO} = \mathrm{SSR} + \mathrm{SSE}

Total variation in YY splits exactly into the part the line explains (SSR\mathrm{SSR}) and the part it leaves over (SSE\mathrm{SSE}).

Mean squares

MSR=SSR/1, MSE=SSE/(n2)\mathrm{MSR} = \mathrm{SSR}/1,\ \mathrm{MSE} = \mathrm{SSE}/(n-2)

Dividing each sum of squares by its degrees of freedom converts it into an average squared contribution, ready to compare in an FF ratio.

Regression sum of squares

SSR=(Y^iYˉ)2=b12Sxx\mathrm{SSR} = \sum (\hat Y_i - \bar Y)^2 = b_1^2 S_{xx}

SSR\mathrm{SSR} measures how far the fitted values swing away from the overall mean, the credit the line earns for tracking YY.

Expected mean squares

E{MSE}=σ2, E{MSR}=σ2+β12SxxE\{\mathrm{MSE}\} = \sigma^2,\ E\{\mathrm{MSR}\} = \sigma^2 + \beta_1^2 S_{xx}

MSR\mathrm{MSR} only exceeds MSE\mathrm{MSE} on average when the true slope is nonzero, which is the logic behind the FF test.

FF test statistic

F=MSR/MSEF1,n2F^{\ast} = \mathrm{MSR}/\mathrm{MSE} \sim F_{1,\,n-2}

A large ratio of explained to unexplained variance is evidence against the null hypothesis that β1=0\beta_1 = 0.

FF equals tt squared

F=(t)2F^{\ast} = (t^{\ast})^2

In simple regression the FF test for the slope and the two-sided tt test for the slope are the same test written two ways.

Coefficient of determination

R2=SSR/SSTO=1SSE/SSTOR^2 = \mathrm{SSR}/\mathrm{SSTO} = 1 - \mathrm{SSE}/\mathrm{SSTO}

R2R^2 is the proportion of total variation in YY that the line explains, between 0 and 1.

RR-squared equals rr-squared

R2=r2, r=Sxy/SxxSyyR^2 = r^2,\ r = S_{xy}/\sqrt{S_{xx}S_{yy}}

In simple regression, the coefficient of determination is exactly the squared Pearson correlation between XX and YY.

Working-Hotelling band

Y^h±Ws{Y^h}, W2=2F1α;2,n2\hat Y_h \pm W\, s\{\hat Y_h\},\ W^2 = 2 F_{1-\alpha;\,2,\,n-2}

This band covers the whole regression line at every XhX_h simultaneously, wider at each single point than the pointwise confidence interval.

A.4 Chapter 4: Correlation

Sample covariance

sxy=Sxy/(n1)=1n1(XiXˉ)(YiYˉ)s_{xy} = S_{xy}/(n-1) = \frac{1}{n-1}\sum (X_i-\bar X)(Y_i-\bar Y)

Covariance measures the average product of how far XX and YY each stray from their own means, positive when they tend to rise together.

Pearson correlation

r=sxysxsy=SxySxxSyyr = \frac{s_{xy}}{s_x s_y} = \frac{S_{xy}}{\sqrt{S_{xx} S_{yy}}}

Correlation rescales covariance by both standard deviations so the result never depends on the units of XX or YY.

Bounds of rr

1r1-1 \le r \le 1

Correlation always lands between perfect negative and perfect positive linear association.

Correlation and slope

b1=rsysx,r=b1sxsyb_1 = r\,\frac{s_y}{s_x}, \qquad r = b_1\,\frac{s_x}{s_y}

The regression slope and the correlation carry the same sign and convert into each other once you rescale by the ratio of standard deviations.

Determination equals rr squared

R2=SSR/SSTO=r2R^2 = \mathrm{SSR}/\mathrm{SSTO} = r^2

Squaring the correlation gives the share of variation the line explains.

Product of the two regression slopes

b1b1=r2,b1=Sxy/Syyb_1 \cdot b_1' = r^2, \quad b_1' = S_{xy}/S_{yy}

Regressing YY on XX and regressing XX on YY give two different lines whose slopes multiply to r2r^2, a reminder that “the” regression line depends on which variable you predict.

Correlation tt test

t=rn21r2tn2 under H0:ρ=0t^{\ast} = \frac{r\sqrt{n-2}}{\sqrt{1-r^2}} \sim t_{n-2}\ \text{under } H_0:\rho=0

This statistic tests whether the true correlation ρ\rho is zero, and it equals the slope’s tt test exactly.

Fisher zz transformation

z=arctanh(r)=12ln1+r1rN ⁣(arctanhρ, 1n3)z = \operatorname{arctanh}(r) = \tfrac12\ln\frac{1+r}{1-r} \approx N\!\left(\operatorname{arctanh}\rho,\ \tfrac{1}{n-3}\right)

This transform straightens out rr’s skewed sampling distribution into an approximately normal one, which makes confidence intervals for ρ\rho possible.

Confidence interval for ρ\rho

tanh ⁣(arctanh(r)±z1α/2/n3)\tanh\!\left(\operatorname{arctanh}(r) \pm z_{1-\alpha/2}/\sqrt{n-3}\right)

Build the interval on the zz scale, then transform both endpoints back to the correlation scale.

Variance of rr (large sample)

Var(r)(1ρ2)2/n\operatorname{Var}(r) \approx (1-\rho^2)^2/n

Correlation estimates get more precise with more data and, for a fixed nn, are least variable when the true correlation is near zero.

Bivariate normal density

f(x,y)=12πσXσY1ρ2exp ⁣(12(1ρ2)[(xμX)2σX22ρ(xμX)(yμY)σXσY+(yμY)2σY2])f(x,y) = \frac{1}{2\pi\sigma_X\sigma_Y\sqrt{1-\rho^2}}\exp\!\left(-\frac{1}{2(1-\rho^2)}\left[\frac{(x-\mu_X)^2}{\sigma_X^2} - \frac{2\rho(x-\mu_X)(y-\mu_Y)}{\sigma_X\sigma_Y} + \frac{(y-\mu_Y)^2}{\sigma_Y^2}\right]\right)

This surface describes two jointly normal variables at once; its five parameters are the two means, two standard deviations, and the correlation ρ\rho.

Bivariate normal conditional mean

E{YX=x}=μY+ρσYσX(xμX)E\{Y \mid X=x\} = \mu_Y + \rho\,\frac{\sigma_Y}{\sigma_X}(x-\mu_X)

Under bivariate normality, the average of YY given X=xX = x is exactly a straight line in xx, which is why simple linear regression is the natural model here.

Bivariate normal conditional variance

Var{YX=x}=σY2(1ρ2)\operatorname{Var}\{Y \mid X=x\} = \sigma_Y^2(1-\rho^2)

Knowing XX shrinks the spread of YY by a factor of 1ρ21-\rho^2, the same factor that shows up as 1R21 - R^2 in regression.

Spearman rank correlation

rS=Pearson correlation of rank(Xi), rank(Yi)r_S = \text{Pearson correlation of } \operatorname{rank}(X_i),\ \operatorname{rank}(Y_i)

Replacing each value with its rank before computing Pearson’s rr gives a correlation that detects any monotone relationship, not only a straight-line one.

A.5 Chapter 5: Randomization and bootstrap inference for regression

Slope estimate

b1=(XiXˉ)(YiYˉ)(XiXˉ)2=Sxy/Sxxb_1 = \frac{\sum (X_i-\bar X)(Y_i-\bar Y)}{\sum (X_i-\bar X)^2} = S_{xy}/S_{xx}

The same least-squares slope from Chapter 2 is the statistic this chapter re-derives its uncertainty for, without assuming normal errors.

No-association null

H0:X and Y unrelated (β1=0)H_0: X \text{ and } Y \text{ unrelated } (\beta_1 = 0)

The permutation test’s null hypothesis is that the pairing between XiX_i and YiY_i carries no information, so shuffling one against the other should not matter.

Permuted slope

b1π=(XiXˉ)(Yπ(i)Yˉ)/Sxx=Sxyπ/Sxxb_1^{\pi} = \sum (X_i-\bar X)(Y_{\pi(i)}-\bar Y)/S_{xx} = S_{xy}^{\pi}/S_{xx}

Recomputing the slope after randomly reshuffling the YY values against the XX values gives one draw from the null distribution.

Exact permutation pp-value

pexact=#{π:b1πb1}/n!p_{\text{exact}} = \#\{\pi : |b_1^{\pi}| \ge |b_1|\}/n!

The exact pp-value is the fraction of all possible shuffles that produce a slope as extreme as the one actually observed.

Monte Carlo permutation pp-value

pperm=(M+1)/(B+1)p_{\text{perm}} = (M+1)/(B+1)

Since checking all n!n! shuffles is usually impossible, this estimate uses BB random shuffles, with MM of them at least as extreme as the observed slope.

Permutation resolution floor

minpperm=1/(B+1)\min p_{\text{perm}} = 1/(B+1)

With only BB permutations, the smallest reportable pp-value is 1/(B+1)1/(B+1), so a very small true pp-value needs many permutations to resolve.

Case-resampling bootstrap slope

b1b=Sxy/Sxx from n rows drawn with replacementb_1^{\ast b} = S_{xy}^{\ast}/S_{xx}^{\ast} \text{ from } n \text{ rows drawn with replacement}

Each bootstrap replicate refits the slope on a resample of whole (Xi,Yi)(X_i, Y_i) pairs drawn with replacement from the original data.

Residual-resampling bootstrap

Yi=Y^i+es(i),Y^i=b0+b1Xi,ei=YiY^iY_i^{\ast} = \hat Y_i + e_{s(i)}^{\ast}, \quad \hat Y_i = b_0 + b_1 X_i, \quad e_i = Y_i - \hat Y_i

This alternative bootstrap keeps the XX values fixed and builds new responses by adding randomly resampled residuals to the fitted line.

Bootstrap standard error

sboot{b1}=1B1b=1B(b1bbˉ1)2s_{\text{boot}}\{b_1\} = \sqrt{\tfrac{1}{B-1}\sum_{b=1}^{B}(b_1^{\ast b} - \bar b_1^{\ast})^2}

The spread of the bootstrap slope estimates across replicates estimates the standard error of b1b_1 without any normal-error formula.

Percentile interval

(qα/2, q1α/2)(q_{\alpha/2},\ q_{1-\alpha/2})

This interval simply reads off the lower and upper quantiles of the bootstrap distribution of b1b_1^{\ast}.

Basic (reflection) interval

(2b1q1α/2, 2b1qα/2)(2 b_1 - q_{1-\alpha/2},\ 2 b_1 - q_{\alpha/2})

This interval reflects the bootstrap quantiles around the original estimate, which corrects for skew that the plain percentile interval can miss.

Classical tt interval for slope

b1±t0.975,n2s{b1}b_1 \pm t^{\ast}_{0.975,\,n-2}\, s\{b_1\}

The Chapter 3 formula reappears here as the benchmark the permutation and bootstrap intervals are compared against.

A.6 Chapter 6: Matrix algebra for regression

Model in matrix form

Y=Xβ+ε\mathbf{Y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\varepsilon}

Stacking every observation into vectors and matrices writes the whole regression model, with any number of predictors, in one equation.

Design matrix dimensions

Y (n×1), X (n×p), β (p×1)\mathbf{Y}\ (n\times 1),\ \mathbf{X}\ (n\times p),\ \boldsymbol{\beta}\ (p\times 1)

X\mathbf{X} has one row per observation and one column per parameter, including a column of ones for the intercept, so pp counts parameters and nn counts observations.

Matrix product entry

(AB)ij=AiBj(\mathbf{A}\mathbf{B})_{ij} = \sum_{\ell} A_{i\ell} B_{\ell j}

Each entry of a matrix product is the dot product of a row of A\mathbf{A} with a column of B\mathbf{B}.

Transpose of a product

(AB)=BA(\mathbf{A}\mathbf{B})' = \mathbf{B}'\mathbf{A}'

Transposing a product reverses the order of the factors.

Cross-product matrix

(XX)jk=iXijXik(\mathbf{X}'\mathbf{X})_{jk} = \sum_i X_{ij} X_{ik}

Each entry of XX\mathbf{X}'\mathbf{X} is a sum of products between two columns of X\mathbf{X}, summarizing how the predictors relate to each other and to themselves.

Cross-product vector

(XY)j=iXijYi(\mathbf{X}'\mathbf{Y})_j = \sum_i X_{ij} Y_i

This vector summarizes how each predictor column relates to the response.

Symmetry of XX\mathbf{X}'\mathbf{X}

(XX)=XX(\mathbf{X}'\mathbf{X})' = \mathbf{X}'\mathbf{X}

The cross-product matrix always equals its own transpose, a fact the least-squares derivation relies on.

2x2 determinant and inverse

det(abcd)=adbc,(abcd)1=1adbc(dbca)\det\begin{pmatrix} a & b \\ c & d \end{pmatrix} = ad - bc,\quad \begin{pmatrix} a & b \\ c & d \end{pmatrix}^{-1} = \frac{1}{ad-bc}\begin{pmatrix} d & -b \\ -c & a \end{pmatrix}

For a two-by-two matrix, the determinant adbcad - bc tells you whether an inverse exists, and this formula hand-computes it when it does.

Matrix normal equations

XXb=XY\mathbf{X}'\mathbf{X}\,\mathbf{b} = \mathbf{X}'\mathbf{Y}

The two-equation normal equations from Chapter 2 collapse into this single matrix equation that works for any number of predictors.

Least-squares estimator

b=(XX)1XY\mathbf{b} = (\mathbf{X}'\mathbf{X})^{-1}\mathbf{X}'\mathbf{Y}

Inverting XX\mathbf{X}'\mathbf{X} and multiplying by XY\mathbf{X}'\mathbf{Y} solves the normal equations in one step, giving every least-squares coefficient at once.

Hat matrix

H=X(XX)1X\mathbf{H} = \mathbf{X}(\mathbf{X}'\mathbf{X})^{-1}\mathbf{X}'

H\mathbf{H} is the matrix that turns the observed responses directly into fitted values, “putting a hat on” Y\mathbf{Y}.

Fitted values and residuals

Y^=HY,e=(IH)Y\widehat{\mathbf{Y}} = \mathbf{H}\mathbf{Y},\quad \mathbf{e} = (\mathbf{I}-\mathbf{H})\mathbf{Y}

The hat matrix produces the fitted values directly, and what remains after subtracting them from Y\mathbf{Y} is the residual vector.

Idempotency of H\mathbf{H}

HH=H,tr(H)=p\mathbf{H}\mathbf{H} = \mathbf{H},\quad \operatorname{tr}(\mathbf{H}) = p

Applying the hat matrix twice does nothing more than applying it once, and its diagonal entries sum to pp, the number of parameters.

SSE as a quadratic form

SSE=Y(IH)Y=ee\mathrm{SSE} = \mathbf{Y}'(\mathbf{I}-\mathbf{H})\mathbf{Y} = \mathbf{e}'\mathbf{e}

The error sum of squares can be written directly as a quadratic form in Y\mathbf{Y}, or equivalently as the squared length of the residual vector.

SS decomposition (matrix)

(IH)+(H1nJ)=I1nJ(\mathbf{I}-\mathbf{H}) + (\mathbf{H}-\tfrac{1}{n}\mathbf{J}) = \mathbf{I}-\tfrac{1}{n}\mathbf{J}

This matrix identity is the geometric version of SSTO=SSR+SSE\mathrm{SSTO} = \mathrm{SSR} + \mathrm{SSE}: three projection matrices that add up exactly.

Variance estimate

MSE=SSE/(np)\mathrm{MSE} = \mathrm{SSE}/(n-p)

With pp parameters instead of two, the error variance estimate now divides by npn-p degrees of freedom.

Expectation of a linear map

E{AW+c}=AE{W}+cE\{\mathbf{A}\mathbf{W}+\mathbf{c}\} = \mathbf{A}E\{\mathbf{W}\}+\mathbf{c}

Expectation passes through a fixed matrix and a fixed vector added afterward, the matrix analogue of E{aW+c}=aE{W}+cE\{aW + c\} = aE\{W\} + c.

Covariance of a linear map

Cov{AW}=ACov{W}A\operatorname{Cov}\{\mathbf{A}\mathbf{W}\} = \mathbf{A}\operatorname{Cov}\{\mathbf{W}\}\mathbf{A}'

Transforming a random vector by a fixed matrix sandwiches the original covariance matrix between that matrix and its transpose.

Unbiasedness of b\mathbf{b}

E{b}=βE\{\mathbf{b}\} = \boldsymbol{\beta}

On average, the least-squares coefficient vector recovers the true parameter vector exactly.

Covariance of b\mathbf{b}

Cov{b}=σ2(XX)1\operatorname{Cov}\{\mathbf{b}\} = \sigma^2 (\mathbf{X}'\mathbf{X})^{-1}

This matrix holds the variance of every coefficient on its diagonal and the covariance between pairs of coefficients off the diagonal.

Estimated covariance of b\mathbf{b}

s2{b}=MSE(XX)1s^2\{\mathbf{b}\} = \mathrm{MSE}\,(\mathbf{X}'\mathbf{X})^{-1}

Substituting MSE\mathrm{MSE} for σ2\sigma^2 gives the covariance matrix software actually reports.

Sampling law of b\mathbf{b}

bN(β, σ2(XX)1)\mathbf{b} \sim N(\boldsymbol{\beta},\ \sigma^2(\mathbf{X}'\mathbf{X})^{-1})

Under normal errors, the whole coefficient vector follows a multivariate normal distribution centered at the truth.

Multivariate normal of Y\mathbf{Y}

YN(Xβ, σ2I)\mathbf{Y} \sim N(\mathbf{X}\boldsymbol{\beta},\ \sigma^2\mathbf{I})

The response vector itself is multivariate normal, with mean given by the regression surface and independent equal-variance errors.

A.7 Chapter 7: The general linear model

General linear model

Y=Xβ+ε\mathbf{Y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\varepsilon}

The same matrix model from Chapter 6 is now the standing model for every remaining chapter, covering any number and kind of predictor.

Error moments

E{ε}=0, Cov{ε}=σ2IE\{\boldsymbol{\varepsilon}\} = \mathbf{0},\ \operatorname{Cov}\{\boldsymbol{\varepsilon}\} = \sigma^2 \mathbf{I}

Errors average to zero, share one variance, and do not correlate with each other, the matrix form of the Chapter 2 assumptions.

Sum of squares objective

Q(b)=(YXb)(YXb)Q(\mathbf{b}) = (\mathbf{Y} - \mathbf{X}\mathbf{b})'(\mathbf{Y} - \mathbf{X}\mathbf{b})

This is the squared length of the residual vector, the quantity least squares minimizes over b\mathbf{b}.

Normal equations

XXb=XY\mathbf{X}'\mathbf{X}\mathbf{b} = \mathbf{X}'\mathbf{Y}

Setting the gradient of Q(b)Q(\mathbf{b}) to zero gives this equation, whose solution is the least-squares estimate.

Least-squares estimator

b=(XX)1XY\mathbf{b} = (\mathbf{X}'\mathbf{X})^{-1}\mathbf{X}'\mathbf{Y}

This is the same closed-form solution from Chapter 6, now the working formula for every model in the rest of the book.

Orthogonality of residual

Xe=0\mathbf{X}'\mathbf{e} = \mathbf{0}

The residual vector is perpendicular to every column of X\mathbf{X}, the algebraic reason the residuals are uncorrelated with each predictor.

Hat matrix

H=X(XX)1X\mathbf{H} = \mathbf{X}(\mathbf{X}'\mathbf{X})^{-1}\mathbf{X}'

H\mathbf{H} projects the response vector onto the column space of X\mathbf{X}, the geometric meaning behind “fitting” a regression.

Fitted values

Y^=HY\hat{\mathbf{Y}} = \mathbf{H}\mathbf{Y}

Applying the hat matrix to the data produces the fitted values, the closest point to Y\mathbf{Y} that the model can reach.

Residual vector

e=(IH)Y\mathbf{e} = (\mathbf{I} - \mathbf{H})\mathbf{Y}

The residuals are what is left of Y\mathbf{Y} after removing the part the model can explain.

Hat matrix trace

tr(H)=p, tr(IH)=np\operatorname{tr}(\mathbf{H}) = p,\ \operatorname{tr}(\mathbf{I} - \mathbf{H}) = n - p

The hat matrix’s diagonal sums to pp, the number of fitted parameters, which leaves npn-p degrees of freedom for estimating error.

Mean of b\mathbf{b}

E{b}=βE\{\mathbf{b}\} = \boldsymbol{\beta}

Least squares is unbiased for any design matrix X\mathbf{X} of full column rank.

Covariance of b\mathbf{b}

Cov{b}=σ2(XX)1\operatorname{Cov}\{\mathbf{b}\} = \sigma^2 (\mathbf{X}'\mathbf{X})^{-1}

This is the general-model version of the coefficient covariance matrix, used to build every standard error, confidence interval, and test in multiple regression.

Sampling distribution of b\mathbf{b}

bN(β, σ2(XX)1)\mathbf{b} \sim N(\boldsymbol{\beta},\ \sigma^2 (\mathbf{X}'\mathbf{X})^{-1})

Under normal errors, the coefficient vector is exactly multivariate normal, which underlies every tt and FF procedure in multiple regression.

Error sum of squares

SSE=ee=Y(IH)Y\mathrm{SSE} = \mathbf{e}'\mathbf{e} = \mathbf{Y}'(\mathbf{I} - \mathbf{H})\mathbf{Y}

SSE\mathrm{SSE} is the squared length of the residual vector, written two equivalent ways.

Error variance estimator

s2=MSE=SSE/(np)s^2 = \mathrm{MSE} = \mathrm{SSE}/(n - p)

Dividing SSE\mathrm{SSE} by npn-p gives an unbiased estimate of σ2\sigma^2 for a model with pp parameters.

Unbiasedness of MSE

E{SSE}=(np)σ2E\{\mathrm{SSE}\} = (n - p)\sigma^2

This expectation is the algebraic reason dividing by npn-p, not nn, makes MSE\mathrm{MSE} unbiased.

Quadratic form expectation

E{YAY}=tr(AΣ)+μAμE\{\mathbf{Y}'\mathbf{A}\mathbf{Y}\} = \operatorname{tr}(\mathbf{A}\boldsymbol{\Sigma}) + \boldsymbol{\mu}'\mathbf{A}\boldsymbol{\mu}

This general tool computes the expected value of any quadratic form in a random vector, the technique behind proving E{SSE}=(np)σ2E\{\mathrm{SSE}\} = (n-p)\sigma^2.

Estimated covariance of b\mathbf{b}

s2{b}=MSE(XX)1s^2\{\mathbf{b}\} = \mathrm{MSE}\,(\mathbf{X}'\mathbf{X})^{-1}

Every coefficient’s standard error, in R’s or Python’s regression output, is the square root of a diagonal entry of this matrix.

Coefficient of determination

R2=1SSE/SSTOR^2 = 1 - \mathrm{SSE}/\mathrm{SSTO}

R2R^2 still measures the proportion of total variation explained, now for a model with any number of predictors.

A.8 Chapter 8: Multiple regression in practice

Multiple linear regression model

Yi=β0+β1Xi1++βp1Xi,p1+εiY_i = \beta_0 + \beta_1 X_{i1} + \cdots + \beta_{p-1} X_{i,p-1} + \varepsilon_i

Each response depends on several predictors at once, with p1p-1 slopes and one intercept, for pp parameters total.

Partial slope (least squares)

b=(XX)1XY\mathbf{b} = (\mathbf{X}'\mathbf{X})^{-1}\mathbf{X}'\mathbf{Y}

Each entry of b\mathbf{b} is a partial slope: the effect of one predictor holding the others in the model fixed.

Error variance estimate

MSE=SSE/(np)\mathrm{MSE} = \mathrm{SSE}/(n-p)

This is the multiple-regression version of the error variance estimate from Chapter 7, with pp counting every predictor plus the intercept.

Extra sum of squares

SSR(X2X1)=SSE(X1)SSE(X1,X2)=SSR(X1,X2)SSR(X1)\mathrm{SSR}(X_2 \mid X_1) = \mathrm{SSE}(X_1) - \mathrm{SSE}(X_1, X_2) = \mathrm{SSR}(X_1,X_2) - \mathrm{SSR}(X_1)

This measures how much extra variation X2X_2 explains once X1X_1 is already in the model.

Sequential decomposition of SSR

SSR(X1,X2,X3)=SSR(X1)+SSR(X2X1)+SSR(X3X1,X2)\mathrm{SSR}(X_1,X_2,X_3) = \mathrm{SSR}(X_1) + \mathrm{SSR}(X_2\mid X_1) + \mathrm{SSR}(X_3\mid X_1,X_2)

The total explained variation splits into a chain of extra contributions, one predictor added at a time in a chosen order.

General linear test statistic

F=[SSE(R)SSE(F)]/(dfRdfF)SSE(F)/dfFF^{*} = \frac{[\mathrm{SSE}(R) - \mathrm{SSE}(F)]/(df_R - df_F)}{\mathrm{SSE}(F)/df_F}

Comparing a reduced model RR against a full model FF, this ratio tests whether the extra predictors in FF improve the fit by more than chance.

Pythagoras for nested models

SSE(R)=SSE(F)+Y^FY^R2\mathrm{SSE}(R) = \mathrm{SSE}(F) + \lVert \widehat{\mathbf{Y}}_F - \widehat{\mathbf{Y}}_R\rVert^2

The reduced model’s error splits into the full model’s error plus a right-angle piece measuring the extra distance the bigger model’s fit travels.

One-coefficient test equals tt squared

F=bk2/s2{bk}=tk2F^{*} = b_k^2 / s^2\{b_k\} = t_k^2

Testing one coefficient with the general linear test gives the same answer as the usual tt test, squared.

Added-variable slope equals coefficient

slope of eY on eX=bk\text{slope of } e_Y \text{ on } e_X = b_k

Regressing the residuals of YY against the residuals of XkX_k, after removing every other predictor from both, recovers XkX_k’s own coefficient bkb_k.

Coefficient of determination

R2=1SSE/SSTOR^2 = 1 - \mathrm{SSE}/\mathrm{SSTO}

R2R^2 measures the share of total variation the full set of predictors explains together.

Adjusted RR squared

Ra2=1n1np(1R2)R^2_a = 1 - \frac{n-1}{n-p}(1 - R^2)

This version penalizes adding predictors that do not pull their weight, so it can fall even when plain R2R^2 rises.

Standardized coefficient

bk=bk(sXk/sY)b_k^{*} = b_k\,(s_{X_k}/s_Y)

Rescaling a coefficient by the ratio of standard deviations puts predictors measured in different units on a common scale for comparing their impact.

A.9 Chapter 9: Model diagnostics

Hat matrix

H=X(XX)1X\mathbf{H} = \mathbf{X}(\mathbf{X}'\mathbf{X})^{-1}\mathbf{X}'

The same projection matrix from Chapter 7 now supplies the diagonal entries that flag unusual predictor values.

Leverage value

hii=xi(XX)1xih_{ii} = \mathbf{x}_i'(\mathbf{X}'\mathbf{X})^{-1}\mathbf{x}_i

An observation’s leverage value measures how far its predictor values sit from the center of the predictor space, and how much pull it has on its own fitted value.

Leverage value bounds and sum

0hii1,ihii=tr(H)=p0 \le h_{ii} \le 1,\quad \sum_i h_{ii} = \operatorname{tr}(\mathbf{H}) = p

Every leverage value falls between zero and one, and the leverage values across all observations always add up to the number of parameters.

Leverage value in simple regression

hii=1n+(XiXˉ)2Sxxh_{ii} = \frac{1}{n} + \frac{(X_i-\bar X)^2}{S_{xx}}

In simple regression, the leverage value grows with squared distance from Xˉ\bar X, confirming that points far from the center of XX carry more influence.

Leverage value cutoff

hii>2p/nh_{ii} > 2p/n

This rule flags an observation as a high-leverage point when its leverage value exceeds twice the average leverage value of p/np/n.

Residual covariance

Var{e}=σ2(IH), Var{ei}=σ2(1hii)\operatorname{Var}\{\mathbf{e}\} = \sigma^2(\mathbf{I}-\mathbf{H}),\ \operatorname{Var}\{e_i\}=\sigma^2(1-h_{ii})

Residuals do not all share the same variance; high-leverage points have smaller residual variance because the fit is pulled closer to them.

Semistudentized residual

ei/se_i/s

Dividing a residual by the overall residual standard deviation gives a rough check for outliers that ignores the varying leverage values across observations.

Standardized residual

ri=ei/(s1hii)r_i = e_i/(s\sqrt{1-h_{ii}})

This version corrects for each observation’s own leverage value, giving residuals that are more directly comparable across the dataset.

Studentized deleted residual

ti=ei/(s(i)1hii)t(np1)t_i = e_i/(s_{(i)}\sqrt{1-h_{ii}}) \sim t(n-p-1)

This residual refits the model without observation ii before standardizing it, which gives an exact tt distribution for flagging outliers.

Deleted variance identity

(np1)s(i)2=(np)MSEei2/(1hii)(n-p-1)s_{(i)}^2 = (n-p)\mathrm{MSE} - e_i^2/(1-h_{ii})

This shortcut computes the error variance from the model with observation ii removed, without actually refitting.

Deleted residual

di=ei/(1hii), Var{di}=σ2/(1hii)d_i = e_i/(1-h_{ii}),\ \operatorname{Var}\{d_i\}=\sigma^2/(1-h_{ii})

This is the gap between observation ii’s response and the prediction a model trained without it would make.

Bonferroni outlier cutoff

ti>t(1α/(2n);np1)|t_i| > t(1-\alpha/(2n);\, n-p-1)

Testing every observation for being an outlier at once inflates the false-positive rate, so this cutoff tightens the threshold by a factor of nn to compensate.

Leave-one-out coefficient update

bb(i)=(XX)1xiei/(1hii)\mathbf{b}-\mathbf{b}_{(i)} = (\mathbf{X}'\mathbf{X})^{-1}\mathbf{x}_i e_i/(1-h_{ii})

This formula gives the exact shift in every coefficient caused by removing one observation, without refitting the model.

Sherman-Morrison downdate

(Auu)1=A1+A1uuA11uA1u(\mathbf{A}-\mathbf{u}\mathbf{u}')^{-1} = \mathbf{A}^{-1} + \frac{\mathbf{A}^{-1}\mathbf{u}\mathbf{u}'\mathbf{A}^{-1}}{1-\mathbf{u}'\mathbf{A}^{-1}\mathbf{u}}

This linear algebra identity updates a matrix inverse after removing one row, the engine behind every leave-one-out formula in this chapter.

Cook’s distance

Di=j(Y^jY^j(i))2pMSE=ri2phii1hiiD_i = \frac{\sum_j(\hat Y_j-\hat Y_{j(i)})^2}{p\,\mathrm{MSE}} = \frac{r_i^2}{p}\cdot\frac{h_{ii}}{1-h_{ii}}

Cook’s distance combines how large a residual is with how large its leverage value is, into a single number measuring an observation’s overall influence on all the fitted values.

DFFITS

DFFITSi=tihii/(1hii)\mathrm{DFFITS}_i = t_i\sqrt{h_{ii}/(1-h_{ii})}

This measures how many standard errors observation ii’s own fitted value shifts when that observation is removed.

DFBETAS

DFBETASk(i)=(bkbk(i))/(s(i)(XX)kk1)\mathrm{DFBETAS}_{k(i)} = (b_k - b_{k(i)})/(s_{(i)}\sqrt{(\mathbf{X}'\mathbf{X})^{-1}_{kk}})

This measures how many standard errors one specific coefficient shifts when observation ii is removed, pinpointing which parameter a case influences most.

Durbin-Watson statistic

D=t=2n(etet1)2t=1net22(1ρ^)D = \frac{\sum_{t=2}^n (e_t-e_{t-1})^2}{\sum_{t=1}^n e_t^2} \approx 2(1-\hat\rho)

This statistic compares consecutive residuals to detect leftover autocorrelation, with values near 2 indicating none.

Lack-of-fit decomposition

SSE=SSPE+SSLF\mathrm{SSE} = \mathrm{SSPE} + \mathrm{SSLF}

When some predictor values repeat, the error sum of squares splits into pure error, unavoidable scatter at repeated XX’s, and lack of fit, systematic bias from a wrong functional form.

Pure error sum of squares

SSPE=j=1ck(YjkYˉj)2\mathrm{SSPE} = \sum_{j=1}^c \sum_k (Y_{jk}-\bar Y_j)^2

This totals the scatter of responses around their own group mean at each repeated predictor value, variation no model could ever explain.

Lack-of-fit sum of squares

SSLF=j=1cnj(YˉjY^j)2\mathrm{SSLF} = \sum_{j=1}^c n_j(\bar Y_j - \hat Y_j)^2

This totals the gap between each group’s actual mean response and what the fitted line predicts there, the part attributable to a wrong model shape.

Lack-of-fit FF test

F=SSLF/(c2)SSPE/(nc)F(c2,nc)F^\ast = \frac{\mathrm{SSLF}/(c-2)}{\mathrm{SSPE}/(n-c)} \sim F(c-2,\,n-c)

A large ratio here is evidence that the straight-line model misses real curvature or structure in the data.

A.10 Chapter 10: Remedial measures and transformations

Log-log model

logYi=β0+β1logXi+εi\log Y_i = \beta_0 + \beta_1 \log X_i + \varepsilon_i

Taking logs of both variables fits a model where the relationship is a straight line on the log scale, appropriate for multiplicative, curved relationships.

Log-linear model

logYi=β0+β1Xi+εi\log Y_i = \beta_0 + \beta_1 X_i + \varepsilon_i

Taking a log of only the response fits exponential growth or decay in the original units.

Log-log exact factor

XcX  Ycβ1YX \to cX \ \Rightarrow\ Y \to c^{\beta_1} Y

Multiplying XX by a constant multiplies the predicted YY by that constant raised to the power β1\beta_1, the defining property of a log-log model.

Log-log elasticity (approx)

percent change in Yβ1×(percent change in X)\text{percent change in } Y \approx \beta_1 \times (\text{percent change in } X)

The slope in a log-log model is approximately the percent change in YY per one percent change in XX, an elasticity.

Log-linear exact factor

XX+1  Yeβ1Y, percent=100(eβ11)X \to X+1 \ \Rightarrow\ Y \to e^{\beta_1} Y,\ \text{percent} = 100(e^{\beta_1}-1)

Adding one unit to XX multiplies predicted YY by eβ1e^{\beta_1}, which converts to a percent change.

Box-Cox family

Y(λ)=(Yλ1)/λ (λ0), logY (λ=0)Y^{(\lambda)} = (Y^{\lambda}-1)/\lambda \ (\lambda \neq 0),\ \log Y \ (\lambda = 0)

This one family of transformations includes the raw scale (λ=1\lambda=1), the log scale (λ=0\lambda=0), and everything between, so the data can pick the best power.

Box-Cox full log-likelihood

=n2log(2πσ2)12σ2(Yi(λ)xiβ)2+(λ1)logYi\ell = -\tfrac{n}{2}\log(2\pi\sigma^2) - \tfrac{1}{2\sigma^2}\sum (Y_i^{(\lambda)} - \mathbf{x}_i'\boldsymbol{\beta})^2 + (\lambda-1)\sum \log Y_i

This likelihood scores how well a given transformation power λ\lambda makes the transformed data fit a normal-errors regression.

Box-Cox profile log-likelihood

p(λ)=n2log(RSS(λ)/n)+(λ1)i=1nlogYi\ell_p(\lambda) = -\tfrac{n}{2}\log(\mathrm{RSS}(\lambda)/n) + (\lambda-1)\sum_{i=1}^n \log Y_i

Maximizing over β\beta and σ2\sigma^2 for each λ\lambda leaves this profile, which is scanned over λ\lambda to find the best transformation.

Box-Cox confidence interval

{λ:p(λ)p(λ^)12χ1,1α2}\{\lambda : \ell_p(\lambda) \ge \ell_p(\hat\lambda) - \tfrac{1}{2}\chi^2_{1,1-\alpha}\}

Every λ\lambda whose profile likelihood stays within this cutoff of the maximum is a plausible transformation, not just the single best one.

WLS variance model

Var{εi}=σ2/wi, Cov{εi,εj}=0\operatorname{Var}\{\varepsilon_i\} = \sigma^2 / w_i,\ \operatorname{Cov}\{\varepsilon_i,\varepsilon_j\}=0

When error variance differs across observations but a known weight wiw_i tracks it, this model replaces the constant-variance assumption of ordinary least squares.

Weighted least squares criterion

Qw(β)=i=1nwi(Yixiβ)2Q_w(\boldsymbol{\beta}) = \sum_{i=1}^n w_i (Y_i - \mathbf{x}_i'\boldsymbol{\beta})^2

Weighted least squares minimizes a sum of squared errors where noisier observations, with smaller weight, count for less.

WLS estimator

bW=(XWX)1XWY\mathbf{b}_W = (\mathbf{X}'\mathbf{W}\mathbf{X})^{-1}\mathbf{X}'\mathbf{W}\mathbf{Y}

This closed-form solution generalizes ordinary least squares by inserting the weight matrix W\mathbf{W} into the normal equations.

WLS variance

Var{bW}=σ2(XWX)1\operatorname{Var}\{\mathbf{b}_W\} = \sigma^2 (\mathbf{X}'\mathbf{W}\mathbf{X})^{-1}

This is the weighted-regression analogue of the ordinary least squares coefficient covariance.

Whitening transform

Y=W1/2Y, X=W1/2X, Var{W1/2ε}=σ2I\mathbf{Y}^{\ast} = \mathbf{W}^{1/2}\mathbf{Y},\ \mathbf{X}^{\ast} = \mathbf{W}^{1/2}\mathbf{X},\ \operatorname{Var}\{\mathbf{W}^{1/2}\boldsymbol{\varepsilon}\}=\sigma^2\mathbf{I}

Rescaling both Y\mathbf{Y} and X\mathbf{X} by the square root of the weights turns weighted least squares into an ordinary least squares problem on the transformed data.

Known-variance weights

wi=1/sdi2w_i = 1/\mathrm{sd}_i^2

When each observation’s error standard deviation is known or estimated separately, its weight is the reciprocal of that variance, so noisier points count less.

Huber loss

ρc(u)=u2/2 (uc), cuc2/2 (u>c)\rho_c(u) = u^2/2 \ (|u|\le c),\ c|u| - c^2/2 \ (|u|>c)

This loss behaves like squared error for typical residuals but switches to a gentler absolute-value penalty for large ones, limiting an outlier’s pull on the fit.

Huber weight

w(u)=min(1,c/u), c=1.345w(u) = \min(1, c/|u|),\ c = 1.345

Robust regression re-expresses the Huber loss as a weighted least squares problem where large residuals get automatically downweighted.

Robust regression estimating equations

iw(ui)(Yixiβ)xi=0\sum_i w(u_i)(Y_i - \mathbf{x}_i'\boldsymbol{\beta})\mathbf{x}_i = \mathbf{0}

These equations, solved iteratively since the weights depend on the fit, define the robust regression estimate.

A.11 Chapter 11: Categorical predictors and interactions

Reference-cell indicators

Xj=1 if level j, 0 otherwise, j=1,,k1X_j = 1 \text{ if level } j,\ 0 \text{ otherwise},\ j = 1,\dots,k-1

A categorical predictor with kk levels becomes k1k-1 zero-one indicator columns, one level held back as the reference.

One-factor reference-cell model

Yi=β0+β1Xi1++βk1Xi,k1+εiY_i = \beta_0 + \beta_1 X_{i1} + \cdots + \beta_{k-1} X_{i,k-1} + \varepsilon_i

This model fits a separate mean response for each category using indicator predictors inside the ordinary regression framework.

Group mean readings

E{Yref}=β0, E{Ylevel j}=β0+βjE\{Y\mid\text{ref}\}=\beta_0,\ E\{Y\mid\text{level }j\}=\beta_0+\beta_j

The intercept is the reference group’s mean, and each coefficient shifts the mean up or down for its own level.

Indicator coefficient

βj=E{Ylevel j}E{Yref}\beta_j = E\{Y\mid\text{level }j\} - E\{Y\mid\text{ref}\}

Every indicator coefficient is a difference in means between one level and the reference level.

Rank-deficiency dependence

X1+X2++Xk=1X_1 + X_2 + \cdots + X_k = \mathbf{1}

Using all kk indicator columns instead of k1k-1 makes them add up to the intercept column exactly, which is why one level must be dropped to keep XX\mathbf{X}'\mathbf{X} invertible.

Parallel-lines (ANCOVA) model

Yi=β0+β1Xi+β2Di+εiY_i = \beta_0 + \beta_1 X_i + \beta_2 D_i + \varepsilon_i

This model fits two parallel lines, one per group, that share a common slope β1\beta_1 but have different intercepts shifted by β2\beta_2.

Interaction model

Yi=β0+β1Xi+β2Di+β3XiDi+εiY_i = \beta_0 + \beta_1 X_i + \beta_2 D_i + \beta_3 X_i D_i + \varepsilon_i

Adding a product term lets the slope itself differ between groups, not just the intercept.

Group slopes under interaction

slope(D=0)=β1, slope(D=1)=β1+β3\text{slope}(D=0)=\beta_1,\ \text{slope}(D=1)=\beta_1+\beta_3

The interaction coefficient β3\beta_3 is exactly the difference in slope between the two groups.

Between-group gap under interaction

gap(X)=β2+β3X\text{gap}(X) = \beta_2 + \beta_3 X

Once slopes differ, the vertical gap between the two group lines is no longer constant; it changes with XX.

General linear test (parallel vs separate)

F=(SSERSSEF)/(dfRdfF)SSEF/dfFF = \frac{(\mathrm{SSE}_R - \mathrm{SSE}_F)/(df_R - df_F)}{\mathrm{SSE}_F/df_F}

This is the Chapter 8 general linear test applied to compare a parallel-lines model against a model with an interaction term.

tt-FF equivalence for one term

t2=F(1 numerator df)t^2 = F \quad (\text{1 numerator df})

Testing a single interaction coefficient with a tt test or with the general linear FF test gives the same conclusion.

Quadratic polynomial model

Yi=β0+β1Xi+β2Xi2+εiY_i = \beta_0 + \beta_1 X_i + \beta_2 X_i^2 + \varepsilon_i

Adding a squared term lets the fitted curve bend, while the model stays linear in the parameters and fits with ordinary least squares.

Centered predictor

xi=XiXˉx_i = X_i - \bar X

Subtracting the mean before squaring reduces the correlation between XiX_i and Xi2X_i^2, which stabilizes the numerical fit of a polynomial model.

Centered coefficient map

β0=β0+β1Xˉ+β2Xˉ2, β1=β1+2β2Xˉ, β2=β2\beta_0^{\ast}=\beta_0+\beta_1\bar X+\beta_2\bar X^2,\ \beta_1^{\ast}=\beta_1+2\beta_2\bar X,\ \beta_2^{\ast}=\beta_2

These equations translate the coefficients of a centered quadratic model back into the coefficients of the original, uncentered one.

Hinge (piecewise) predictor

(Xc)+=max(Xc, 0)(X - c)_+ = \max(X - c,\ 0)

This term stays at zero until XX passes the breakpoint cc, then rises linearly, letting the slope change at cc while the model stays linear in its parameters.

One-way ANOVA model

Yij=μ+τi+εijY_{ij} = \mu + \tau_i + \varepsilon_{ij}

Classic one-way ANOVA is a special case of regression with a categorical predictor, where τi\tau_i is the effect of group ii.

ANOVA null hypothesis

H0:τ1==τk=0  β1==βk1=0H_0: \tau_1 = \cdots = \tau_k = 0 \ \Leftrightarrow\ \beta_1 = \cdots = \beta_{k-1} = 0

Testing whether all group effects are zero in the ANOVA formulation is exactly the general linear test that all indicator coefficients are zero in the regression formulation.

ANOVA / regression FF

F=MSR/MSEF = \mathrm{MSR}/\mathrm{MSE}

The familiar ANOVA FF statistic is the same ratio of explained to unexplained mean squares used throughout the book.

A.12 Chapter 12: Multicollinearity, variable selection, and validation

Variance inflation factor

VIFk=11Rk2\mathrm{VIF}_k = \frac{1}{1 - R_k^2}

VIFk\mathrm{VIF}_k measures how much XkX_k’s coefficient variance is inflated because XkX_k can be predicted from the other predictors, where Rk2R_k^2 comes from regressing XkX_k on them.

Inflated coefficient variance

Var{bk}=σ2Skk(1Rk2)=σ2SkkVIFk\operatorname{Var}\{b_k\} = \frac{\sigma^2}{S_{kk}(1 - R_k^2)} = \frac{\sigma^2}{S_{kk}}\,\mathrm{VIF}_k

This shows directly how multicollinearity multiplies a coefficient’s variance by its VIF beyond what its own spread SkkS_{kk} would give alone.

Adjusted RR-squared

Ra,p2=1SSEp/(np)SSTO/(n1)R^2_{a,p} = 1 - \frac{\mathrm{SSE}_p/(n-p)}{\mathrm{SSTO}/(n-1)}

This model-selection criterion rewards a model with pp parameters for explaining variation while penalizing it for using more parameters to do so.

Mallows CpC_p

Cp=SSEpσ^2(n2p)C_p = \frac{\mathrm{SSE}_p}{\hat{\sigma}^2} - (n - 2p)

A candidate subset model is judged well-specified, neither underfit nor overly complex, when its CpC_p lands near pp.

AIC

AICp=nln(SSEp/n)+2p\mathrm{AIC}_p = n\ln(\mathrm{SSE}_p/n) + 2p

This criterion balances fit against complexity using a fixed penalty of two per parameter, smaller values indicating a better tradeoff.

BIC

BICp=nln(SSEp/n)+plnn\mathrm{BIC}_p = n\ln(\mathrm{SSE}_p/n) + p\ln n

This criterion penalizes each added parameter more heavily than AIC once nn is at least eight, favoring smaller models as sample size grows.

PRESS statistic

PRESSp=i=1n(YiY^(i))2\mathrm{PRESS}_p = \sum_{i=1}^n (Y_i - \hat{Y}_{(i)})^2

This totals the squared errors from predicting each observation using a model fit without that observation, a built-in cross-validation score.

PRESS deleted-residual shortcut

PRESS=i=1n(ei1hii)2\mathrm{PRESS} = \sum_{i=1}^n \left(\frac{e_i}{1 - h_{ii}}\right)^2

This computes PRESS from a single fit’s residuals and leverages, without refitting the model nn times.

Deleted residual

YiY^(i)=ei1hiiY_i - \hat{Y}_{(i)} = \frac{e_i}{1 - h_{ii}}

The gap between an observation’s response and the prediction a model without that observation would make can be recovered algebraically from the ordinary residual and leverage value.

Root mean squared error

RMSE=1m(YiY^i)2\mathrm{RMSE} = \sqrt{\frac{1}{m}\sum (Y_i - \hat{Y}_i)^2}

RMSE reports typical prediction error in the same units as YY, easier to interpret than a sum of squares.

kk-fold cross-validated RMSE

CV RMSE=1Kk=1KMSEk\mathrm{CV\ RMSE} = \sqrt{\frac{1}{K}\sum_{k=1}^{K}\mathrm{MSE}_k}

Splitting the data into KK folds, fitting on the rest, and averaging the held-out error across folds gives an honest estimate of prediction accuracy on new data.

Ridge estimator

β^ridge=argminβi(Yixiβ)2+λkβk2\hat{\boldsymbol{\beta}}_{\text{ridge}} = \arg\min_{\boldsymbol{\beta}} \sum_i (Y_i - \mathbf{x}_i'\boldsymbol{\beta})^2 + \lambda\sum_k \beta_k^2

Ridge regression trades a little bias for less variance by shrinking every coefficient toward zero, controlled by the penalty strength λ\lambda.

Lasso estimator

β^lasso=argminβi(Yixiβ)2+λkβk\hat{\boldsymbol{\beta}}_{\text{lasso}} = \arg\min_{\boldsymbol{\beta}} \sum_i (Y_i - \mathbf{x}_i'\boldsymbol{\beta})^2 + \lambda\sum_k |\beta_k|

Lasso shrinks coefficients like ridge but can push some all the way to zero, performing variable selection automatically.

One-predictor ridge solution

β^ridge=ixiYiixi2+λ\hat{\beta}_{\text{ridge}} = \frac{\sum_i x_i Y_i}{\sum_i x_i^2 + \lambda}

With a single centered predictor, ridge regression has this simple closed form, showing directly how larger λ\lambda shrinks the estimate toward zero.

Sherman-Morrison rank-one downdate

(XXxixi)1=(XX)1+(XX)1xixi(XX)11hii(\mathbf{X}'\mathbf{X} - \mathbf{x}_i\mathbf{x}_i')^{-1} = (\mathbf{X}'\mathbf{X})^{-1} + \frac{(\mathbf{X}'\mathbf{X})^{-1}\mathbf{x}_i\mathbf{x}_i'(\mathbf{X}'\mathbf{X})^{-1}}{1 - h_{ii}}

This identity, the same tool from Chapter 9, lets cross-validation formulas remove one observation’s contribution without refitting the whole model.

A.13 Chapter 13: Logistic regression

Odds

odds=π/(1π)\text{odds} = \pi/(1-\pi)

Odds compares the probability of an event to the probability it does not happen, a ratio rather than a proportion.

Logit (log-odds)

logit(π)=log[π/(1π)]\operatorname{logit}(\pi) = \log[\pi/(1-\pi)]

The logit stretches a probability, confined between 0 and 1, onto the whole real line, which makes it possible to model with an ordinary linear predictor.

Logistic regression model

logit(πi)=β0+β1Xi1++βp1Xi,p1\operatorname{logit}(\pi_i) = \beta_0 + \beta_1 X_{i1} + \dots + \beta_{p-1} X_{i,p-1}

Logistic regression fits a straight line, or plane, to the log-odds of an event rather than to the probability itself.

Logistic (mean) function

πi=1/(1+eηi)\pi_i = 1/(1 + e^{-\eta_i})

This function converts the linear predictor ηi\eta_i back into a probability between 0 and 1.

Binomial log-likelihood

(β)=i[Yiηimilog(1+eηi)]+C\ell(\beta) = \sum_i [Y_i \eta_i - m_i \log(1 + e^{\eta_i})] + C

This function scores how well a candidate coefficient vector explains the observed successes and failures; maximizing it gives the logistic regression fit.

Score equations

X(Yμ)=0,μi=miπi\mathbf{X}'(\mathbf{Y} - \boldsymbol{\mu}) = \mathbf{0}, \quad \mu_i = m_i \pi_i

At the maximum likelihood estimate, the residuals (observed minus expected counts) are uncorrelated with every predictor, the logistic analogue of Xe=0\mathbf{X}'\mathbf{e} = \mathbf{0}.

Fisher information / Hessian

2/ββ=XWX,W=diag(miπi(1πi))-\partial^2\ell/\partial\beta\partial\beta' = \mathbf{X}'\mathbf{W}\mathbf{X}, \quad \mathbf{W} = \operatorname{diag}(m_i \pi_i(1-\pi_i))

This matrix measures the curvature of the log-likelihood, and its inverse gives the approximate covariance matrix of the coefficient estimates.

IRLS update

β(t+1)=(XWX)1XWz,zi=ηi+(Yiμi)/wi\beta^{(t+1)} = (\mathbf{X}'\mathbf{W}\mathbf{X})^{-1}\mathbf{X}'\mathbf{W}\mathbf{z}, \quad z_i = \eta_i + (Y_i - \mu_i)/w_i

Logistic regression has no closed-form solution, so software fits it by repeating a weighted least squares step until the coefficients stop changing.

Odds ratio

OR=ecβj per c units\text{OR} = e^{c\beta_j} \text{ per } c \text{ units}

Exponentiating a logistic coefficient converts it from a log-odds change into a multiplicative factor on the odds, the number reported and interpreted in practice.

Wald statistic

zj=bj/s{bj}approxN(0,1)z_j = b_j / s\{b_j\} \overset{\text{approx}}{\sim} N(0,1)

This is the logistic regression analogue of the tt statistic, testing whether one coefficient is zero using its estimate and standard error.

Deviance

D=2[sat(β^)]=2i[Yilog(Yi/μ^i)+(miYi)log((miYi)/(miμ^i))]D = 2[\ell_{\text{sat}} - \ell(\hat\beta)] = 2\sum_i [Y_i \log(Y_i/\hat\mu_i) + (m_i - Y_i)\log((m_i - Y_i)/(m_i - \hat\mu_i))]

Deviance measures how far the fitted model’s likelihood falls short of a perfect fit, the logistic regression analogue of SSE\mathrm{SSE}.

Likelihood-ratio statistic

G2=DreducedDfullapproxχq2G^2 = D_{\text{reduced}} - D_{\text{full}} \overset{\text{approx}}{\sim} \chi^2_q

Comparing the deviance of two nested logistic models tests whether the extra predictors in the larger model improve the fit, the logistic analogue of the FF test.

Sensitivity

sens=TP/(TP+FN)\text{sens} = \text{TP}/(\text{TP} + \text{FN})

Sensitivity is the proportion of actual positive cases the model correctly flags.

Specificity

spec=TN/(TN+FP)\text{spec} = \text{TN}/(\text{TN} + \text{FP})

Specificity is the proportion of actual negative cases the model correctly clears.

AUC

AUC=P(π^pos>π^neg)\text{AUC} = P(\hat\pi_{\text{pos}} > \hat\pi_{\text{neg}})

AUC is the probability that a randomly chosen positive case gets a higher predicted probability than a randomly chosen negative case, a single number summarizing classification quality across every threshold.

A.14 Chapter 14: Poisson regression and the GLM idea

Poisson distribution

P(Y=y)=eμμyy!P(Y=y) = \frac{e^{-\mu}\mu^{y}}{y!}

This distribution models count data: the probability of observing exactly yy events when the average rate is μ\mu.

Poisson mean and variance

E{Y}=μ,Var{Y}=μE\{Y\} = \mu,\quad \operatorname{Var}\{Y\} = \mu

A defining feature of the Poisson distribution is that its variance always equals its mean, a constraint Poisson regression inherits and later chapters relax.

Poisson log-linear model

YiPoisson(μi), logμi=ηi=xiβY_i \sim \text{Poisson}(\mu_i),\ \log\mu_i = \eta_i = \mathbf{x}_i'\boldsymbol\beta

Poisson regression models counts by fitting a linear predictor to the log of the mean count, which keeps predicted counts positive.

Mean on response scale

μi=eηi=exiβ\mu_i = e^{\eta_i} = e^{\mathbf{x}_i'\boldsymbol\beta}

Exponentiating the linear predictor converts it back to a predicted count, always positive by construction.

Rate ratio

μ(Xj+1)μ(Xj)=eβj\frac{\mu(X_j+1)}{\mu(X_j)} = e^{\beta_j}

Adding one unit to a predictor multiplies the predicted count by eβje^{\beta_j}, the Poisson regression analogue of an odds ratio.

Poisson log-likelihood

(β)=i=1n[yixiβexiβlog(yi!)]\ell(\boldsymbol\beta) = \sum_{i=1}^n [ y_i\,\mathbf{x}_i'\boldsymbol\beta - e^{\mathbf{x}_i'\boldsymbol\beta} - \log(y_i!) ]

Maximizing this function over β\boldsymbol\beta gives the Poisson regression coefficient estimates.

Poisson score equations

i=1n(yiμi)xi=0\sum_{i=1}^n (y_i - \mu_i)\mathbf{x}_i = \mathbf{0}

At the maximum likelihood estimate, the observed counts minus the fitted counts are uncorrelated with every predictor, the same balancing property seen in Chapter 7 and Chapter 13.

Offset (rate model)

logμi=xiβ+logti,μi=λiti\log\mu_i = \mathbf{x}_i'\boldsymbol\beta + \log t_i,\quad \mu_i = \lambda_i t_i

Adding a fixed offset term logti\log t_i models a rate per unit of exposure tit_i, so two observations with different exposure times remain comparable.

Pearson residual

riP=Yiμ^iμ^ir_i^{P} = \frac{Y_i - \hat\mu_i}{\sqrt{\hat\mu_i}}

This residual rescales the raw count residual by the Poisson standard deviation, so residuals across observations with different means are comparable.

Estimated dispersion

ϕ^=1npi=1n(riP)2=X2np\hat\phi = \frac{1}{n-p}\sum_{i=1}^n (r_i^{P})^2 = \frac{X^2}{n-p}

This checks the Poisson mean-equals-variance assumption; a value well above 1 signals overdispersion.

Quasi-Poisson variance

Var{Yi}=ϕμi\operatorname{Var}\{Y_i\} = \phi\,\mu_i

This relaxes the strict Poisson assumption by allowing the variance to be a multiple ϕ\phi of the mean rather than exactly equal to it.

Quasi-Poisson standard error

squasi{bj}=ϕ^sPoisson{bj}s_{\text{quasi}}\{b_j\} = \sqrt{\hat\phi}\,s_{\text{Poisson}}\{b_j\}

Multiplying the ordinary Poisson standard errors by the square root of the dispersion estimate corrects them for overdispersion.

Negative binomial variance

Var{Y}=μ+μ2/θ\operatorname{Var}\{Y\} = \mu + \mu^2/\theta

The negative binomial distribution lets variance grow faster than the mean, an alternative to Poisson regression for more strongly overdispersed counts.

Generalized linear model

Yiexponential family, ηi=xiβ, g(μi)=ηiY_i \sim \text{exponential family},\ \eta_i = \mathbf{x}_i'\boldsymbol\beta,\ g(\mu_i) = \eta_i

The GLM framework unifies ordinary, logistic, and Poisson regression as one family: a distribution for YY, a linear predictor, and a link function gg connecting them.

A.15 Chapter 15: Regression with time: autocorrelation and forecasting

Trend-plus-season model

logYt=β0+β1t+m=212γmDmt+εt\log Y_t = \beta_0 + \beta_1 t + \sum_{m=2}^{12}\gamma_m D_{mt} + \varepsilon_t

This model fits a straight-line trend on the log scale plus monthly indicator shifts, capturing both growth and a repeating seasonal pattern.

Monthly growth from log slope

(eβ11)×100%(e^{\beta_1}-1)\times 100\%

Exponentiating the trend slope in a log-scale time model converts it into a percent growth rate per period.

AR(1) error model

εt=ρεt1+ut, utiidN(0,σu2), ρ<1\varepsilon_t = \rho\,\varepsilon_{t-1} + u_t,\ u_t \overset{\text{iid}}{\sim} N(0,\sigma_u^2),\ |\rho|<1

Each error depends on the previous one through the correlation ρ\rho, plus fresh independent noise, which is how consecutive residuals in time-ordered data end up related.

Variance of mean under AR(1)

Var{Yˉ}=σ2n(1+2k=1n1(1kn)ρk)\operatorname{Var}\{\bar Y\} = \frac{\sigma^2}{n}\left(1 + 2\sum_{k=1}^{n-1}\left(1 - \frac{k}{n}\right)\rho^{k}\right)

Positive autocorrelation inflates the true variance of a sample mean well beyond the usual σ2/n\sigma^2/n, which is why ignoring autocorrelation makes standard errors too small.

AR(1) error variance

Var{εt}=σu2/(1ρ2)\operatorname{Var}\{\varepsilon_t\} = \sigma_u^2/(1-\rho^2)

The overall variance of an AR(1) error series depends on both the innovation variance and how strongly errors carry over from one period to the next.

AR(1) autocorrelation at lag kk

Corr{εt,εtk}=ρk\operatorname{Corr}\{\varepsilon_t,\varepsilon_{t-k}\} = \rho^{k}

Correlation between errors kk periods apart decays geometrically, fading out as the gap grows.

Durbin-Watson statistic

D=t=2n(etet1)2/t=1net2D = \sum_{t=2}^{n}(e_t - e_{t-1})^2 \big/ \sum_{t=1}^{n} e_t^2

This is the same diagnostic introduced in Chapter 9, now the main tool for detecting autocorrelation in a time-ordered regression.

Durbin-Watson approximation

D2(1r1)D \approx 2(1 - r_1)

The Durbin-Watson statistic is approximately twice one minus the lag-one residual correlation, which is why values near 2 indicate no autocorrelation.

Lag-one residual autocorrelation

r1=t=2netet1/t=1net2r_1 = \sum_{t=2}^{n} e_t e_{t-1} \big/ \sum_{t=1}^{n} e_t^2

This estimates how strongly one residual predicts the next, the sample version of ρ\rho.

Cochrane-Orcutt ρ\rho estimate

ρ^=t=2netet1/t=2net12\hat\rho = \sum_{t=2}^{n} e_t e_{t-1} \big/ \sum_{t=2}^{n} e_{t-1}^2

This estimates the AR(1) correlation from ordinary least squares residuals as the first step of a two-step correction procedure.

Quasi-differencing transform

YtρYt1=(xtρxt1)β+utY_t - \rho Y_{t-1} = (\mathbf{x}_t - \rho\mathbf{x}_{t-1})'\boldsymbol\beta + u_t

Subtracting ρ\rho times the previous period from both response and predictors removes the autocorrelation, leaving a model that ordinary least squares can fit correctly.

Test root mean squared error

RMSE=1ntestttest(YtY^t)2\mathrm{RMSE} = \sqrt{\frac{1}{n_{\text{test}}}\sum_{t\in\text{test}}(Y_t - \hat Y_t)^2}

This measures typical forecast error, in the original units, on data the model never saw during fitting.

Test mean absolute percentage error

MAPE=100%ntestttestYtY^tYt\mathrm{MAPE} = \frac{100\%}{n_{\text{test}}}\sum_{t\in\text{test}}\frac{|Y_t - \hat Y_t|}{Y_t}

This measures typical forecast error as a percentage of the actual value, useful for comparing accuracy across series with different scales.

A.16 Chapter 16: Path analysis and a look ahead

Income equation (standardized)

income=pIEeducation+dI\text{income}^\ast = p_{IE}\,\text{education}^\ast + d_I

In standardized form, education’s effect on income is a single path coefficient pIEp_{IE}, plus a disturbance dId_I for everything else that affects income.

Prestige equation (standardized)

prestige=pPEeducation+pPIincome+dP\text{prestige}^\ast = p_{PE}\,\text{education}^\ast + p_{PI}\,\text{income}^\ast + d_P

Prestige depends on both education and income at once, each with its own standardized path coefficient.

Standardized (path) coefficient

pk=bksXk/sYp_k = b_k\, s_{X_k}/s_Y

A path coefficient is an ordinary regression slope rescaled by the ratio of standard deviations, the same standardization from Chapter 8 applied to a system of equations.

Direct effect

direct=pPE\text{direct} = p_{PE}

The direct effect of education on prestige is simply its own path coefficient in the prestige equation, holding income fixed.

Indirect effect

indirect=pIEpPI\text{indirect} = p_{IE}\, p_{PI}

The indirect effect of education on prestige, routed through income, multiplies the two path coefficients along that chain.

Total effect

total=pPE+pIEpPI\text{total} = p_{PE} + p_{IE}\, p_{PI}

Adding the direct and indirect effects gives education’s total influence on prestige, direct plus everything that flows through income.

Total effect equals correlation (exogenous cause)

reducation,prestige=pPE+pPIpIEr_{\text{education},\text{prestige}} = p_{PE} + p_{PI}\, p_{IE}

For a variable with no causes inside the diagram, its simple correlation with an outcome equals the sum of every path connecting them, a check on the whole path model.

Correlation decomposition (income, prestige)

rincome,prestige=pPI+pIEpPEr_{\text{income},\text{prestige}} = p_{PI} + p_{IE}\, p_{PE}

Income and prestige’s correlation splits into income’s direct path to prestige plus a piece shared through their common cause, education.

Reduced form of prestige

prestige=(pPE+pPIpIE)education+(pPIdI+dP)\text{prestige}^\ast = (p_{PE} + p_{PI}p_{IE})\text{education}^\ast + (p_{PI}d_I + d_P)

Substituting the income equation into the prestige equation collapses the two-step path diagram into education’s total effect on prestige in a single equation.