Tutorials › High-Dimensional Genomic Data Analysis › Elastic Net Objective and Limiting Cases

Penalized Regression for p Much Larger Than n · Tutorial 525 of 795

Elastic Net Objective and Limiting Cases

You will learn to write the elastic-net objective consistently, interpret its mixing and strength parameters, and verify how its endpoints reduce to lasso and ridge regression.

Advanced 11 min read

What You'll Learn

  • State the elastic-net objective with an unpenalized intercept and scaled predictors.
  • Translate between the mixing parameter and separate l1 and l2 penalty weights.
  • Derive the exact lasso and ridge objectives at the mixing-parameter endpoints.
  • Explain what convergence toward an endpoint does and does not imply about coefficients.
  • Calculate elastic-net objective values and an orthogonal-predictor solution.
  • Recognize parameterization errors and limitations of the penalized fit.

Why Combine the Two Penalties?

In high-dimensional regression, predictors can be numerous and strongly correlated. Ridge regression penalizes squared coefficient size, while lasso regression penalizes absolute coefficient size. The elastic net combines these two penalties in one objective. Its mixing parameter determines their relative contribution, and its strength parameter controls the overall amount of penalization.

The aim here is to define that objective precisely and examine its endpoint cases. The word “limiting” can refer either to setting the mixing parameter exactly at an endpoint or to approaching it through a sequence of fits. The objectives at the endpoints are exact; statements about the corresponding coefficient estimates need more care when the lasso solution is not unique.

Definition and Conventions

Let \(y\in\mathbb{R}^n\) be a response vector and \(X\in\mathbb{R}^{n\times p}\) a predictor matrix. Write \(\beta\in\mathbb{R}^p\) for the slope coefficients and \(\beta_0\) for an intercept. Assume the columns of \(X\) have been centered and scaled before penalization, and that \(y\) has been centered if an intercept is included. The intercept is not penalized; with centered data it can be handled separately. Penalizing unscaled predictors can make the penalty depend on measurement units rather than on the intended coefficient shrinkage.

Definition: For penalty strength \(\lambda\geq 0\) and mixing parameter \(\alpha\in[0,1]\), the elastic-net estimate minimizes $$ \frac{1}{2n}\lVert y-\beta_0\mathbf{1}-X\beta\rVert_2^2 +\lambda\alpha\lVert\beta\rVert_1 +\frac{\lambda(1-\alpha)}{2}\lVert\beta\rVert_2^2. $$ Here \(\lVert\beta\rVert_1=\sum_{j=1}^p|\beta_j|\) and \(\lVert\beta\rVert_2^2=\sum_{j=1}^p\beta_j^2\). The squared-error term is the loss; the remaining terms are the l1 and l2 penalties.

This convention is also written using separate nonnegative penalty weights \(\lambda_1=\lambda\alpha\) and \(\lambda_2=\lambda(1-\alpha)\). The objective then has penalty \(\lambda_1\lVert\beta\rVert_1+\lambda_2\lVert\beta\rVert_2^2/2\). The factor \(1/2\) in the l2 term and the factor \(1/(2n)\) in the loss are part of the convention: changing them changes the numerical interpretation of the penalty parameters.

The optimization definition does not require normally distributed errors. It specifies a penalized least-squares fit. A linear prediction model is often used to motivate it, but the minimizer is defined by the displayed objective whether or not a probabilistic error model is adopted. If \(\lambda=0\), both penalty terms vanish. If \(\lambda>0\), \(\alpha=1\) gives a pure l1 penalty and \(\alpha=0\) a pure l2 penalty.

Worked Example: Calculating the Objective at a Candidate Fit

Consider hypothetical centered data with \(n=3\), response \(y=(1,-1,0)^\mathsf{T}\), predictor columns \(x_1=(1,-1,0)^\mathsf{T}\) and \(x_2=(0,1,-1)^\mathsf{T}\), and candidate coefficients \(\beta=(0.4,-0.2)^\mathsf{T}\). Take \(\beta_0=0\), \(\lambda=0.5\), and \(\alpha=0.6\). Both predictor columns are centered and have the same length, so their relative scales are matched for this illustration.

The fitted values are \(X\beta=(0.4,-0.6,0.2)^\mathsf{T}\), so the residuals are \(y-X\beta=(0.6,-0.4,-0.2)^\mathsf{T}\). The residual sum of squares is \(0.6^2+(-0.4)^2+(-0.2)^2=0.56\), and the loss is \(0.56/(2\cdot3)=0.09333\).

The l1 and squared l2 summaries are \(\lVert\beta\rVert_1=0.4+0.2=0.6\) and \(\lVert\beta\rVert_2^2=0.4^2+(-0.2)^2=0.20\). The separate penalty weights are \(\lambda_1=0.5(0.6)=0.30\) and \(\lambda_2=0.5(0.4)=0.20\). Thus the l1 penalty is \(0.30(0.6)=0.18\), and the l2 penalty is \((0.20/2)(0.20)=0.02\). The full objective at this candidate is \(0.09333+0.18+0.02=0.2933\). This is the objective value at the stated coefficients, not evidence that they minimize it.

Deriving the Limiting Cases

The endpoint identities follow directly by substitution. At \(\alpha=1\), the l2 weight \(\lambda(1-\alpha)\) is zero and the l1 weight is \(\lambda\). At \(\alpha=0\), the l1 weight \(\lambda\alpha\) is zero and the l2 weight is \(\lambda\). Therefore, for fixed \(\lambda\), the endpoints are respectively the lasso and ridge objectives, under the loss and penalty scaling used here.

$$ \begin{aligned} \alpha=1:\quad& \frac{1}{2n}\lVert y-\beta_0\mathbf{1}-X\beta\rVert_2^2 +\lambda\lVert\beta\rVert_1, \\ \alpha=0:\quad& \frac{1}{2n}\lVert y-\beta_0\mathbf{1}-X\beta\rVert_2^2 +\frac{\lambda}{2}\lVert\beta\rVert_2^2. \end{aligned} $$

The derivation also makes clear why the parameter convention matters. If the objective had used \(\lambda(1-\alpha)\lVert\beta\rVert_2^2\) without the factor \(1/2\), its ridge endpoint would correspond to a different penalty strength from the convention above. The lasso endpoint would be unchanged, but comparisons of numerical \(\lambda\) values would not be.

The exact endpoint objectives are straightforward; the behavior of minimizing coefficients as \(\alpha\) approaches an endpoint has a qualification. A short justification for the lasso endpoint is useful. Set \(\beta_0=0\) after centering and write the objective as \(f_\alpha(\beta)\). For fixed \(\lambda>0\), \(f_\alpha(\beta)\) converges to the lasso objective \(f_1(\beta)\) for every fixed \(\beta\) as \(\alpha\) tends to 1. If \(\hat{\beta}_\alpha\) minimizes \(f_\alpha\), then \(f_\alpha(\hat{\beta}_\alpha)\leq f_\alpha(0)=\lVert y\rVert_2^2/(2n)\). For \(\alpha\geq 1/2\), the penalty includes at least \((\lambda/2)\lVert\hat{\beta}_\alpha\rVert_1\). Consequently, the minimizing coefficients are bounded. Any convergent subsequence has a limit \(\tilde{\beta}\). For any fixed candidate \(\beta^*\), optimality gives \(f_\alpha(\hat{\beta}_\alpha)\leq f_\alpha(\beta^*)\); taking limits along that subsequence gives \(f_1(\tilde{\beta})\leq f_1(\beta^*)\). Since this holds for every \(\beta^*\), \(\tilde{\beta}\) minimizes the lasso objective. If that objective has multiple minimizers, this argument does not select a unique one.

Worked Example: The Mixing Parameter With Orthogonal Predictors

Suppose the centered, scaled predictors satisfy \(X^\mathsf{T}X/n=I\), where \(I\) is the identity matrix, and define \(z_j=x_j^\mathsf{T}y/n\). Ignoring terms that do not depend on \(\beta_j\), the objective for coordinate \(j\) is $$ \frac{1}{2}(\beta_j-z_j)^2+\lambda\alpha|\beta_j|+\frac{\lambda(1-\alpha)}{2}\beta_j^2. $$

For \(z_j>0\), a positive minimizer satisfies the derivative equation \((\beta_j-z_j)+\lambda\alpha+\lambda(1-\alpha)\beta_j=0\). Solving gives \(\beta_j=(z_j-\lambda\alpha)/(1+\lambda(1-\alpha))\) when \(z_j>\lambda\alpha\); otherwise the minimum is zero. By symmetry for negative \(z_j\), the full solution is $$ \hat{\beta}_j= \frac{\operatorname{sign}(z_j)(|z_j|-\lambda\alpha)_+}{1+\lambda(1-\alpha)}, $$ where \((u)_+=\max(u,0)\).

For a hypothetical coordinate with \(z_j=1.2\), \(\lambda=0.5\), and \(\alpha=0.4\), the numerator is \(1.2-0.5(0.4)=1.0\), and the denominator is \(1+0.5(0.6)=1.3\). Thus \(\hat{\beta}_j=1.0/1.3=0.7692\). At the lasso endpoint \(\alpha=1\), the same \(z_j\) and \(\lambda\) give \(1.2-0.5=0.7000\). At the ridge endpoint \(\alpha=0\), they give \(1.2/(1+0.5)=0.8000\). The hybrid solution lies between these endpoint values in this particular example; that ordering is not a general rule for arbitrary correlated designs.

What the Endpoints Do—and Do Not—Guarantee

For \(\lambda>0\) and \(\alpha<1\), the positive l2 penalty makes the objective strictly convex in \(\beta\), so the slope-coefficient minimizer is unique after handling the intercept separately. At \(\alpha=1\), the lasso objective is convex but need not have a unique coefficient minimizer when predictors are collinear. Even if different coefficient vectors minimize the lasso objective, their fitted values are unique for squared-error loss: two distinct fitted vectors would have a midpoint with strictly smaller squared-error loss, while the l1 penalty is convex. The limiting objective therefore identifies the lasso problem, but it does not necessarily identify a single coefficient vector as \(\alpha\) approaches 1.

At \(\alpha=0\) and \(\lambda>0\), the ridge objective is strictly convex in the slopes, including when \(p>n\), and therefore has a unique slope minimizer. When \(\lambda=0\), neither endpoint is a penalized fit: the problem is ordinary least squares, whose coefficients may not be unique if the design matrix is rank deficient. These distinctions matter in high-dimensional settings, where \(p>n\) makes rank deficiency possible.

An elastic-net fit is not automatically a good fit just because its objective is well-defined. Diagnostics should include whether predictor scaling was appropriate, whether the response and fitted values are being compared on the intended scale, and whether the reported \(\lambda\) and \(\alpha\) match the stated convention. Large changes in selected coefficients under small data or tuning changes may signal instability; a single optimized coefficient vector does not establish that a gene is biologically causal. Predictive performance and tuning choices require their own assessment.

Worked Example: Comparing Penalty Contributions at the Endpoints

Suppose a hypothetical candidate fit has \(n=5\), residual vector \((1,-1,0,0,0)^\mathsf{T}\), and coefficients \(\beta=(0.3,-0.4)^\mathsf{T}\). The loss is \((1^2+(-1)^2)/(2\cdot5)=2/10=0.20\). Also, \(\lVert\beta\rVert_1=0.3+0.4=0.7\) and \(\lVert\beta\rVert_2^2=0.3^2+(-0.4)^2=0.25\).

Take \(\lambda=0.8\). With \(\alpha=0.25\), the penalty is \(0.8(0.25)(0.7)+[0.8(0.75)/2](0.25)=0.14+0.075=0.215\), so the objective is \(0.20+0.215=0.415\). At \(\alpha=1\), the lasso penalty at this same candidate is \(0.8(0.7)=0.56\), giving objective \(0.76\). At \(\alpha=0\), the ridge penalty is \((0.8/2)(0.25)=0.10\), giving objective \(0.30\). These are objective values at one fixed candidate, not a comparison of the optimized endpoint fits: the minimizing coefficients can change with \(\alpha\).

Comparison, Limitations, and a Common Pitfall

ChoicePenalty in this conventionWhat the endpoint means
\(\alpha=1\)\(\lambda\lVert\beta\rVert_1\)Lasso objective; some coefficients can be exactly zero.
\(\alpha=0\)\(\lambda\lVert\beta\rVert_2^2/2\)Ridge objective; coefficients are shrunk, but the penalty alone does not set them exactly to zero.
\(0<\alpha<1\)\(\lambda\alpha\lVert\beta\rVert_1+\lambda(1-\alpha)\lVert\beta\rVert_2^2/2\)Both penalties act; the l1 component can produce zeros and the l2 component contributes continuous shrinkage.

The lasso and ridge endpoints are alternatives with distinct penalty structures, not different names for a single fit. The elastic net provides intermediate mixtures, but the mixing parameter alone does not determine the amount of regularization: \(\lambda\) also matters. Nor does an intermediate \(\alpha\) guarantee improved prediction or more scientifically meaningful selection. The objective defines the estimator; assessing performance and selecting tuning values are separate tasks.

A common mistake is to say that \(\alpha=0\) removes regularization because the l1 component vanishes. The correction is that only the l1 component vanishes: the l2 penalty remains with weight \(\lambda\). Both penalties disappear only when \(\lambda=0\). Another frequent error is to report an \(\alpha\) value without specifying the objective convention, making the associated penalty weights ambiguous.

Key takeaway: With the convention used here, \(\lambda_1=\lambda\alpha\) and \(\lambda_2=\lambda(1-\alpha)\). Setting \(\alpha=1\) gives lasso; setting \(\alpha=0\) gives ridge with penalty \(\lambda\lVert\beta\rVert_2^2/2\). State the scaling convention whenever reporting penalty values.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. For \(\lambda=2\) and \(\alpha=0.3\), what are the separate l1 and l2 weights?
  2. If \(\alpha=0\) and \(\lambda>0\), which penalty remains? Does its objective endpoint equal ordinary least squares?
  3. For \(\beta=(1,-2)^\mathsf{T}\), \(\lambda=0.4\), and \(\alpha=0.5\), calculate the total penalty.
  4. Why does approaching the lasso endpoint not always imply convergence to one uniquely determined coefficient vector?

Solutions. 1. \(\lambda_1=\lambda\alpha=2(0.3)=0.6\), and \(\lambda_2=\lambda(1-\alpha)=2(0.7)=1.4\); the l2 term is multiplied by \(\lVert\beta\rVert_2^2/2\). 2. The l2 penalty \(\lambda\lVert\beta\rVert_2^2/2\) remains, so the objective is ridge, not ordinary least squares; ordinary least squares results when \(\lambda=0\). 3. Here \(\lVert\beta\rVert_1=3\) and \(\lVert\beta\rVert_2^2=1+4=5\). The total penalty is \(0.4(0.5)(3)+[0.4(0.5)/2](5)=0.60+0.50=1.10\). 4. The lasso objective can have multiple minimizing coefficient vectors under collinearity. Endpoint convergence identifies lasso minimizers, but does not by itself choose a unique coefficient vector when there is more than one.

Clinical Biostats