From Jeffreys’ Penalty to Leverage
Firth’s adjustment to the logistic score can be written in terms of fitted probabilities and leverage values. This form reveals where the adjustment enters: each observation contributes according to both its fitted probability and its share of the model’s information. It also clarifies how to adapt the score when observations are reported as binomial counts for groups rather than as individual zero-one outcomes.
Consider independent Bernoulli responses \(Y_1,\ldots,Y_n\), with \(Y_i\in\{0,1\}\), and a logistic regression model with \(p\) coefficients. Write \(x_i\) for the \(p\)-vector of covariates for observation \(i\), and let \(X\) be the \(n\times p\) matrix with rows \(x_i^\mathsf{T}\). Assume \(X\) has full column rank. At a finite coefficient vector \(\beta\), define \(\eta_i=x_i^\mathsf{T}\beta\), \(\pi_i=P(Y_i=1)=\exp(\eta_i)/(1+\exp(\eta_i))\), and \(w_i=\pi_i(1-\pi_i)\).
Because every \(w_i>0\) at finite \(\beta\) and \(X\) has full column rank, \(I(\beta)\) is positive definite and its inverse exists. The ordinary logistic score is \(U(\beta)=X^\mathsf{T}(y-\pi)\), where \(y=(Y_1,\ldots,Y_n)^\mathsf{T}\) and \(\pi=(\pi_1,\ldots,\pi_n)^\mathsf{T}\). Firth’s adjusted score adds the derivative of half the log determinant of the information matrix to this ordinary score.
Here the likelihood is the ordinary Bernoulli likelihood, and the penalty is defined wherever \(I(\beta)\) is positive definite. The leverage values depend on \(\beta\), just as the fitted probabilities do. The displayed equation gives the adjusted score at each candidate \(\beta\); it does not assert that the score equation has a solution or describe an algorithm for finding one.
Deriving the Adjustment
The key calculation is the derivative of \(\log|I(\beta)|\). For a differentiable positive-definite matrix \(I\), the determinant identity gives \(\partial\log|I|/\partial\beta_j=\operatorname{tr}(I^{-1}\partial I/\partial\beta_j)\). We now apply it to the logistic information matrix.
Since \(d\pi_i/d\eta_i=w_i\) and \(w_i=\pi_i(1-\pi_i)\), the chain rule gives \(\partial w_i/\partial\beta_j=w_i(1-2\pi_i)x_{ij}\).
Using \(I=\sum_i w_i x_i x_i^\mathsf{T}\), obtain \(\partial I/\partial\beta_j=\sum_i w_i(1-2\pi_i)x_{ij}x_i x_i^\mathsf{T}\).
For each \(i\), \(\operatorname{tr}(I^{-1}x_i x_i^\mathsf{T})=x_i^\mathsf{T}I^{-1}x_i\). Therefore the trace contribution is \(w_i x_i^\mathsf{T}I^{-1}x_i=h_i\).
Putting these steps together, and using the linearity of the trace, yields
The derivative of the penalty \(\tfrac12\log|I(\beta)|\) is therefore \(\tfrac12\sum_i h_i(1-2\pi_i)x_{ij}\) in component \(j\). Since \(\tfrac12(1-2\pi_i)=\tfrac12-\pi_i\), the full adjusted score has component
Stacking these components over \(j=1,\ldots,p\) gives the theorem’s vector expression. This derivation also shows why the correction is not simply an added constant to the response: both \(h_i\) and \(\pi_i\) vary with the model parameters. \(\square\)
Worked Examples
Worked Example: Intercept-Only Logistic Regression
Suppose \(n=4\) independent Bernoulli observations share one probability \(\pi\), and exactly \(r=0\) successes are observed. The model has an intercept only, so \(X\) is a column of four ones. For any finite intercept, all weights equal \(w=\pi(1-\pi)\), and \(I=4w\). Each leverage is therefore
The ordinary score for the intercept is \(r-4\pi=-4\pi\). The total correction is
Thus the adjusted score is \(U^*(\beta)=-4\pi+\tfrac12-\pi=\tfrac12-5\pi\). Setting it to zero gives \(\pi=1/10\). Substitution checks the result: \(\tfrac12-5(1/10)=0\). The example shows how the leverage-weighted term changes the score even when every observation has the same covariates and fitted probability.
Worked Example: Two Treatment Groups
Consider an intercept and a binary treatment indicator, with two observations in each of two groups. The design rows are \((1,0)\) for the control group and \((1,1)\) for the treatment group. Suppose the fitted probabilities at the coefficient value being examined are \(\pi_0=1/3\) and \(\pi_1=2/3\), respectively. In this saturated two-group design, the leverage for each observation in a group is the reciprocal of that group’s size: \(h_i=1/2\) in control and \(h_i=1/2\) in treatment.
Suppose the observed outcomes are \(1,0\) in control and \(1,0\) in treatment. The ordinary score contributions summed within each group are \(1-2(1/3)=1/3\) and \(1-2(2/3)=-1/3\). The groupwise leverage corrections are
Each group’s score contribution is multiplied by its design row. Consequently, the adjusted intercept score is \(1/3-1/3+1/6-1/6=0\), and the adjusted treatment-coefficient score is \(-1/3-1/6=-1/2\). These values also follow directly by summing \(x_i(y_i-\pi_i+h_i(\tfrac12-\pi_i))\) observation by observation. The example makes clear that each group’s correction affects the coefficient components through its covariate row.
Grouped Binomial Responses
Now suppose the data consist of \(G\) independent groups. Group \(g\) has \(m_g\) Bernoulli trials, of which \(Y_g\) are successes, with common probability \(\pi_g\) within the group and logistic linear predictor \(\eta_g=x_g^\mathsf{T}\beta\). The grouped response has distribution \(Y_g\sim\operatorname{Bin}(m_g,\pi_g)\). Assume the \(G\times p\) design matrix with rows \(x_g^\mathsf{T}\) has full column rank and \(m_g>0\).
The grouped score and information are
Define the grouped-row leverage
This is the diagonal element of the weighted hat matrix formed from the \(G\) grouped rows, whose row weight for group \(g\) is \(m_g\pi_g(1-\pi_g)\). It equals the sum of the individual-trial leverages for the \(m_g\) replicated rows in that group.
To verify the result, write the information as \(I=\sum_g m_gw_gx_gx_g^\mathsf{T}\), where \(w_g=\pi_g(1-\pi_g)\). Differentiation gives \(\partial w_g/\partial\beta_j=w_g(1-2\pi_g)x_{gj}\), so
Applying the determinant derivative and taking the trace produces
Adding this derivative to the grouped ordinary score gives the stated expression component by component. Equivalently, expand each group into \(m_g\) Bernoulli rows: each replicated row has leverage \(w_gx_g^\mathsf{T}I^{-1}x_g\), so their total leverage is exactly \(H_g\). The grouped formula is therefore the individual-trial adjustment summed within groups. \(\square\)
Worked Example: Adjustment for Two Grouped Counts
Take a saturated model with two groups, each represented by its own coefficient, and let the group sizes be \(m_1=4\) and \(m_2=2\). Suppose the observed success counts are \(Y_1=1\) and \(Y_2=2\). In this model, the information matrix is diagonal, with entries \(m_g\pi_g(1-\pi_g)\). Hence
for each group. The adjusted score for group \(g\)’s coefficient is \(Y_g-m_g\pi_g+(\tfrac12-\pi_g)\). Solving the first adjusted score equation gives \(1-4\pi_1+\tfrac12-\pi_1=0\), so \(\pi_1=1.5/5=0.3\). For the second group, \(2-2\pi_2+\tfrac12-\pi_2=0\), so \(\pi_2=2.5/3=5/6\). Substituting verifies both equations: \(1-1.2+0.2=0\), and \(2-10/6-1/3=0\). The group correction has leverage one here, although each individual trial within a group has leverage \(1/m_g\).
Interpreting Leverage and Avoiding a Common Error
Leverage summarizes how strongly a row contributes to the fitted model’s information geometry. In the individual Bernoulli form, the correction for observation \(i\) is \(h_i(\tfrac12-\pi_i)\), before multiplication by its covariate vector. If \(\pi_i\) is below one half, that scalar correction is positive; if it is above one half, it is negative. Its effect on a particular coefficient also depends on the sign and size of the corresponding covariate.
A useful check is \(\sum_i h_i=p\). Indeed, the sum of the diagonal elements of \(H\) is its trace, and
For grouped data, the corresponding identity is \(\sum_g H_g=p\). These identities are useful consistency checks, but they do not imply that all observations or groups have the same leverage.
- Common mistake: Use the grouped-row hat diagonal as though it were the leverage of each individual trial, then multiply it by the group size again. This counts the replication twice.
- Correction: The grouped-row leverage \(H_g\) already includes \(m_g\). If working from individual trials, each trial has leverage \(H_g/m_g\), and summing the \(m_g\) corrections gives \(H_g(\tfrac12-\pi_g)x_g\).
- Another mistake: Add \(h_i(\tfrac12-\pi_i)\) to the score without multiplying by \(x_i\). The scalar changes the residual contribution, but the coefficient score receives it in the direction of the observation’s covariate vector.
The leverage form is valuable because it connects the Jeffreys penalty to the design and gives a direct translation between individual and grouped data representations. It also makes clear that the same fitted probability can receive different adjustment weight at different design locations. The formula is an expression for the adjusted score; conclusions about existence, numerical solution, or inferential procedures require separate arguments.
Check Your Understanding
Use the definitions and derivations above to answer these questions.
- In an intercept-only Bernoulli model with \(n\) observations, what is each observation’s leverage? Show the calculation.
- Which part of the logistic model causes \(h_i\) to depend on \(\beta\), even when the design matrix is fixed?
- For a grouped binomial observation with \(m_g\) trials, express its grouped-row leverage in terms of the leverage of one replicated Bernoulli trial.
- Why must the covariate vector multiply the scalar leverage correction when forming the coefficient score?
- In the two-group saturated example, verify that the grouped leverages sum to the number of coefficients.