12.1 Logistic regression
Definition 12.1.1. In the logistic regression model, the probability of disease for a person with exposure \(E\) and covariates \(C_1, \dots , C_p\) satisfies \begin {align*} \operatorname {logit} P(D = 1 \mid E, C) &= \log \frac {P(D = 1 \mid E, C)}{P(D = 0 \mid E, C)} \\ &= \alpha + \beta E + \gamma _1 C_1 + \cdots + \gamma _p C_p . \end {align*}
Proposition 12.1.2. In the logistic model, \(e^\beta \) is the odds ratio for \(E = 1\) against \(E = 0\) at any fixed value of the covariates. More generally, \(e^{\beta \Delta }\) is the odds ratio for a difference \(\Delta \) in a continuous \(E\).
Proof. The log odds at \(E = e + \Delta \) and \(E = e\), with \(C\) fixed, differ by \(\beta \Delta \), since every other term is the same. The log of the odds ratio is this difference. □
So the model asserts that the odds ratio is the same in every stratum of the covariates: it is the homogeneity assumption of Section 9.3, together with an assumption about how the baseline odds vary with \(C\). If \(C\) is a set of indicators for strata, the second assumption is vacuous and the model is exactly the “common odds ratio” model that the Mantel–Haenszel estimator addresses. Effect modification is modelled by adding product terms such as \(\delta \,E C_1\), which make the odds ratio \(e^{\beta + \delta C_1}\) depend on \(C_1\).
Maximum likelihood
For individuals \(i = 1, \dots , n\) with outcomes \(y_i \in \{0, 1\}\), covariate vectors \(x_i\) (including a leading \(1\) and \(E\)) and \(p_i = 1/(1 + e^{-x_i^\top \theta })\), the log-likelihood is \(\ell (\theta ) = \sum _i \{y_i x_i^\top \theta - \log (1 + e^{x_i^\top \theta })\}\), and setting its derivative to zero gives the score equations \[ \sum _i (y_i - p_i)\,x_i = 0 . \] The log-likelihood is concave, so the solution, when it exists, is unique; it is found by Newton–Raphson (iteratively reweighted least squares). The inverse of the information matrix \(\sum _i p_i(1 - p_i)x_i x_i^\top \) estimates the variance of \(\hat \theta \), giving Wald intervals \(\hat \beta \pm 1.96\,\text {SE}\) for the log odds ratio. Hypotheses are better tested by the likelihood ratio statistic, twice the difference in maximised log-likelihoods of nested models, approximately \(\chi ^2\) with degrees of freedom equal to the number of parameters removed.
The score equation for each indicator variable says that the fitted number of cases with that characteristic equals the observed number. With a stratum indicator, observed and fitted cases agree in every stratum; with the exposure, the fitted number of exposed cases equals the observed. These are the same balancing conditions that underlie the Mantel–Haenszel test.
Example 12.1.3. Fitting the logistic model with exposure and indicators for the age groups \(45\)–\(59\) and \(60+\) to the data of Example 9.1.1 gives \[ \operatorname {logit} p = -2.086 + 0.740\,E + 0.683\,A_2 + 1.531\,A_3 , \] with \(\text {SE}(\hat \beta ) = 0.182\). The age-adjusted odds ratio is \(e^{0.740} = 2.10\), with interval \((1.47,\ 2.99)\), against the Mantel–Haenszel \(2.11\) and the crude \(3.37\). The likelihood ratio test for \(E\) (comparing with the model without it) gives \(16.2\) on \(1\) degree of freedom. The residual deviance, \(0.50\) on \(2\) degrees of freedom, is the likelihood ratio test of the model against the saturated model, which adds the two exposure-by-age product terms: there is no evidence of effect modification, as the Woolf and Breslow–Day tests also found. The fitted number of exposed cases is \(103\), exactly the observed number.
Questions on this section
Stuck on something here? Ask below and it stays attached to this topic.