Why a Binary Predictor Has a Direct Odds-Ratio Interpretation
Suppose a study compares the probability of an event between two groups, such as patients assigned to treatment (\(D=1\)) and control (\(D=0\)). Logistic regression describes each group’s event probability through its log odds. With a binary predictor coded zero and one, the model has just two linear-predictor values, so their difference is especially direct: it is the coefficient of \(D\). Exponentiating that difference gives the odds ratio comparing the groups.
This interpretation concerns odds, not probabilities. The distinction matters because an odds ratio does not say that one group’s event probability is multiplied by the same number. The reference-group probability can be calculated from the intercept, but it is not itself the intercept or its exponential.
Model and Definitions
The coding determines the comparison. \(D=0\) is the reference group, and the change being described is from \(D=0\) to \(D=1\). Reversing that comparison gives the reciprocal odds ratio. The response coding matters too: the event must be the outcome designated \(Y=1\).
Deriving the Zero-to-One Odds Ratio
Proof. By the logistic model, the reference-group log odds are \(\beta_0\), while the \(D=1\) log odds are \(\beta_0+\beta_1\). Exponentiating each log odds gives the corresponding odds:
The odds ratio in the specified direction is therefore
Taking the logarithm of both sides gives the log odds ratio \(\beta_1\). The result follows. \(\square\)
The intercept cancels because it contributes equally to both groups’ log odds. This cancellation is why the binary-predictor coefficient gives the group comparison directly. If \(\beta_1>0\), the odds are higher at \(D=1\); if \(\beta_1<0\), they are lower; and if \(\beta_1=0\), the odds are equal.
Odds and Probabilities From Fitted Coefficients
In an analysis, the coefficients are estimated. Write the fitted coefficients as \(\hat{\beta}_0\) and \(\hat{\beta}_1\). Substitution gives fitted log odds, odds, and probabilities for each value of \(D\). For any fitted log odds \(\eta\), the odds are \(\exp(\eta)\), and solving \(o=p/(1-p)\) for \(p\) gives \(p=o/(1+o)\). Thus the fitted probability is \(\exp(\eta)/(1+\exp(\eta))\).
Worked Example: Calculating Both Groups’ Fitted Odds and Probabilities
Suppose a fitted model for an event has \(\hat{\beta}_0=-1.2\) and \(\hat{\beta}_1=0.8\), with \(D=0\) as the reference group. Calculate the fitted odds and probability in each group, then the odds ratio.
Reference group, \(D=0\). Its fitted log odds are \(-1.2\), so its fitted odds are \(\exp(-1.2)\approx 0.3012\). Converting odds to probability gives \(0.301194/(1+0.301194)\approx 0.2315\). Equivalently, \(\operatorname{logistic}(-1.2)=\exp(-1.2)/(1+\exp(-1.2))\approx 0.2315\).
Group \(D=1\). Its fitted log odds are \(\hat{\beta}_0+\hat{\beta}_1=-1.2+0.8=-0.4\). Its fitted odds are \(\exp(-0.4)\approx 0.6703\), and its fitted probability is \(0.670320/(1+0.670320)\approx 0.4013\).
Odds ratio. The fitted odds ratio comparing \(D=1\) with \(D=0\) is \(\exp(0.8)\approx 2.2255\). Checking with the group odds gives \(0.670320/0.301194\approx 2.2255\). Thus the fitted odds are about 2.23 times as large in the \(D=1\) group. The probabilities, approximately 0.4013 and 0.2315, are not in that same ratio.
Worked Example: A Negative Coefficient and the Reverse Comparison
Suppose \(\hat{\beta}_0=0.4\) and \(\hat{\beta}_1=-1.1\). Compute the reference-group probability and odds ratio, and interpret the sign.
At \(D=0\), the fitted log odds are \(0.4\). The fitted odds are \(\exp(0.4)\approx 1.4918\), and the fitted probability is \(1.491825/(1+1.491825)\approx 0.5987\).
At \(D=1\), the fitted log odds are \(0.4-1.1=-0.7\). The odds are \(\exp(-0.7)\approx 0.4966\), and the probability is \(0.496585/(1+0.496585)\approx 0.3318\).
The odds ratio for \(D=1\) versus \(D=0\) is \(\exp(-1.1)\approx 0.3329\). Hence the fitted event odds at \(D=1\) are about one third of the odds at \(D=0\). For the reverse comparison, \(D=0\) versus \(D=1\), the odds ratio is the reciprocal: \(1/0.332871\approx 3.0042\). A negative coefficient does not mean the event probability is negative; it indicates lower odds in the group coded one.
Recovering the Coefficients From Group Counts
With a binary predictor and an intercept, the model assigns one event probability to each of the two groups. If both groups have observations with and without the event, the fitted group probabilities in this two-group model are their observed event proportions. The corresponding coefficients can be expressed as the reference-group log odds and the difference between the groups’ log odds.
Worked Example: Computing an Odds Ratio From a Two-Group Table
Suppose the observed counts are as follows. The outcome \(Y=1\) is the event, and \(D=0\) is the reference group.
| Predictor group | Event \(Y=1\) | No event \(Y=0\) | Total |
|---|---|---|---|
| \(D=0\) | 12 | 28 | 40 |
| \(D=1\) | 24 | 36 | 60 |
In the reference group, the event proportion is \(12/40=0.3\), and the event odds are \(12/28=3/7\approx 0.4286\). In the \(D=1\) group, the event proportion is \(24/60=0.4\), and the event odds are \(24/36=2/3\approx 0.6667\).
Therefore the odds ratio for \(D=1\) versus \(D=0\) is \((2/3)/(3/7)=14/9\approx 1.5556\). The odds are about 1.56 times as large in the \(D=1\) group; this is not a statement that its event probability is 1.56 times as large. The probability ratio is \(0.4/0.3=1.3333\), a different quantity.
For this two-group model, the fitted reference-group log odds are \(\hat{\beta}_0=\log(3/7)\approx -0.8473\), and the coefficient for \(D\) is \(\hat{\beta}_1=\log(14/9)\approx 0.4418\). Their sum is approximately \(-0.4055\), which equals \(\log(2/3)\), the fitted log odds in the \(D=1\) group. Exponentiating the coefficient recovers the odds ratio: \(\exp(\hat{\beta}_1)=14/9\approx 1.5556\).
The count calculation is also the maximum-likelihood fit in this two-group logistic model when each group has observations in both outcome categories. To see this, let \(y_d\) be the event count and \(n_d\) the total in group \(d\). The group’s binomial likelihood, apart from a factor not involving its probability, is \(p_d^{y_d}(1-p_d)^{n_d-y_d}\). Its log-likelihood derivative is \(y_d/p_d-(n_d-y_d)/(1-p_d)\), which is zero exactly when \(p_d=y_d/n_d\). When \(0<y_d<n_d\), the second derivative is \(-y_d/p_d^2-(n_d-y_d)/(1-p_d)^2<0\), so this stationary point is the unique maximum. The model’s two freely specified group probabilities therefore equal the observed proportions, yielding the log odds and odds ratio calculated above.
Common Mistakes and Interpretation
- Calling \(\exp(\hat{\beta}_0)\) a probability. It is the fitted reference-group odds. To get the probability, divide those odds \(o\) by \(1+o\), or apply the inverse-logit formula.
- Calling \(\hat{\beta}_1\) the odds ratio. The coefficient is the log odds ratio; \(\exp(\hat{\beta}_1)\) is the odds ratio.
- Switching the reference group without reversing the ratio. The zero-to-one odds ratio is \(\exp(\hat{\beta}_1)\); the one-to-zero odds ratio is its reciprocal, \(\exp(-\hat{\beta}_1)\).
- Interpreting an odds ratio as a probability ratio. An odds ratio of 2 means doubled odds, not doubled probability. The probabilities depend on the reference-group odds as well as on the odds ratio.
- Turning an association into a causal claim. A fitted coefficient describes the model’s comparison between the coded groups. By itself, it does not establish that changing group membership would cause an outcome change.
A reliable interpretation names the event, the two predictor values, the reference group, and the quantity being compared. For example: “The fitted event odds for \(D=1\) are \(\exp(\hat{\beta}_1)\) times the fitted event odds for \(D=0\).” If a probability is needed, calculate it separately from the fitted log odds for the group of interest.
Check Your Understanding
Use the zero-to-one comparison throughout unless a question specifies otherwise.
- In a logistic model with \(\hat{\beta}_0=-0.5\) and \(\hat{\beta}_1=0.6\), write the fitted log odds and odds at \(D=0\) and \(D=1\), and calculate the odds ratio.
- If the reference-group odds are \(0.4\) and the odds ratio for \(D=1\) versus \(D=0\) is \(3\), what are the \(D=1\) odds? What additional calculation converts those odds to a probability?
- Why is \(\exp(\hat{\beta}_0)\) not the reference-group event probability?
- A fitted coefficient for \(D\) is \(-0.7\). State the odds ratio for \(D=1\) versus \(D=0\), and describe the ratio for the reverse comparison.
- Two groups have 18 events and 42 non-events at \(D=0\), and 20 events and 30 non-events at \(D=1\). Calculate each group’s event odds and the odds ratio for \(D=1\) versus \(D=0\).