Tutorials › Exam PA - Predictive Analytics › Stability of Ridge Estimates Under Data Perturbations

Exam PA · Penalties and Ridge Regression · Tutorial 418 of 966

Stability of Ridge Estimates Under Data Perturbations

Derive how a small response change affects ridge and least-squares coefficients, then use centered-design examples to compare their stability.

Intermediate 10 min read

What You'll Learn

  • State the fixed-design assumptions behind response-perturbation formulas for ridge and least squares
  • Calculate how changing one outcome changes the intercept and slope estimates
  • Compare coefficient-change magnitudes using the eigenvalues of the design cross-product matrix
  • Explain why ridge can stabilize a coefficient vector without shrinking every coefficient change individually
  • Distinguish response perturbations from changes to predictors or to the fitted penalty

Why Stability Matters

A fitted model can change when one recorded outcome is revised, corrected, or found to have been entered incorrectly. If that small data change causes large coefficient changes, interpretation may be sensitive to individual records. Ridge regression is often more stable than least squares in this setting, particularly when predictors are correlated or some directions in the design contain little information. The comparison is precise only after specifying what is held fixed: here, the predictor matrix, its preprocessing, and the penalty are fixed, and an outcome value is perturbed.

The central result is not that ridge makes every coefficient change smaller. It is that, under the stated fixed-design conditions, ridge reduces the overall sensitivity of the coefficient vector to response changes. Individual coordinates can behave differently, so a careful comparison uses the vector as well as its components.

Model and Perturbation Setup

Definition: Let \(X\) be an \(n\times p\) predictor matrix whose columns are centered, so that each column sums to zero. Let \(y\) be the response vector, and fit a model with an unpenalized intercept \(\alpha\). Under the ridge objective $$ \frac{1}{2}\|y-\alpha\mathbf{1}-X\beta\|^2+\frac{\lambda}{2}\|\beta\|^2,\qquad \lambda>0, $$ the fitted intercept is \(\hat{\alpha}=\bar{y}\), and the ridge slope estimate is $$ \hat{\beta}_{\lambda}=(X^\mathsf{T}X+\lambda I)^{-1}X^\mathsf{T}y. $$ The least-squares slope estimate, when \(X^\mathsf{T}X\) is invertible, is \(\hat{\beta}_{LS}=(X^\mathsf{T}X)^{-1}X^\mathsf{T}y\).

The factor of one half in the objective is a convention that leaves the stated penalty parameter \(\lambda\) in the normal equations as shown. In both fits, the intercept is not penalized. Centering the predictors makes the intercept equal to the response mean, and makes the slope equations independent of that intercept.

Suppose only response \(y_j\) changes, by an amount \(\Delta\). The design row for that observation is \(x_j^\mathsf{T}\), where \(x_j\) is a \(p\)-component column vector. Write \(G=X^\mathsf{T}X\). Since \(X^\mathsf{T}\mathbf{1}=0\), the centered response cross-product changes by \(\Delta x_j\). Therefore:

$$ \Delta\hat{\beta}_{\lambda} =\Delta(G+\lambda I)^{-1}x_j, \qquad \Delta\hat{\beta}_{LS} =\Delta G^{-1}x_j $$

These formulas compare the original and revised estimates with the same \(X\), preprocessing, and \(\lambda\). Least squares requires \(G\) to be invertible. Ridge requires only \(\lambda>0\) for the inverse in its formula to exist, including when predictors are linearly dependent. In that rank-deficient case, ordinary least-squares coefficients may not be unique, so the displayed least-squares comparison does not apply.

Worked Example: One Outcome Change in an Orthogonal Centered Design

A hypothetical four-record model has centered predictor columns \(x_1=(1,-1,1,-1)^\mathsf{T}\) and \(x_2=(0.5,0.5,-0.5,-0.5)^\mathsf{T}\). The outcomes are \(y=(3,1,2,0)^\mathsf{T}\). Use \(\lambda=1\), and then revise the first outcome upward by 2. Compare the least-squares and ridge slope estimates before and after the revision.

Method and design check. Both predictor columns sum to zero. Their squared lengths are \(4\) and \(1\), and their cross-product is \(0\), so $$ G=X^\mathsf{T}X= \begin{pmatrix}4&0\\0&1\end{pmatrix}. $$ The first design row is \(x_1^\mathsf{T}=(1,0.5)\). These row and Gram-matrix values come from the stated centered design.

Original fit. The response mean is \(\bar y=(3+1+2+0)/4=1.5\). The centered response is \((1.5,-0.5,0.5,-1.5)^\mathsf{T}\). Its cross-products with the two columns are $$ x_1^\mathsf{T}(y-\bar y\mathbf{1})=1.5+0.5+0.5+1.5=4, \qquad x_2^\mathsf{T}(y-\bar y\mathbf{1})=0.75-0.25-0.25+0.75=1. $$ Thus \(\hat\beta_{LS}=(4/4,1/1)^\mathsf{T}=(1,1)^\mathsf{T}\), while \(\hat\beta_\lambda=(4/5,1/2)^\mathsf{T}=(0.8,0.5)^\mathsf{T}\).

Changes and revised fits. Here \(\Delta=2\). The least-squares slope change is $$ 2G^{-1}x_1 =2\begin{pmatrix}1/4&0\\0&1\end{pmatrix} \begin{pmatrix}1\\0.5\end{pmatrix} =\begin{pmatrix}0.5\\1\end{pmatrix}. $$ The ridge slope change is $$ 2(G+I)^{-1}x_1 =2\begin{pmatrix}1/5&0\\0&1/2\end{pmatrix} \begin{pmatrix}1\\0.5\end{pmatrix} =\begin{pmatrix}0.4\\0.5\end{pmatrix}. $$ The revised slopes are therefore \((1.5,2)^\mathsf{T}\) for least squares and \((1.2,1.0)^\mathsf{T}\) for ridge. The intercept increases by \(2/4=0.5\) in either fit, from 1.5 to 2.

Check and trap avoided. The ridge change has Euclidean norm \(\sqrt{0.4^2+0.5^2}=\sqrt{0.41}\), approximately 0.6403; the least-squares change has norm \(\sqrt{0.5^2+1^2}=\sqrt{1.25}\), approximately 1.1180. The centered design is internally consistent: its stated columns produce both the stated Gram matrix and first row. A row value cannot be chosen independently of a column's centering and squared length.

Why Ridge Reduces Overall Sensitivity

The eigenvalues of \(G=X^\mathsf{T}X\) describe the information in different predictor directions. For a full-rank design, let \(G=QDQ^\mathsf{T}\), where \(Q\) is orthogonal and \(D\) is diagonal with positive entries \(d_1,\ldots,d_p\). In the direction associated with eigenvalue \(d_k\), a response perturbation's contribution to least-squares coefficients is multiplied by \(1/d_k\). Ridge instead multiplies it by \(1/(d_k+\lambda)\). Since \(d_k+\lambda>d_k\), the ridge multiplier is smaller in every such direction.

For a change to one record, this comparison can be made directly for the coefficient-vector norm. Let \(q_k\) be the \(k\)th eigenvector and write the design row as \(x_j=\sum_k c_k q_k\). The squared lengths of the two coefficient changes are:

$$ \|\Delta\hat{\beta}_{LS}\|^2 =\Delta^2\sum_{k=1}^p\frac{c_k^2}{d_k^2}, \qquad \|\Delta\hat{\beta}_{\lambda}\|^2 =\Delta^2\sum_{k=1}^p\frac{c_k^2}{(d_k+\lambda)^2}. $$

Each term in the ridge sum is no larger than the corresponding least-squares term. This proves that, for the same fixed full-rank design and the same single-outcome change, the ridge coefficient-change norm is no greater. The inequality is strict if the perturbation has a nonzero projection onto at least one design direction.

The reason for the result is visible in the normal equations: ridge adds \(\lambda I\) to the cross-product matrix. Directions with small \(d_k\), which amplify least-squares changes, receive substantial damping from that addition. This is a statement about sensitivity, not a proof that ridge predictions are always more accurate.

Worked Example: Correlated Predictors and a Coefficient-Wise Trap

Consider four centered records with columns \(x_1=(1,-1,1,-1)^\mathsf{T}\) and \(x_2=(2,0,0,-2)^\mathsf{T}\). The response is \(y=x_1\). Set \(\lambda=2\), then increase the first response by 1. Calculate both coefficient changes and check whether ridge reduces the change in every coefficient separately.

Method and design check. The columns are centered. Their squared lengths are 4 and 8, and their cross-product is 4. Thus \(G=\begin{pmatrix}4&4\\4&8\end{pmatrix}\), and the first row is \(x_j^\mathsf{T}=(1,2)\). The determinant of \(G\) is \(4(8)-4(4)=16\), so least squares is uniquely defined. Since \(y=x_1\), the original cross-product is \(X^\mathsf{T}y=(4,4)^\mathsf{T}\).

Original fits. For least squares, \(G^{-1}=\frac{1}{16}\begin{pmatrix}8&-4\\-4&4\end{pmatrix}\), giving \(\hat\beta_{LS}=(1,0)^\mathsf{T}\). For ridge, $$ G+2I=\begin{pmatrix}6&4\\4&10\end{pmatrix}, \qquad (G+2I)^{-1}=\frac{1}{44}\begin{pmatrix}10&-4\\-4&6\end{pmatrix}. $$ Multiplying this inverse by \((4,4)^\mathsf{T}\) gives \(\hat\beta_\lambda=(24/44,8/44)^\mathsf{T}=(6/11,2/11)^\mathsf{T}\).

Changes. The least-squares change is $$ G^{-1}x_j =\frac{1}{16}\begin{pmatrix}8&-4\\-4&4\end{pmatrix} \begin{pmatrix}1\\2\end{pmatrix} =\begin{pmatrix}0\\1/4\end{pmatrix}. $$ The ridge change is $$ (G+2I)^{-1}x_j =\frac{1}{44}\begin{pmatrix}10&-4\\-4&6\end{pmatrix} \begin{pmatrix}1\\2\end{pmatrix} =\begin{pmatrix}2/44\\8/44\end{pmatrix} =\begin{pmatrix}1/22\\2/11\end{pmatrix}. $$

Check and trap avoided. The least-squares change norm is \(1/4=0.25\). The ridge change norm is \(\sqrt{(1/22)^2+(2/11)^2}=\sqrt{17}/22\), approximately 0.1874, which is smaller. However, the first least-squares coefficient changes by zero while the first ridge coefficient changes by \(1/22\). It is incorrect to claim that ridge must reduce the absolute change in each coefficient separately. The valid comparison here is the norm of the full coefficient-change vector.

Worked Example: A Distributed Response Perturbation

Return to the centered four-record design with columns \(x_1=(1,-1,1,-1)^\mathsf{T}\) and \(x_2=(0.5,0.5,-0.5,-0.5)^\mathsf{T}\). Its Gram matrix is \(\operatorname{diag}(4,1)\). Suppose the response changes by \(\delta y=x_2\), with \(\lambda=1\). Find the change in each slope vector, compare their lengths, and check the result against the weakest design direction.

Method. This is a response-vector change across records, rather than a change to one record. The change has mean zero because the second predictor column is centered. Its squared length is \(0.25+0.25+0.25+0.25=1\), so \(\|\delta y\|=1\). Also, \(X^\mathsf{T}\delta y=(0,1)^\mathsf{T}\), because the columns are orthogonal and the second column has squared length 1.

Least-squares change. Multiplying by \(G^{-1}=\operatorname{diag}(1/4,1)\) gives $$ \delta\hat\beta_{LS} =\begin{pmatrix}1/4&0\\0&1\end{pmatrix} \begin{pmatrix}0\\1\end{pmatrix} =\begin{pmatrix}0\\1\end{pmatrix}. $$ Its norm is 1.

Ridge change. Since \(G+I=\operatorname{diag}(5,2)\), $$ \delta\hat\beta_{\lambda} =\begin{pmatrix}1/5&0\\0&1/2\end{pmatrix} \begin{pmatrix}0\\1\end{pmatrix} =\begin{pmatrix}0\\1/2\end{pmatrix}. $$ Its norm is 0.5. The change lies entirely in the direction with the smaller eigenvalue, \(d=1\); its least-squares multiplier is \(1\), while its ridge multiplier is \(1/(1+1)=0.5\). This verifies the formula and illustrates how the penalty damps a weakly informed direction.

Scope, Assumptions, and Common Exam Traps

For a general response change \(\delta y\), the slope changes are \(G^{-1}X^\mathsf{T}\delta y\) for least squares and \((G+\lambda I)^{-1}X^\mathsf{T}\delta y\) for ridge. The single-record formulas are the special case \(\delta y=\Delta e_j\), where \(e_j\) is the vector that is 1 at record \(j\) and 0 elsewhere. In the fixed full-rank design, the same eigenvalue argument shows that the ridge coefficient-change norm is no greater for any response perturbation.

These results do not directly describe changing a predictor value, adding or deleting a record, re-estimating \(\lambda\), or recalculating means and standard deviations used in preprocessing. Such changes alter more than the response cross-product: they can also alter \(X^\mathsf{T}X\), the design rows, the centering, or the penalty actually applied. A fixed-design response-perturbation formula should not be used as if it covered those cases.

  • Confusing overall stability with coordinate-wise shrinkage. Compare the coefficient-change vector or a specified prediction change; do not infer that each coordinate must move less.
  • Ignoring the intercept. With centered predictors and an unpenalized intercept, changing one response by \(\Delta\) changes the intercept by \(\Delta/n\), even as the slope changes follow the matrix formulas.
  • Using the wrong matrix. Ridge uses \(G+\lambda I\), not \(G-\lambda I\). The penalty increases the diagonal eigenvalues and reduces the response to perturbations.
  • Changing the problem silently. The comparisons hold \(\lambda\), the predictor matrix, and its preprocessing fixed. If those change, the displayed sensitivity calculation is incomplete.
Key takeaway: With a fixed, full-rank design and fixed penalty, ridge reduces the norm of the coefficient change caused by a response perturbation. It does so by damping each design-eigenvector direction, especially directions with small eigenvalues. This does not imply coordinate-by-coordinate stability or guarantee improved predictive accuracy.

Check Your Understanding

For each item, keep the design and penalty fixed unless the question says otherwise.

  1. In the centered design of Worked Example 1, the third response decreases by 0.4. With \(\lambda=1\), find the ridge slope change and intercept change. (Answer: \(\Delta\hat\beta_\lambda=(-0.08,0.10)^\mathsf{T}\); \(\Delta\hat\alpha=-0.10\).)
  2. In that same design, the second response increases by 1 and \(\lambda=3\). Find the ridge slope change. (Answer: \(\Delta\hat\beta_\lambda=(-1/7,1/8)^\mathsf{T}\).)
  3. For the centered correlated design in Worked Example 2, the first response decreases by 2, with \(\lambda=2\). Find the ridge and least-squares slope changes. (Answer: ridge \((-1/11,-4/11)^\mathsf{T}\); least squares \((0,-1/2)^\mathsf{T}\).)
  4. A full-rank design has every eigenvalue of \(G\) at least 4. A response-vector change has length 3, and \(\lambda=2\). Give valid upper bounds for the lengths of the ridge and least-squares coefficient changes. (Answer: ridge at most 1; least squares at most 1.5.)
  5. In Worked Example 2, does ridge reduce the absolute change of the first coefficient? Give the two changes and state the correct overall comparison. (Answer: no; least squares changes by 0 and ridge by \(1/22\), while the ridge coefficient-change vector has the smaller norm.)
Clinical Biostats