How this calculation works
Place the zero or one outcome first and predictors after it. The intercept is a fitted coefficient, so omit any duplicate constant predictor.
ℓ*(β)=Σ[yᵢηᵢ−log(1+expηᵢ)]+½log|XᵀW(β)X|.A worked example
The default has predictors −5 through4, with zeros at −5 through−1 and ones at0 through4. The separating threshold lies at−0.5, so symmetry predicts intercept equal to half the slope. Firth gives finite probabilities even though the ordinary likelihood separates.
Good to know
10–300 binary rows, 1–4 predictors plus intercept, full-rank design; deterministic step halving, 200 iterations, profile endpoints by bracketed constrained refits. Flag unresolved interval endpoints; no weights, offsets, random effects or FLIC/FLAC variants.
Reference: logistf author-maintained reference (opens in a new tab) ↗
Describe individual binary observations
Place the zero or one outcome first and predictors after it. The intercept is a fitted coefficient, so omit any duplicate constant predictor.
Separation occurs when a predictor combination perfectly sorts the outcomes. Record the observed predictor range; a finite fitted curve does not validate extrapolation.
Compare this with the GLM regression calculator from response and design matrix. Maximize binomial log likelihood plus half log determinant of Fisher information using leverage-adjusted scores. Return finite bias-reduced coefficients, penalized likelihood-ratio tests and profiled intervals under separation; existing unpenalized GLM explicitly errors on separation and has no penalization.
Why the information penalty changes the fit
Ordinary logistic likelihood can keep increasing as a separating coefficient diverges. Firth adds half the log determinant of expected information.
The penalty changes with the coefficients and the design. It is neither a user-chosen ridge strength nor a correction applied after ordinary regression. The default outcomes switch from zero to one between predictor values −1 and0. An ordinary unpenalized logistic likelihood can increase as the positive slope grows without bound, so a large fitted coefficient would not be evidence of a well-determined finite effect. The symmetric predictor arrangement instead gives the Firth solution a useful check: the intercept should equal half the slope. The checked estimates are approximately0.4853248 and0.9706496. This equality follows from reflection about−0.5 and is a stronger debugging check than merely observing finite numbers. It also exposes a changed intercept or outcome convention immediately.
Optimize and profile the penalized surface
Use the adjusted score and a line search to improve penalized likelihood. A small coefficient step alone cannot certify convergence.
A profile interval fixes one coefficient and refits the rest using the same full-model information penalty. Wald limits can differ sharply in sparse data.
Work through the checked default example
The default has predictors −5 through4, with zeros at −5 through−1 and ones at0 through4. The separating threshold lies at−0.5, so symmetry predicts intercept equal to half the slope. Firth gives finite probabilities even though the ordinary likelihood separates.
The separated-data fit has intercept 0.485324811 and slope 0.970649554. Its slope profile 95% interval is approximately [0.196158,5.564239], showing how asymmetric the sparse-data uncertainty remains. The adjustment can be expressed through each row's leverage h_i in the current weighted design. The modified score replaces y_i−p_i by y_i−p_i+h_i(1/2−p_i). Those leverages depend on the current information matrix, so the correction must be recomputed while iterating. It is not equivalent to adding a fixed pseudo-count to every observed row. Full design rank remains necessary even though separation is handled: a duplicate constant column is redundant rather than a separation problem. Standardizing very differently scaled predictors may improve conditioning, but the model and coefficient units must then be interpreted on that standardized scale.
Interpret finite coefficients with their uncertainty
Exponentiating a coefficient gives an adjusted odds ratio per predictor unit. It does not turn an odds ratio into a risk ratio.
The profile likelihood records asymmetric uncertainty. A finite estimate can still have a wide interval when few observations identify the effect.
Rank deficiency still prevents identification
Firth handles separation but cannot distinguish duplicate columns. Check predictor coding before assuming an optimizer failure is caused by the outcomes.
Boundary-only outcomes and severe conditioning deserve explicit diagnostics. Changing numerical tolerances cannot create information absent from the design. The reported profile interval is obtained by holding one coefficient fixed and reoptimizing the others under the same full-design penalty. Its endpoint solves twice the penalized log-likelihood drop equal to the selected one-degree-of-freedom chi-square cutoff. This interval need not be symmetric around the estimate, unlike an estimate-plus-or-minus-standard-error construction. If bracketing or a constrained fit fails, the endpoint is labeled unresolved rather than substituted with a convenient Wald interval. Penalized likelihood-ratio p-values also describe this specified fitting convention, not a universal guarantee for every small or dependent sample. A convergence message concerns the numerical fit, not study validity.
Compare the same estimand and coding
Compare this result with ordinary logistic regression on overlapping data, keeping the intercept, scale and response direction identical.
For an intercept alone, the fitted success probability is (s+½)/(n+1). This closed form checks implementation independently of a general optimizer. For example, the separating default slope is positive, so increasing the predictor increases the fitted success probability. If you reverse the outcome labels, both coefficients should reverse sign while the fitted probability becomes one minus its original value. That algebraic symmetry does not change the existence of separation; it changes which event is called success. Always record that coding before interpreting an odds ratio.
A few questions, answered
Does this solve complete separation?
It targets a finite penalized fit under a full-rank design. It does not repair duplicate predictors or establish a causal effect.
Are these ridge coefficients?
No. The penalty is half the log determinant of Fisher information and changes with the fitted probabilities.
Why are profile intervals asymmetric?
They follow the penalized likelihood surface while nuisance coefficients are refitted, rather than assuming a quadratic symmetric shape.
What does reversing zero and one do?
With unchanged predictors and coding, it reverses coefficient signs and complements fitted probabilities.