Tutorials › Generalized Linear Models › Penalized Likelihood Objectives for GLMs

Penalized GLM Estimation · Tutorial 899 of 981

Penalized Likelihood Objectives for GLMs

Learn how GLM likelihoods and coefficient penalties combine into ridge, lasso, and elastic-net objectives, and what changing their tuning parameters does.

Advanced 9 min read

What You'll Learn

  • Express a GLM fit as a negative log-likelihood plus a coefficient penalty
  • Distinguish ridge, lasso, and elastic-net penalty terms
  • Interpret the roles of the overall penalty strength and the elastic-net mixing parameter
  • Calculate penalized objectives for logistic and Poisson model candidates
  • Prove how increasing penalty strength affects fit loss and penalty size at minimizers
  • Recognize why likelihood scaling changes the numerical meaning of a tuning parameter

From Likelihood to a Penalized Objective

Ordinary likelihood estimation chooses coefficients to make the observed data as likely as possible under a specified model. In a generalized linear model (GLM), a penalty modifies that goal: it asks for a good likelihood fit while also discouraging large coefficient values. The resulting objective makes the trade-off explicit, rather than treating fit and coefficient size as separate considerations.

Suppose \(Y_1,\ldots,Y_n\) are independent responses, and the GLM specifies a model for each response distribution through its linear predictor. Write \(\beta=(\beta_0,\beta_1,\ldots,\beta_p)\) for the intercept and \(p\) slopes, and let \(\ell(\beta)\) be the log-likelihood of the observed responses under that model. The likelihood can be based on probability mass functions for discrete responses or densities for continuous responses.

Definition: The negative log-likelihood is \(L(\beta)=-\ell(\beta)\). A penalized likelihood objective has the form $$ Q(\beta)=L(\beta)+\lambda P(\beta), $$ where \(P(\beta)\) is a nonnegative coefficient penalty and \(\lambda\geq 0\) controls its strength. A penalized estimate is a minimizer of \(Q(\beta)\), when a minimizer exists.

This tutorial uses the common convention that the intercept is not penalized, so the penalties below act on \(\beta_1,\ldots,\beta_p\) and not \(\beta_0\). The exact scaling of the likelihood and penalty, and the treatment of intercepts, must be specified when implementing or comparing objectives. Here the loss is the total negative log-likelihood, not its average.

Three Standard Coefficient Penalties

The three penalties differ in how they measure coefficient size. Let \(\alpha\) be a mixing parameter between 0 and 1. The objectives, under the convention just stated, are:

$$ \begin{aligned} Q_{\mathrm{ridge}}(\beta;\lambda) &=L(\beta)+\frac{\lambda}{2}\sum_{j=1}^{p}\beta_j^2,\\ Q_{\mathrm{lasso}}(\beta;\lambda) &=L(\beta)+\lambda\sum_{j=1}^{p}|\beta_j|,\\ Q_{\mathrm{EN}}(\beta;\lambda,\alpha) &=L(\beta)+\lambda\left\{\alpha\sum_{j=1}^{p}|\beta_j| +\frac{1-\alpha}{2}\sum_{j=1}^{p}\beta_j^2\right\}. \end{aligned} $$

The ridge penalty uses squared coefficients. The lasso penalty uses absolute values. The elastic-net penalty combines both: with this definition, \(\alpha=1\) gives the lasso objective and \(\alpha=0\) gives the ridge objective. These endpoint identities are useful checks on the parameterization; other sources sometimes reverse the convention for the mixing parameter.

The penalty is applied to coefficients, not directly to the observed responses. It therefore changes which coefficient vectors are preferred, while the likelihood continues to describe the data under the stated GLM. A zero penalty strength, \(\lambda=0\), recovers ordinary maximum likelihood whenever a maximum exists. For positive \(\lambda\), a candidate with a worse likelihood can still have a lower penalized objective if it has a sufficiently smaller penalty.

Worked Example: A Logistic-Regression Candidate

Take three independent Bernoulli responses with \(x=(0,1,2)\) and \(y=(1,0,1)\). Use the logistic model \(P(Y_i=1)=\exp(\eta_i)/(1+\exp(\eta_i))\), where \(\eta_i=\beta_0+\beta_1x_i\). Evaluate the candidate \(\beta_0=0,\ \beta_1=\log 2\). The three fitted probabilities are \(1/2,\ 2/3,\ 4/5\).

The observed likelihood at this candidate is $$ L_{\mathrm{lik}}=\frac12\left(1-\frac23\right)\frac45 =\frac12\cdot\frac13\cdot\frac45=\frac{2}{15}. $$ Thus the negative log-likelihood is \(L(\beta)=-\log(2/15)=\log(15/2)\), approximately \(2.0149\).

For \(\lambda=1/2\), the ridge penalty is \((\lambda/2)\beta_1^2=(1/4)(\log 2)^2\), approximately \(0.1201\). The ridge objective at the candidate is therefore \(\log(15/2)+(1/4)(\log 2)^2\), approximately \(2.1350\). The lasso penalty is \(\lambda|\beta_1|=(1/2)\log 2\), approximately \(0.3466\), giving a lasso objective of approximately \(2.3615\). These are objective values for one candidate, not claims that this candidate minimizes either objective.

Worked Example: A Poisson-Regression Candidate

Suppose \(Y_1,Y_2\) are independent Poisson responses with means \(\mu_i=\exp(\beta_0+\beta_1x_i)\). Let \(x=(0,1)\), \(y=(0,2)\), and evaluate \(\beta_0=0,\ \beta_1=\log 2\). The fitted means are \(\mu_1=1\) and \(\mu_2=2\).

For a Poisson response, the log-likelihood contribution for observation \(i\) is \(y_i\log(\mu_i)-\mu_i-\log(y_i!)\). Consequently, $$ \ell(\beta)=\{0\log(1)-1-\log(0!)\} +\{2\log(2)-2-\log(2!)\} =-1+2\log 2-2-\log 2 =-3+\log 2. $$

The negative log-likelihood is \(3-\log 2\), approximately \(2.3069\). With \(\lambda=1\), the lasso objective at this candidate is \(3-\log 2+|\log 2|=3\). The intercept is not included in the penalty. This calculation illustrates that the same coefficient penalty can be combined with a different GLM likelihood without changing the basic objective structure.

Worked Example: Separating Elastic-Net Strength From Its Mix

Consider a candidate slope vector \((\beta_1,\beta_2)=(0.6,-0.8)\). Its absolute-value sum is \(0.6+0.8=1.4\), and its squared-value sum is \(0.6^2+(-0.8)^2=0.36+0.64=1\). The ridge-form component, including its factor \(1/2\), is therefore \(0.5\).

Set \(\alpha=0.25\) and \(\lambda=2\). The elastic-net penalty is $$ 2\left\{0.25(1.4)+\frac{0.75}{2}(1)\right\} =2(0.35+0.375)=1.45. $$ If the negative log-likelihood at this candidate is \(10\), its full objective is \(10+1.45=11.45\).

Keeping the same candidate and \(\alpha\), but reducing \(\lambda\) to \(0.5\), gives penalty \(0.5(0.725)=0.3625\) and objective \(10.3625\). The mixing parameter sets the relative contributions of the two penalty forms; \(\lambda\) multiplies their combined contribution.

What the Tuning Parameters Control

For ridge and lasso, \(\lambda\) controls the overall weight assigned to the penalty. In the elastic net, \(\lambda\) has the same role, while \(\alpha\) controls the mix of absolute-value and squared-coefficient penalties. At fixed \(\alpha\), increasing \(\lambda\) makes penalty size more important relative to negative log-likelihood. It does not mean that the fitted likelihood itself is multiplied by a smaller number.

The numerical value of \(\lambda\) depends on objective scaling. For example, replacing total negative log-likelihood \(L(\beta)\) with its average \(L(\beta)/n\) while leaving the penalty unchanged changes the relative weighting. In fact, $$ L(\beta)+\lambda P(\beta) =n\left\{\frac{L(\beta)}{n}+\frac{\lambda}{n}P(\beta)\right\}. $$ The outer factor \(n\) does not change the minimizer, so the equivalent average-loss formulation uses penalty strength \(\lambda/n\). Thus a reported \(\lambda\) is not interpretable without knowing how the loss and penalty were scaled.

Theorem: Fix a penalty \(P(\beta)\). Suppose that for two values \(0\leq\lambda_1<\lambda_2\), minimizers \(\hat\beta_1\) and \(\hat\beta_2\) of \(L(\beta)+\lambda P(\beta)\) exist over the same parameter space. Then $$ P(\hat\beta_2)\leq P(\hat\beta_1) \quad\text{and}\quad L(\hat\beta_2)\geq L(\hat\beta_1). $$

This result describes the trade-off across global minimizers: increasing the penalty strength cannot increase the penalty value at the chosen minimizer, and cannot improve the negative log-likelihood. It does not claim that every individual coefficient must decrease in magnitude. It also compares minimizers of the same loss and penalty on the same parameter space; it does not compare different mixing parameters or differently scaled objectives.

Proof. Write \(P_k=P(\hat\beta_k)\) and \(L_k=L(\hat\beta_k)\). Since each estimate minimizes its own objective, using the other estimate as a competitor gives $$ L_1+\lambda_1P_1\leq L_2+\lambda_1P_2, \qquad L_2+\lambda_2P_2\leq L_1+\lambda_2P_1. $$ Adding the inequalities yields \((\lambda_2-\lambda_1)(P_2-P_1)\leq 0\). Because \(\lambda_2-\lambda_1>0\), \(P_2\leq P_1\). The first inequality also gives \(L_2-L_1\geq\lambda_1(P_1-P_2)\geq 0\), since \(\lambda_1\geq0\). Hence \(L_2\geq L_1\). \(\square\)

Reading an Objective Without Overinterpreting It

The objective is a definition of what the fitting procedure optimizes. It is not, by itself, a guarantee that the resulting model predicts better on new data, that a particular coefficient is scientifically important, or that the selected tuning parameter is appropriate. Those questions require additional analysis. For the purpose of specifying the estimation problem, keep three elements distinct: the GLM likelihood, the chosen penalty form, and the numerical scaling and tuning parameters.

A common mistake is to say that a larger \(\lambda\) always makes every fitted coefficient smaller. The theorem above establishes a comparison of total penalty values, not a coordinate-by-coordinate ordering. In the lasso, for example, a change in one coefficient can be offset by a change in another while the total absolute-value penalty falls. Nor does the theorem guarantee a unique minimizer. The correction is to describe \(\lambda\) as controlling the likelihood–penalty trade-off and to state precisely which quantity is known to move monotonically.

A second mistake is to identify elastic-net \(\alpha\) as the overall amount of regularization. In the defined objective, \(\lambda\) multiplies the penalty as a whole; \(\alpha\) changes its composition. Finally, omitting the factor \(1/2\) from the ridge component changes the numerical scaling of that component and therefore changes how a given \(\lambda\) should be interpreted.

Key takeaway: A penalized GLM objective is negative log-likelihood plus a specified nonnegative coefficient penalty. Ridge, lasso, and elastic net differ in that penalty; \(\lambda\) controls its overall weight, while elastic-net \(\alpha\) controls the mixture. Always check the objective's exact scaling before interpreting tuning values.

Check Your Understanding

Use the objective definitions and conventions in this tutorial.

  1. Write the elastic-net penalty when \(\alpha=0\), and identify the corresponding objective.
  2. For slopes \((1,-2)\), calculate the lasso penalty and the ridge penalty when \(\lambda=1\).
  3. Why can the numerical value of \(\lambda\) not be compared directly between an objective using total negative log-likelihood and one using average negative log-likelihood?
  4. State both monotonic comparisons in the theorem for minimizers at \(\lambda_1<\lambda_2\).
  5. Does a lower total penalty at the larger tuning parameter prove that every coefficient has smaller absolute value? Explain.
Clinical Biostats