Why Use Firth Logistic Regression for Treatment Probabilities?
In a treatment model, logistic regression estimates the probability of treatment given measured covariates or covariate history. With sparse treatment data, a covariate pattern may occur only among treated individuals, or only among untreated individuals. Ordinary maximum-likelihood logistic regression can then send one or more coefficients toward infinity: the likelihood improves as predicted probabilities approach zero or one, but no finite coefficient achieves its supremum. This is separation, a problem introduced in the earlier material on sparse treatment data.
Firth logistic regression changes the estimation criterion rather than imposing an arbitrary upper or lower bound on fitted probabilities. Its penalty is based on the information matrix and produces an adjusted score that counteracts first-order small-sample bias. In inverse probability weighting, this can yield usable finite fitted probabilities in separated samples. It does not, by itself, establish positivity in the population or guarantee stable weights.
Definition and Adjusted Score
Let \(A_i\in\{0,1\}\) be the treatment received by observation \(i\), and let \(x_i\) be a \(p\)-dimensional column vector of model covariates, including an intercept if one is fitted. Assume independent Bernoulli observations conditional on the fixed design vectors, with \(\operatorname{logit}\{P(A_i=1\mid x_i)\}=x_i^\top\beta\). Write \(p_i=\operatorname{expit}(x_i^\top\beta)\), \(w_i=p_i(1-p_i)\), and let \(X\) be the matrix with rows \(x_i^\top\). For finite \(\beta\), the Fisher information is \(I(\beta)=X^\top W X\), where \(W\) is diagonal with entries \(w_i\).
The full-column-rank condition on \(X\) ensures that \(I(\beta)\) is positive definite for every finite \(\beta\), since every \(w_i>0\). If the columns are linearly dependent, the determinant is zero and this penalty is not defined as written; the design must first be reparameterized or otherwise made identifiable.
To derive this, the ordinary score is \(U(\beta)=X^\top(A-p)\). For any parameter component \(\beta_j\), differentiation of the penalty uses \(\partial\log|I|/\partial\beta_j=\operatorname{tr}\{I^{-1}(\partial I/\partial\beta_j)\}\). Because \(\partial w_i/\partial\beta_j=w_i(1-2p_i)x_{ij}\), we have \(\partial I/\partial\beta_j=\sum_i w_i(1-2p_i)x_{ij}x_ix_i^\top\). Consequently,
where \(h_i=w_i x_i^\top I^{-1}x_i\), exactly the \(i\)th diagonal element of \(H\). Adding this derivative to the ordinary score gives the stated result. Thus Firth estimation can be computed by solving an ordinary logistic score plus a leverage-weighted correction; the correction is largest for observations with high leverage. \(\square\)
Worked Calculations
Worked Example: Complete Separation by a Binary Covariate
Suppose a treatment model has an intercept and a binary covariate \(X\). Among four observations with \(X=0\), none receives treatment. Among four with \(X=1\), all four receive treatment. Ordinary logistic regression separates perfectly: its fitted probabilities can approach zero in the first group and one in the second, but the maximum-likelihood coefficients are not finite.
This is a saturated two-group logistic model: it assigns a separate probability to each covariate group. The Firth cell formula derived below gives \(\hat p_0=(0+1/2)/(4+1)=0.1\) and \(\hat p_1=(4+1/2)/(4+1)=0.9\).
The intercept is the logit for \(X=0\): \(\hat\beta_0=\log\{0.1/(1-0.1)\}=\log(1/9)\approx-2.1972\). The slope is the difference between the group logits: \(\hat\beta_1=\log\{0.9/0.1\}-\log\{0.1/0.9\}=\log(81)\approx4.3944\). Both estimates are finite. For a treated observation with \(X=1\), the unstabilized treatment weight is \(1/0.9\approx1.111\); for an untreated observation with \(X=0\), it is \(1/(1-0.1)\approx1.111\).
Proof. In the group-logit parameterization, the information matrix is diagonal with entries \(n_jp_j(1-p_j)\). The ordinary log-likelihood is a sum of independent group contributions, and the penalty is \(\tfrac12\sum_j\log\{n_jp_j(1-p_j)\}\). Terms involving \(n_j\) are constant in the probabilities. Thus the criterion for group \(j\) is \(s_j\log(p_j)+(n_j-s_j)\log(1-p_j)+\tfrac12\log(p_j(1-p_j))\). Its derivative is \((s_j+1/2)/p_j-(n_j-s_j+1/2)/(1-p_j)\). Setting it to zero gives \((s_j+1/2)(1-p_j)=(n_j-s_j+1/2)p_j\), hence \(p_j=(s_j+1/2)/(n_j+1)\). The second derivative is \(-(s_j+1/2)/p_j^2-(n_j-s_j+1/2)/(1-p_j)^2<0\); the solution is the unique maximum. Since \(0<s_j+1/2<n_j+1\), it is strictly between zero and one. \(\square\)
Worked Example: An Intercept-Only Model With Everyone Treated
Suppose all five observations receive treatment and the model contains only an intercept. The saturated-group result applies with \(s=5\) and \(n=5\), so \(\hat p=(5+1/2)/(5+1)=5.5/6=11/12\approx0.9167\). The estimated intercept is \(\hat\beta=\log\{(11/12)/(1/12)\}=\log(11)\approx2.3979\).
The ordinary maximum-likelihood estimate would have \(p=1\), requiring an infinite intercept. The Firth estimate is finite, but a treated observation still receives an unstabilized weight of \(1/\hat p=12/11\approx1.091\). There are no untreated observations here, so this sample alone cannot tell us how well the model estimates treatment probabilities for untreated individuals.
Worked Example: Firth Probabilities and Weights Without Complete Separation
Consider a binary covariate with four observations at \(X=0\), one treated, and six observations at \(X=1\), three treated. Each group-specific probability is estimated by the saturated Firth formula: \(\hat p_0=(1+1/2)/(4+1)=1.5/5=0.3\) and \(\hat p_1=(3+1/2)/(6+1)=3.5/7=0.5\).
The model coefficients are \(\hat\beta_0=\log(0.3/0.7)=\log(3/7)\approx-0.8473\) and \(\hat\beta_1=\log(0.5/0.5)-\hat\beta_0\approx0.8473\). For a treated observation with \(X=0\), the unstabilized weight is \(1/0.3=3.333\). For an untreated observation with \(X=1\), it is \(1/(1-0.5)=2\). The corresponding ordinary group estimates would be \(1/4=0.25\) and \(3/6=0.5\); the Firth adjustment raises the sparse first-group estimate to 0.3.
Using the Estimates in Inverse Probability Weights
For a single treatment decision, let \(\hat p_i\) be the fitted probability of treatment given the covariates in the denominator model. The unstabilized weight is \(1/\hat p_i\) for a treated observation and \(1/(1-\hat p_i)\) for an untreated observation. In longitudinal settings, fit the appropriate sequential treatment model at each time and substitute its Firth-fitted probabilities into the corresponding factors of the longitudinal weight. For example, the denominator contribution at time \(t\) is
A stabilized weight uses its specified numerator probability as well; changing how the denominator is estimated does not change that definition. Record which model produced each fitted probability, and compute the weight from the probability corresponding to the observed treatment, not automatically from \(\hat p_{it}\).
Firth estimates are not obtained by simply adding one-half to each observed treatment count in every arbitrary logistic regression. The simple \((s+1/2)/(n+1)\) calculation is exact for a saturated group model. For a general covariate design, the adjustment depends on the fitted probabilities and leverage values through the adjusted score.
Diagnostics, Alternatives, and Limitations
A finite coefficient is a useful computational outcome, not a complete diagnostic. Before using fitted probabilities for weights, check that the design matrix has full column rank, the optimizer converged, and the fitted probabilities correspond to the intended treatment and covariate history. Inspect predicted probabilities by treatment group and the resulting weight distribution. Large weights can remain even when all estimated probabilities are strictly between zero and one. A finite estimate does not create empirical support for treatment assignments absent from important covariate regions.
Ordinary maximum likelihood is the direct alternative when the model is estimable and sparse-data bias or separation is not a concern. Under separation it may diverge or fail to converge. Firth’s penalty specifically targets first-order bias reduction and is not equivalent to clipping probabilities at a chosen threshold: clipping leaves the fitted model unchanged and alters the weights afterward. Exact logistic methods are another possible small-sample approach, but they answer a different computational problem and can be costly. No estimation method repairs an incorrect treatment model, unmeasured confounding, or a violation of the causal positivity assumption.
- Rank deficiency: remove redundant columns or otherwise specify an identifiable model before applying the determinant penalty.
- Extreme weights: investigate the fitted probabilities and covariate support; do not assume finite Firth estimates imply harmless weights.
- Numerical warnings: check scaling, coding, convergence tolerances, and whether some fitted probabilities are so close to zero or one that calculations lose precision.
- Interpretation: Firth changes the finite-sample fitting criterion. It does not redefine the target causal estimand, and it does not guarantee improved causal inference if the model or assumptions are inadequate.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- In a saturated group with 0 treated among 7 observations, what is the Firth probability?
- Why is the Firth penalty undefined as written if \(X\) has linearly dependent columns?
- For a treated observation with fitted probability \(0.2\), what is its unstabilized treatment weight?
- Does a finite Firth estimate establish causal positivity? Explain.
Solutions. (1) \((0+1/2)/(7+1)=1/16=0.0625\). (2) The information matrix is singular, so its determinant is zero and \(\log|I|\) is not finite; the model must be made identifiable. (3) The weight is \(1/0.2=5\). (4) No. A finite fitted probability does not show that both treatment options have adequate support throughout the target population; positivity and weight stability require separate assessment.