How this calculation works
Fit covariate odds ratios within matched case-control sets by conditioning on each set’s observed case count. Exact subset denominators remove the nuisance stratum intercepts instead of estimating a separate intercept for every set.
L(β)=∏_s exp(β·Σ_cases x_i) / Σ_(A⊂s,|A|=m_s) exp(β·Σ_(i∈A)x_i).A worked example
The default has 20 matched pairs, each comparing predictor values 0 and 1. The higher-predictor member is the case in 14 pairs and the lower-predictor member in 6. The conditional coefficient is log(14/6)≈0.847298 and the corresponding odds ratio is 7/3.
Good to know
2–40 informative strata, 2–8 members per stratum, 1–3 predictors; ≤320 rows and binary response. Exact within-stratum subset denominators and finite Newton likelihood fit. Constant-response strata are explicitly counted and discarded. No intercept, sampling weights, predicted population probabilities, confidence intervals or causal interpretation.
Reference: Statsmodels conditional logistic regression (opens in a new tab) ↗
The matched set is part of the likelihood
A matched design makes within-set comparisons central. Conditioning on the number of cases in each set removes a set-specific nuisance intercept, leaving relative predictor information from members who could exchange case status within that set.
The group label identifies membership only; it is not a numerical predictor. Two rows with labels one and one share a set, while labels one and two do not. Relabeling sets without changing membership must leave the fitted coefficient unchanged.
Compare this with the GLM regression calculator from response and design matrix. Unconditional logistic GLM does not condition on each matched set case count.
Do not enter a separate intercept column
Adding the same constant to every member’s predictor in a set cannot change the relative subset probabilities after conditioning. An intercept column therefore contributes no identifiable coefficient, and more general within-set constant predictors are similarly uninformative.
The solver checks the observed information and rejects unidentified or ill-conditioned designs. Standardizing a variable across the whole dataset can aid arithmetic, but it cannot create within-set variation where the matching structure contains none.
The denominator enumerates possible case subsets
For a set with m cases among k members, the conditional denominator sums over every size-m subset of that set. Each subset receives an exponential weight determined by the sum of its predictor vectors and the current coefficient.
With at most eight members, this finite enumeration is tractable and exactly expresses the supported conditional likelihood. It avoids a Monte Carlo denominator, while still leaving coefficient estimation as a floating-point optimization that must meet its convergence checks.
Matched pairs give a transparent worked check
In the default pairs, choosing the higher predictor member as case contributes the logistic probability of the coefficient, and choosing the lower member contributes its complement. Fourteen versus six such choices produce fitted probability fourteen-twentieths.
Solving that logistic relation gives coefficient log(14/6) and odds ratio fourteen-sixths. The calculation is independent of arbitrary set numbering and provides a useful check on both the conditional denominator and the direction of the reported odds ratio.
Constant-response sets carry no coefficient information
A set with all members coded zero has only one possible conditioned case subset: the empty set. A set with all members coded one likewise has only one possible subset. Their likelihood contribution is constant in the covariate coefficient.
The page reports how many such sets were excluded from the coefficient fit. This explicit count helps identify a data-entry mistake or a matched design with fewer informative comparisons than the total row count might initially suggest.
Finite convergence is not guaranteed by exact enumeration
Exact subset probabilities do not prevent separation. If the observed case assignments always favor the same covariate direction, the likelihood can approach its supremum as a coefficient diverges rather than attain a finite optimum.
The bounded solver rejects unresolved fits and singular information instead of publishing a coefficient at the search limit. A reported finite estimate still needs an appropriate study design and assumptions; the numerical checks are not a substitute for statistical validation.
Conditional odds do not identify population risk
The conditioned analysis removes set intercepts and depends on the matched sampling structure. Its coefficient can describe a within-set odds ratio, but it does not recover an ordinary population intercept or the unconditional probability of being a case.
Do not turn the fitted odds ratio into a predicted absolute event rate without a justified external baseline and design interpretation. The page supplies no causal effect, individual diagnosis or confidence interval, and applied conclusions require a fuller analysis.
A few questions, answered
Why does an intercept cause trouble?
It is constant within every matched set and is conditioned out, so its coefficient is not identified.
Can a set contain more than one case?
Yes. The exact denominator enumerates subsets with that set’s observed case count.
What happens to all-case or all-control sets?
Their conditioned likelihood is constant; the page counts and discards them from the coefficient fit.
Can the model predict population case probability?
No. The conditional fit estimates within-set odds ratios without a population intercept.