Tutorials › Generalized Linear Models › Firth’s Jeffreys-Penalized Likelihood

Bias Reduction and Separation · Tutorial 926 of 981

Firth's Jeffreys-Penalized Likelihood

Learn to construct Firth’s Jeffreys-penalized logistic objective, calculate it in simple models, and distinguish invariance of the Jeffreys measure from invariance of a coordinate-dependent density mode.

Advanced 10 min read

What You'll Learn

  • Write the expected information matrix for a full-rank logistic-regression design
  • Derive the half-log-determinant penalty and identify which terms depend on the coefficients
  • Calculate Firth estimates in intercept-only and saturated grouped examples
  • Explain how the Jeffreys measure transforms under a smooth change of coordinates
  • Recognize why invariance of a measure does not imply invariance of every density mode

From Logistic Likelihood to an Information-Based Penalty

In logistic regression, the ordinary log-likelihood measures how well a coefficient vector explains the observed binary outcomes. In small or sparse samples, maximizing that likelihood can produce estimates with substantial bias, and the likelihood may not have a finite maximizer. Firth’s method modifies the likelihood using the model’s expected information. The resulting adjustment is not an arbitrary fixed penalty on the coefficients: its value depends on how much information the model has at each parameter value.

This tutorial develops the objective itself. Let \(Y_1,\ldots,Y_n\) be independent Bernoulli responses with fixed covariate vectors \(x_i\in\mathbb R^p\), and suppose \(\operatorname{logit}(P(Y_i=1\mid x_i))=x_i^\mathsf{T}\beta\), where \(\beta\in\mathbb R^p\). Write \(p_i=P(Y_i=1\mid x_i)\), so \(p_i=\exp(x_i^\mathsf{T}\beta)/\{1+\exp(x_i^\mathsf{T}\beta)\}\). Assume the design matrix \(X\), whose \(i\)th row is \(x_i^\mathsf{T}\), has full column rank. Then the expected information is positive definite for every finite \(\beta\), and its determinant is positive.

Definition: For a model with log-likelihood \(\ell(\theta)\) and positive-definite expected Fisher information matrix \(I(\theta)\), the Jeffreys-penalized log-likelihood is \(\ell_J(\theta)=\ell(\theta)+\tfrac12\log|I(\theta)|\). In logistic regression, this is Firth’s Jeffreys-penalized objective. Terms constant in \(\theta\) may be omitted when maximizing it.

The absolute determinant measures the volume of information across parameter directions. The logarithm converts that volume factor into an additive term on the log-likelihood scale. In the logistic model, the expected information has a particularly direct form. Let \(W\) be the diagonal matrix with entries \(p_i(1-p_i)\). Then \(I(\beta)=X^\mathsf{T}WX\), and hence the objective is \(\ell_J(\beta)=\ell(\beta)+\tfrac12\log|X^\mathsf{T}WX|\).

$$ \ell(\beta)=\sum_{i=1}^n\left\{y_i x_i^\mathsf{T}\beta-\log\!\left(1+\exp(x_i^\mathsf{T}\beta)\right)\right\}, \qquad I(\beta)=X^\mathsf{T}WX, \qquad \ell_J(\beta)=\ell(\beta)+\frac12\log|X^\mathsf{T}WX|. $$

The likelihood formula omits only terms that do not depend on \(\beta\). To see why the information takes this form, the derivative of the \(i\)th log-likelihood contribution with respect to its linear predictor is \(y_i-p_i\), and its second derivative is \(-p_i(1-p_i)\). Since the covariates are fixed, taking the negative expected Hessian gives \(\sum_i p_i(1-p_i)x_ix_i^\mathsf{T}=X^\mathsf{T}WX\). Full column rank of \(X\) and positivity of every \(p_i(1-p_i)\) at finite coefficients ensure positive definiteness: for nonzero \(v\), \(v^\mathsf{T}X^\mathsf{T}WXv=(Xv)^\mathsf{T}W(Xv)>0\).

Worked Calculations

Worked Example: An Intercept-Only Model With No Successes

Suppose \(n=4\) independent responses share the same success probability \(p\), and all four observed responses are zero. Use the logit parameter \(\beta=\log\{p/(1-p)\}\). The ordinary log-likelihood, up to a parameter-free constant, is \(4\log(1-p)\). The expected information for \(\beta\) is \(4p(1-p)\). Therefore

$$ \ell_J(p)=4\log(1-p)+\frac12\log\{4p(1-p)\} =\frac12\log p+\frac92\log(1-p)+\frac12\log 4. $$

For \(0<p<1\), differentiate with respect to \(p\): \(\ell_J'(p)=\tfrac{1}{2p}-\tfrac{9}{2(1-p)}\). Setting this to zero gives \(1-p=9p\), so \(p=0.1\). The second derivative is \(-1/(2p^2)-9/\{2(1-p)^2\}<0\) throughout the interval, so this is the unique maximum. In the logit parameter, the estimate is \(\hat\beta=\log(0.1/0.9)=\log(1/9)\). The half-log-information term has changed the objective from one whose supremum occurs as \(p\) approaches zero to one with an interior maximizer.

Worked Example: Two Separate Binomial Groups

Consider two groups with separate success probabilities \(p_0,p_1\), each represented by its own logit parameter. Group 0 has one success and two failures; group 1 has three successes and one failure. For group \(j\), let \(y_j\) be the number of successes, \(m_j\) the number of failures, and \(n_j=y_j+m_j\). In this saturated model the information matrix for the two logits is diagonal, with entries \(n_jp_j(1-p_j)\). Its determinant is their product.

$$ \ell_J =\sum_{j=0}^1 \left\{ \left(y_j+\frac12\right)\log p_j+ \left(m_j+\frac12\right)\log(1-p_j) \right\} +\frac12\sum_{j=0}^1\log n_j. $$

For group 0, \(y_0=1\) and \(m_0=2\). Thus its coefficient of \(\log p_0\) is \(1+\tfrac12=1.5\), while its coefficient of \(\log(1-p_0)\) is \(2+\tfrac12=2.5\). For group 1, \(y_1=3\) and \(m_1=1\), giving coefficients \(3.5\) and \(1.5\), respectively. In particular, the failure count of two in group 0 contributes \(2.5\), not \(1.5\), to the second coefficient.

For a term \(a\log p+b\log(1-p)\) with \(a,b>0\), differentiating gives \(a/p-b/(1-p)\). Its unique maximum is at \(p=a/(a+b)\), since the second derivative is \(-a/p^2-b/(1-p)^2<0\). Applying this calculation separately to the two groups gives \(\hat p_0=1.5/(1.5+2.5)=3/8=0.375\) and \(\hat p_1=3.5/(3.5+1.5)=3.5/5=0.7\).

Worked Example: A Two-Parameter Logistic Design

Take two observations with covariate rows \(x_1^\mathsf{T}=(1,0)\) and \(x_2^\mathsf{T}=(1,1)\), and outcomes \(y_1=1,y_2=0\). The fitted probabilities are \(p_1=\operatorname{logit}^{-1}(\beta_0)\) and \(p_2=\operatorname{logit}^{-1}(\beta_0+\beta_1)\). Here \(X\) has determinant 1, and direct calculation gives \(|X^\mathsf{T}WX|=p_1(1-p_1)p_2(1-p_2)\).

$$ \ell_J =\log p_1+\log(1-p_2) +\frac12\log\{p_1(1-p_1)p_2(1-p_2)\} =\frac32\log p_1+\frac12\log(1-p_1) +\frac12\log p_2+\frac32\log(1-p_2). $$

The expression separates into a function of \(p_1\) and a function of \(p_2\). Using the maximizer \(a/(a+b)\) derived above gives \(\hat p_1=1.5/(1.5+0.5)=0.75\) and \(\hat p_2=0.5/(0.5+1.5)=0.25\). Therefore \(\hat\beta_0=\log\{0.75/0.25\}=\log 3\), and \(\hat\beta_1=\log\{0.25/0.75\}-\log\{0.75/0.25\}=-\log 3-\log 3=-2\log 3\). The determinant calculation matters: replacing the information by a product that ignored the design would not, in general, give the stated objective.

Why the Penalty Is Connected to Jeffreys

Jeffreys’s rule associates a prior measure with expected information. In coordinates \(\theta\in\mathbb R^p\), its density with respect to ordinary coordinate volume is proportional to \(|I(\theta)|^{1/2}\). Multiplying the likelihood by this density and taking logarithms gives \(\ell(\theta)+\tfrac12\log|I(\theta)|\), up to an additive constant. This explains the name and construction of Firth’s objective. It does not mean that a fixed quadratic or absolute-value penalty has been added to the coefficients.

Theorem: Suppose \(\theta=g(\gamma)\) is a differentiable one-to-one change of coordinates with nonsingular Jacobian \(J(\gamma)=\partial\theta/\partial\gamma\). If the information in the \(\theta\) coordinates is \(I_\theta(\theta)\), then \(I_\gamma(\gamma)=J(\gamma)^\mathsf{T}I_\theta(g(\gamma))J(\gamma)\). Consequently, Jeffreys’s density times coordinate volume represents the same measure in either coordinate system.

To verify the result, the score in the \(\gamma\) coordinates is \(J^\mathsf{T}\) times the score in the \(\theta\) coordinates, by the chain rule. Taking the expected outer product of the scores, or equivalently transforming the information as a quadratic form, yields the displayed identity. The determinant product rule then gives \[ |I_\gamma(\gamma)|^{1/2} =|J(\gamma)|\,|I_\theta(g(\gamma))|^{1/2}, \] where \(|J|\) denotes the absolute value of the Jacobian determinant. The change-of-variables formula for integration is \(d\theta=|J(\gamma)|\,d\gamma\). Thus \(|I_\theta(\theta)|^{1/2}d\theta =|I_\gamma(\gamma)|^{1/2}d\gamma\), which proves the measure is the same under the coordinate change. \(\square\)

There is an important distinction between invariance of this measure and invariance of the mode of a density. In the new coordinates, the log-likelihood plus the log Jeffreys density is \(\ell(g(\gamma))+\tfrac12\log|I_\gamma(\gamma)|\). By the determinant identity, this equals \(\ell(g(\gamma))+\tfrac12\log|I_\theta(g(\gamma))|+\log|J(\gamma)|\). If the Jacobian determinant varies with \(\gamma\), the additional term can change the location of a density mode. If the change of coordinates is affine with constant nonsingular Jacobian, \(\log|J|\) is constant, so maximizing the objective gives corresponding estimates in either coordinate system. The precise invariance claim is therefore that Jeffreys’s measure transforms correctly, not that every coordinate density has the same numerical mode.

Using the Objective Carefully

The information penalty is model-dependent and parameter-dependent. In logistic regression, changing the design, adding a covariate, or changing fitted probabilities changes \(X^\mathsf{T}WX\), and therefore can change the determinant and its contribution to the objective. By contrast, a positive multiplicative constant in the information determinant adds only a constant to the penalized log-likelihood and does not change its maximizer.

The formula requires a nonsingular expected information matrix for the stated determinant to be positive and its logarithm to be defined. In the logistic model, a full-column-rank design ensures this for finite coefficients. If the design is rank deficient, the determinant is zero and this objective is not defined as written; one cannot treat the log determinant as an ordinary finite penalty without first addressing the model’s identifiability.

  • Common mistake: treating the correction as a fixed coefficient penalty. The term is \(\tfrac12\log|I(\beta)|\), not a preset multiple of \(\|\beta\|^2\) or \(\|\beta\|_1\). Its value depends on the expected information at the current coefficients.
  • Common mistake: applying Jeffreys invariance to density modes. Jeffreys’s prior measure is invariant under smooth one-to-one reparameterization. A density mode need not be, because a coordinate change with nonconstant Jacobian adds \(\log|J(\gamma)|\) to the log density.
  • Common mistake: miscounting failures in grouped data. For \(y\) successes and \(m\) failures, the two coefficients are \(y+\tfrac12\) and \(m+\tfrac12\). The failure coefficient comes from \(m\), not from \(y\) or the group total.
Key takeaway: Firth’s logistic objective is the ordinary log-likelihood plus one-half the log determinant of the expected information. The determinant supplies the Jeffreys information-volume factor; its measure-level invariance should not be confused with universal invariance of density modes.

Check Your Understanding

Use the definitions and calculations above to check your understanding.

  1. For independent Bernoulli logistic responses with full-rank design \(X\), write the expected information and the Jeffreys-penalized log-likelihood.
  2. An intercept-only sample has \(n=5\) observations and \(y=2\) successes. What are the coefficients of \(\log p\) and \(\log(1-p)\) in its penalized objective, ignoring constants?
  3. For a group with one success and four failures, state the two adjusted log-probability coefficients and the maximizing fitted probability.
  4. Explain why the Jeffreys measure is invariant under a smooth one-to-one change of coordinates.
  5. Why does invariance of the Jeffreys measure not establish invariance of the mode of its density under a nonlinear coordinate transformation?
Clinical Biostats