45.06.08 · mathematical-statistics / 06-high-dimensional-regularization

Principal Components Regression and Partial Least Squares

shipped3 tiersLean: none

Anchor (Master): Hastie, Tibshirani & Friedman 2009 The Elements of Statistical Learning 2e (Springer) §3.5 and §3.6 (derived-input directions, the discussion comparing subset selection, ridge, lasso, PCR, and PLS as shrinkage operators); Jolliffe 2002 Principal Component Analysis 2e (Springer) Ch. 8 (PCR, the selection of components, biased regression); Wold, Sjöström & Eriksson 2001 Chemometrics and Intelligent Laboratory Systems 58 (PLS-regression: a basic tool of chemometrics, the NIPALS algorithm)

Intuition Beginner

Imagine you have fifty thermometers scattered around a building, all reporting almost the same temperature. To predict the heating bill you do not need fifty numbers; you need one or two summaries — the average temperature, maybe how fast it is changing. Stuffing all fifty raw readings into a regression is asking for trouble: they overlap so heavily that the fitting machine cannot tell them apart and the weights it picks are wild and unstable, the same collinearity headache from the ridge unit.

Derived-input regression takes a different route than penalizing the weights. It first builds a handful of clean, non-overlapping summary directions out of the predictors, and then regresses on those few summaries instead of the raw predictors. Because the summaries do not overlap, the fit is stable, and because there are only a few of them, the model is simple.

The two methods in this unit differ in how they choose the summaries. Principal components regression picks the directions in which the predictors vary the most, ignoring the thing you want to predict while it chooses them. Partial least squares is greedier: it picks directions that vary a lot and line up with the response, so it consults the answer key while building its summaries.

The everyday picture is packing for a trip. You cannot bring every item, so you pack a few versatile outfits. Principal components packs whatever takes up the most suitcase volume; partial least squares packs whatever you are most likely to actually wear.

Visual Beginner

Method How the summary directions are chosen Does it look at the response while choosing? What it shrinks
Ordinary least squares no summaries; uses raw predictors not applicable nothing — keeps everything
Ridge no summaries; penalizes weight size no every direction, smoothly, weak ones more
Principal components regression directions of largest predictor variance no drops the small-variance directions entirely
Partial least squares directions of largest covariance with the response yes low-variance directions, but uses the response to decide

The single picture to carry forward: ridge turns a smooth dial down on every direction, while principal components regression flips a hard switch — full strength on the top directions, off on the rest. Partial least squares is like principal components but it lets the response vote on which directions count.

Worked example Beginner

Take two predictors that are nearly the same: and , measured on four items. Suppose after centering, the data are such that the two strong combined patterns are the sum direction (where the data spread out a lot) and the difference direction (where the data barely move at all, because the two predictors agree).

Say the sum direction has values across the four items, and the difference direction has tiny values . The response is .

Principal components regression with one component keeps only (the big-variance direction) and regresses on it. The slope is the sum of over the sum of . Sum of . Sum of . So the slope on is , and the fitted values are .

What this tells us: by keeping only the stable sum direction and throwing away the jittery difference direction, the fit tracks the response closely versus without ever having to split credit between the two near-identical raw predictors. The flimsy direction, where the data hardly vary, was discarded before it could destabilize anything. That discard-the-small-variance-directions step is the whole idea of principal components regression.

Check your understanding Beginner

Formal definition Intermediate+

Fix a design matrix with columns centered to mean zero (and typically scaled to unit variance) and a centered response ; the intercept is fitted separately. Write the thin SVD 01.01.12 with , orthonormal columns , singular values , and . The right singular vectors are the principal component directions: is the unit vector maximizing the sample variance subject to and orthogonality to , because the are the eigenvectors of with eigenvalues . The principal components (scores) are the projected columns , which are mutually orthogonal: .

Principal components regression (PCR). Choose a number of components and regress on by ordinary least squares. Because the scores are orthogonal, the regression decouples coordinate by coordinate: the coefficient on is , and the fitted vector is

Back-transforming through gives the coefficient vector in the original predictors,

Comparing with the SVD form of the ridge estimator 45.06.03, PCR applies the shrinkage factors — keep the top directions at full strength, discard the rest entirely — where ridge applies the smooth factors . PCR is a hard truncation; ridge is a smooth down-weighting. At both reduce to ordinary least squares.

Partial least squares (PLS). Instead of variance, PLS forms each direction to maximize covariance with the response. Set , . At step the weight vector is , the direction of maximal sample covariance over unit ; the score is ; the response is regressed on and both and are deflated by subtracting their projections onto . This is the NIPALS construction of Wold [Wold 2001]. The first PLS direction is , and the span of the first PLS scores equals the Krylov subspace .

The notation for derived scores, for direction vectors, for shrinkage factors, and for the Krylov subspace is recorded in _meta/NOTATION.md.

Counterexamples to common slips

  • PCR is not scale-invariant and not response-aware. The components are eigenvectors of alone, so rescaling a predictor changes them, and a low-variance direction with small is dropped at modest even if is large — PCR can discard the very direction that predicts [Jolliffe 2002].
  • PLS components are not orthogonal in the predictor metric the way principal components are. The PLS scores are mutually orthogonal, but the weight vectors are conjugate with respect to , not Euclidean-orthogonal; PLS is a non-orthogonal change of basis adapted to .
  • More components is not automatically better. Both methods interpolate between a high-bias one-component fit and the full OLS fit at ; the bias-variance trade-off has an interior optimum, so is a tuning parameter, not "as many as possible."
  • PLS does not always beat PCR or ridge. Using to choose directions can inflate variance: PLS can place more than unit weight on some high-variance directions, so its per-direction shrinkage factors need not lie in .

Key theorem with proof Intermediate+

Theorem (PCR is projection onto the top principal subspace; the hard-truncation shrinkage identity). With and centered , the -component PCR fitted vector is the orthogonal projection of onto , namely , and the corresponding coefficient vector is . Consequently PCR is the SVD estimator with shrinkage factors , in contrast to ridge's 45.06.03. The presentation follows Hastie, Tibshirani & Friedman [Hastie 2009] §3.5.1.

Proof. The scores are orthogonal, , so the Gram matrix of the regressors is diagonal and the least-squares fit of on them decouples. The coefficient on is

using . The fitted vector is . Since is orthonormal, is the orthogonal projector onto , so . Back-transforming, . The ridge fitted vector from 45.06.03 is ; writing PCR's fit as forces for and for , the indicator . Both are special cases of the linear-smoother family ; PCR uses a step function of the index, ridge a continuous function of the singular value.

Bridge. The proof's engine is the SVD rotation that diagonalizes the regression so the fit becomes a sum of independent one-dimensional projections weighted by factors , the same diagonalization that drives the ridge MSE computation of 45.06.03. This builds toward the unified shrinkage-operator comparison below, where subset selection, ridge, PCR, and PLS are read off a single shrinkage-factor profile, and it appears again in 45.06.05 where best-subset selection is the combinatorial analogue of PCR's projection onto a coordinate subspace. The foundational reason PCR controls variance is that projecting onto discards the small- directions where the OLS variance explodes — this is exactly the per-coordinate variance of 45.06.03 with the unstable terms set to zero rather than damped. The central insight is that ridge and PCR are the same estimator viewed through different factor profiles: ridge generalises the hard switch into a smooth contraction, so the bridge is the common map in which the choice of is the entire content of a derived-input method. Putting these together, PCR is the limit of ridge in which the smooth dial is replaced by a cliff.

Exercises Intermediate+

Lean formalization Intermediate+

Mathlib does not host the derived-input regression estimators, so no module is wired in (lean_status: none). The intended statements of the PCR projection identity and the PLS Krylov characterization, once an SVD-based least-squares API exists, would read roughly as follows.

-- Intended shape; not part of the current Babel Bible Lean build.
-- Requires: the thin SVD of a real matrix and a least-squares-on-scores API.
variable {n p : ℕ} (X : Matrix (Fin n) (Fin p) ℝ) (y : Fin n → ℝ) (M : ℕ)

-- Principal-component scores z_m = X v_m and their orthogonality z_mᵀ z_k = d_m² δ.
-- PCR fitted vector is the orthogonal projection of y onto span{u_1, …, u_M}.
theorem pcr_is_projection (hM : M ≤ X.rank) :
    pcrFit X y M = orthogonalProjection (topLeftSingularSpan X M) y := by
  sorry

-- The PCR coefficient equals the SVD estimator with factors f_m = 1{m ≤ M}.
theorem pcr_shrinkage_factors (hM : M ≤ X.rank) :
    pcrBeta X y M = svdEstimator X y (fun m => if m < M then (1 : ℝ) else 0) := by
  sorry

-- PLS coefficients live in the Krylov subspace K_M(XᵀX, Xᵀy).
theorem pls_in_krylov (M : ℕ) :
    plsBeta X y M ∈ krylovSubspace (Xᵀ * X) (Xᵀ *ᵥ y) M := by
  sorry

the Mathlib gap analysis records what is missing: the variance-maximizing principal directions with deflation, the PCR estimator as projection onto the top singular subspace, the indicator shrinkage profile, and the NIPALS/Krylov characterization of PLS together with its conjugate-gradient equivalence.

Advanced results Master

The shrinkage-operator viewpoint unifies the chapter. Every method in the bias-variance family acts on the SVD coordinates as for a profile of factors : ordinary least squares takes ; ridge 45.06.03 takes the smooth ; principal components regression takes the hard indicator ; best-subset selection 45.06.05 takes a data-dependent profile that need not respect the singular-value order. Reading these off one figure (Hastie, Tibshirani & Friedman [Hastie 2009] §3.6, Figure 3.17) shows PCR as the discontinuous cousin of ridge: where ridge tapers, PCR cliffs. Subset selection and PCR share the discontinuity; ridge and PLS are continuous in their tuning parameter.

Partial least squares does not fit cleanly into a fixed factor profile because it uses to choose its directions, so its effective shrinkage factors depend on the response and can exceed on high-variance directions. Frank and Friedman's simulation study established the empirical ordering: in the high-collinearity, large- regime, ridge and PLS are typically the strongest predictors, PCR is close behind, and best-subset selection is the most variable. The reason is variance control. PCR and ridge restrict attention to the high-variance directions where coefficients are well-determined; PLS does the same but tilts toward directions correlated with , gaining bias reduction at the cost of the extra variance from estimating those directions with the response. When the signal lives in the high-variance directions — common when predictors are collinear measurements of a few latent factors — all three sharply outperform OLS; when the signal hides in a low-variance direction, PCR can fail and PLS or ridge recover.

The conjugate-gradient identity sharpens the picture for PLS. By Exercise 6 the PLS coefficient after steps minimizes the residual sum of squares over the Krylov subspace , which is precisely what iterations of conjugate gradient on the normal equations produce. PLS is therefore an early-stopped iterative solver: each component is one conjugate-gradient step, and stopping early is the regularization. This connects derived-input regression to iterative regularization for ill-posed inverse problems, where the iteration count plays the role ridge's plays — the Landweber and conjugate-gradient regularization of inverse problems, where stopping the iteration before convergence keeps the small-singular-value directions from blowing up.

The number of components is the bias-variance tuning parameter, selected exactly as is for ridge: by -fold cross-validation over , taking the minimizer of held-out error or the most parsimonious within one standard error of it. For PCR, Jolliffe [Jolliffe 2002] argues against the naive "retain by variance" rule, recommending that components be screened by their correlation with the response or their regression -statistics, since a small-variance component can carry large predictive value — the central pathology that motivates PLS over PCR.

A brief connection to canonical correlation closes the circle. Where PCA finds directions of maximal variance within one block , and PLS finds directions of maximal covariance between and , canonical correlation analysis (CCA) finds paired directions maximizing the correlation between two blocks and . The three are a graded family: covariance equals correlation times the two standard deviations, so PLS sits between PCA (variance only) and CCA (correlation only), interpolating by how much it normalizes for the response variance. In the single-response case CCA collapses to ordinary least squares, recovering the OLS end of the spectrum once more.

Synthesis. The foundational reason PCR, PLS, ridge, and subset selection form one theory is that the SVD diagonalizes regression into independent one-dimensional problems on the principal directions, so each method is fully specified by how it weights direction : this is exactly the shrinkage map , and the entire content of a derived-input method is its factor profile . PCR's hard indicator generalises into ridge's smooth taper, so the two are the discontinuous and continuous limits of a single contraction, and PLS is the response-aware version whose factors are computed from a Krylov subspace rather than fixed in advance. This is exactly the conjugate-gradient/Lanczos structure: PLS is early-stopped CG on the normal equations, so the component count is dual to ridge's penalty as a regularization dial. Putting these together with the canonical-correlation hierarchy — PCA maximizes variance, PLS covariance, CCA correlation — shows that the choice of derived inputs is a choice of how much the response participates in forming the basis, from not at all (PCR) to fully (CCA), with PLS in between; the central insight is that high-dimensional collinear regression is governed not by penalizing coefficients but by selecting which principal directions to trust, and the bridge between all these methods is the common diagonalization in which trusting a direction means assigning it a shrinkage factor near one and distrusting it means a factor near zero.

Full proof set Master

The PCR projection identity, the hard-truncation shrinkage factors, the score orthogonality, the first-PLS-direction characterization, the PCR-equals-OLS-at- identity, and the Krylov characterization are proved in full in the Formal definition, Key theorem, and Exercises sections. The remaining Master claims are recorded here.

Proposition 1 (PCR minimizes prediction MSE among rank- truncations along the singular basis). Among all estimators of the form with chosen from the singular basis, the choice minimizes the expected prediction error when the signal-to-noise ratio per direction, , is nonincreasing in , where .

Proof. Write the true response as with . For a retained set , the fitted vector is . The expected squared error decomposes over the orthonormal directions: each dropped direction contributes squared bias (the lost signal), and each kept direction contributes variance . So . With fixed the variance term is constant, so minimizing the error means minimizing the dropped signal , achieved by dropping the directions with the smallest . When is nonincreasing in , those are exactly , so is optimal.

Proposition 2 (PLS shrinkage factors can exceed one). There exist designs and responses for which the implied PLS shrinkage factor on some high-variance direction exceeds , so PLS is not a contraction in the sense ridge and PCR are.

Proof. Write the PLS fitted vector in the singular basis as , defining the implied factors . Because PLS minimizes the residual over the Krylov subspace (Exercise 6), the factors are values of the degree- polynomial with that the conjugate-gradient iteration selects, normalized so that interpolates at the Ritz values. Such polynomials are not constrained to : at a lying between two Ritz values the interpolating polynomial can overshoot, giving . A concrete two-component example with three well-separated singular values exhibits on the leading direction after one step, because the single Krylov direction over-weights the direction it most aligns with. Hence the PLS factor profile is not a contraction, distinguishing it from ridge () and PCR ().

Proposition 3 (PLS equals conjugate gradient on the normal equations). The -component PLS coefficient equals the iterate produced by steps of the conjugate-gradient method applied to started from .

Proof. Conjugate gradient started at produces, after steps, the unique minimizer of the quadratic — equivalently of up to a constant — over the Krylov subspace . By Exercise 6 the PLS directions span the same , and PLS by construction regresses on those directions, i.e. minimizes the residual sum of squares over . Two minimizers of the same strictly convex quadratic over the same subspace coincide, so . Early stopping of conjugate gradient is therefore identical to choosing the PLS component count, and the iteration index is the regularization parameter.

Proposition 4 (CCA reduces to OLS for a single response). When the second block is a single centered response , the canonical-correlation direction maximizing yields the same fitted direction as ordinary least squares of on .

Proof. For scalar the canonical problem is , since is one-dimensional and drops out up to sign. Maximizing with , is a generalized Rayleigh quotient solved by (on the range of ). The maximizing direction is the OLS coefficient vector, so single-response CCA recovers least squares, placing OLS at the correlation-maximizing end of the PCA-PLS-CCA family.

Connections Master

Linear model theory 45.06.01 supplies the OLS estimator and the column-space projection that PCR refines: PCR projects onto the span of the top left singular vectors rather than the full column space, so it is the Gauss-Markov fit restricted to a low-rank principal subspace, trading the unbiasedness of 45.06.01 for the variance reduction of discarding small-singular-value directions.

Ridge regression and shrinkage 45.06.03 is the continuous sibling: both ridge and PCR act on the SVD coordinates as , with ridge using the smooth factor and PCR the hard indicator , so PCR is the discontinuous limit of ridge and the two share the variance-control mechanism of damping the unstable directions.

The singular value decomposition 01.01.12 is the structural backbone: the right singular vectors are the principal component directions, the left singular vectors span the subspaces PCR projects onto, and the singular values order the directions by variance — every claim about PCR, and the Krylov structure of PLS, is read off the SVD of the centered design.

Subset selection and the curse of dimensionality 45.06.05 is the combinatorial counterpart: best-subset selection is a shrinkage profile like PCR's, but chosen over coordinate subspaces rather than principal subspaces, so PCR is the principal-direction analogue of subset selection and both sit at the discontinuous end of the shrinkage-operator family that ridge anchors at the smooth end.

The James-Stein estimator 45.06.04 is the decision-theoretic precedent for trading bias for variance in many dimensions: PCR and PLS are the regression-specific shrinkage estimators whose admissibility-style gains over OLS in high collinearity echo the Stein phenomenon, with the principal-direction truncation playing the role of the Stein contraction toward a low-dimensional target.

Historical & philosophical context Master

Principal component analysis originated with Karl Pearson in 1901, who sought the line and plane of closest fit to a system of points, and was independently developed and named by Harold Hotelling in 1933 as the analysis of the principal components of a correlated battery of variables [Jolliffe 2002]. Their use as regressors to combat multicollinearity — principal components regression — was advanced through the 1960s by Kendall, Massy, and others; Jolliffe's monograph [Jolliffe 2002] consolidated the practice and issued the standing caution that selecting components by variance alone can discard a low-variance direction that is strongly predictive of the response, the pathology that motivates response-aware alternatives.

Partial least squares arose in a different community. Herman Wold developed the NIPALS algorithm in the 1960s for latent-variable path models in econometrics and sociology, and his son Svante Wold adapted it in the late 1970s into PLS regression, which became the workhorse of chemometrics — the analysis of spectroscopic data with thousands of collinear wavelength channels and few samples. The modern statement of the algorithm and its standing in chemometrics is given by Wold, Sjöström and Eriksson [Wold 2001]. The equivalence of PLS to the conjugate-gradient and Lanczos methods on the normal equations, recognized in the numerical-analysis literature, reframed PLS as an iterative regularization scheme rather than a purely statistical heuristic. The unified shrinkage-operator account that places PCR, PLS, ridge, and subset selection on one footing, and the empirical comparison favoring ridge and PLS under collinearity, were assembled by Frank and Friedman and presented in Hastie, Tibshirani and Friedman [Hastie 2009] chapter 3.

Bibliography Master

@article{pearson1901lines,
  author  = {Pearson, Karl},
  title   = {On Lines and Planes of Closest Fit to Systems of Points in Space},
  journal = {Philosophical Magazine},
  volume  = {2},
  number  = {11},
  pages   = {559--572},
  year    = {1901}
}

@article{hotelling1933analysis,
  author  = {Hotelling, Harold},
  title   = {Analysis of a Complex of Statistical Variables into Principal Components},
  journal = {Journal of Educational Psychology},
  volume  = {24},
  pages   = {417--441, 498--520},
  year    = {1933}
}

@book{jolliffe2002pca,
  author    = {Jolliffe, Ian T.},
  title     = {Principal Component Analysis},
  edition   = {2},
  publisher = {Springer},
  year      = {2002},
  note      = {Chapter 8, principal components in regression}
}

@article{wold2001pls,
  author  = {Wold, Svante and Sj{\"o}str{\"o}m, Michael and Eriksson, Lennart},
  title   = {{PLS}-regression: A Basic Tool of Chemometrics},
  journal = {Chemometrics and Intelligent Laboratory Systems},
  volume  = {58},
  number  = {2},
  pages   = {109--130},
  year    = {2001}
}

@incollection{wold1975soft,
  author    = {Wold, Herman},
  title     = {Soft Modelling by Latent Variables: The Non-Linear Iterative Partial Least Squares (NIPALS) Approach},
  booktitle = {Perspectives in Probability and Statistics},
  publisher = {Academic Press},
  pages     = {117--142},
  year      = {1975}
}

@article{frank1993statistical,
  author  = {Frank, Ildiko E. and Friedman, Jerome H.},
  title   = {A Statistical View of Some Chemometrics Regression Tools},
  journal = {Technometrics},
  volume  = {35},
  number  = {2},
  pages   = {109--135},
  year    = {1993}
}

@book{hastie2009elements,
  author    = {Hastie, Trevor and Tibshirani, Robert and Friedman, Jerome},
  title     = {The Elements of Statistical Learning: Data Mining, Inference, and Prediction},
  edition   = {2},
  publisher = {Springer},
  year      = {2009},
  note      = {Chapter 3, §3.5 derived-input directions; §3.6 comparison}
}