From a Grouped Logistic Fit to an Absolute Contrast
A grouped logistic regression describes the probability of success for groups of trials. If group \(j\) has \(y_j\) successes among \(n_j\) trials and covariate vector \(x_j\), the model assigns that group a success probability through its linear predictor. Once a model has been fitted, it can provide predicted probabilities for chosen covariate profiles. Subtracting two such probabilities gives an absolute risk difference.
An odds ratio and a risk difference answer different questions. An odds ratio compares odds multiplicatively; a risk difference compares probabilities additively. The logistic coefficients make odds ratios particularly direct to express, but the absolute change in probability depends on the probabilities at the profiles being compared. The practical task here is to make that probability-scale comparison explicitly.
For a logistic model with coefficient vector \(\beta\), the probability at profile \(x\) is $$ p(x)=\operatorname{expit}(x^\mathsf{T}\beta) =\frac{\exp(x^\mathsf{T}\beta)}{1+\exp(x^\mathsf{T}\beta)} =\frac{1}{1+\exp(-x^\mathsf{T}\beta)}. $$ In a fitted model, replace \(\beta\) by its estimate \(\hat{\beta}\). The resulting plug-in prediction is \(\hat p(x)=\operatorname{expit}(x^\mathsf{T}\hat\beta)\), and the plug-in risk difference is \(\hat p(x_1)-\hat p(x_0)\). Each profile must specify the covariate values used in the prediction; the contrast is not fully described by naming one coefficient alone.
Worked Probability-Scale Contrasts
The calculations below use the inverse-logit transformation on the fitted linear predictors. They show why the absolute contrast should be computed from the two probabilities rather than inferred from the odds ratio.
Worked Example: Comparing Two Specified Profiles
Suppose a fitted grouped-logistic model gives a linear predictor of \(-1.6\) for a reference profile and \(-0.5\) for a comparison profile. Calculate the fitted probabilities and the risk difference, oriented as comparison minus reference.
For the reference profile, $$ \hat p_0=\operatorname{expit}(-1.6) =\frac{1}{1+\exp(1.6)} \approx 0.1679816. $$ For the comparison profile, $$ \hat p_1=\operatorname{expit}(-0.5) =\frac{1}{1+\exp(0.5)} \approx 0.3775407. $$ Subtracting the full-precision fitted probabilities gives $$ \widehat{\operatorname{RD}}=\hat p_1-\hat p_0 =0.3775407\ldots-0.1679816\ldots =0.2095591\ldots\approx 0.2096. $$ Thus the comparison profile has a fitted success probability about 20.96 percentage points higher than the reference profile. The rounded displayed probabilities, \(0.3775\) and \(0.1680\), should not be used to decide the final rounding: their rounded subtraction is \(0.2095\), whereas the full-precision difference rounds to \(0.2096\).
Worked Example: The Same Odds Ratio at One Baseline Risk
Consider a model with an intercept of \(-2\) and a binary treatment indicator \(A\), where \(A=0\) is the reference and the treatment coefficient is \(0.8\). Calculate the two fitted probabilities, their risk difference, and the odds ratio.
At \(A=0\), the linear predictor is \(-2\), so $$ \hat p_0=\operatorname{expit}(-2) =\frac{1}{1+\exp(2)} \approx 0.1192029. $$ At \(A=1\), the linear predictor is \(-2+0.8=-1.2\), so $$ \hat p_1=\operatorname{expit}(-1.2) =\frac{1}{1+\exp(1.2)} \approx 0.2314752. $$ The absolute difference is $$ \widehat{\operatorname{RD}}=0.2314752\ldots-0.1192029\ldots =0.1122723\ldots\approx 0.1123. $$ That is an increase of about 11.23 percentage points. In this model, the treatment coefficient is the change in log odds when \(A\) changes from 0 to 1. Therefore the odds ratio is $$ \widehat{\operatorname{OR}}=\exp(0.8)\approx 2.2255. $$ The fitted odds are multiplied by about 2.23, while the fitted probability rises by about 0.1123. These are two different summaries of the same pair of fitted probabilities, expressed on different scales.
How an Odds Ratio Relates to a Risk Difference
For a binary covariate with no interaction, write the linear predictor as \(\alpha+\beta A\), with \(A=0\) for the reference profile and \(A=1\) for the comparison profile. The reference probability is \(p_0=\operatorname{expit}(\alpha)\); the comparison probability is \(p_1=\operatorname{expit}(\alpha+\beta)\). The odds ratio is \(\exp(\beta)\). The next result expresses the risk difference using that odds ratio and the reference probability.
Derivation. Starting from the definition of \(R\), multiply both sides by \(p_0(1-p_1)\): $$ R p_0(1-p_1)=p_1(1-p_0). $$ Collect the terms involving \(p_1\): $$ R p_0=p_1(1-p_0+R p_0). $$ Since \(1-p_0+R p_0\) is positive, division gives $$ p_1=\frac{R p_0}{1-p_0+R p_0}. $$ Subtract \(p_0\) and combine terms over the same denominator: $$ p_1-p_0 =\frac{R p_0-p_0(1-p_0+R p_0)}{1-p_0+R p_0} =\frac{p_0(1-p_0)(R-1)}{1-p_0+R p_0}. $$ For the logistic model, the odds at \(A=0\) are \(\exp(\alpha)\), and those at \(A=1\) are \(\exp(\alpha+\beta)\). Their ratio is \(\exp(\beta)\), establishing the final statement. \(\square\)
This expression shows exactly why an odds ratio does not, by itself, determine an absolute risk difference: the difference also depends on \(p_0\), the reference probability. When \(R>1\), the numerator is positive, so the difference is positive; when \(R<1\), it is negative; and when \(R=1\), it is zero. The same multiplicative change in odds can therefore produce different probability changes at different baseline risks.
Worked Example: One Odds Ratio, Two Baseline Risks
Suppose two models or covariate settings have the same odds ratio \(R=2\), but reference probabilities of \(0.10\) and \(0.50\). Calculate each comparison probability and risk difference.
For \(p_0=0.10\), $$ p_1=\frac{2(0.10)}{1-0.10+2(0.10)} =\frac{0.20}{1.10} \approx 0.1818. $$ The risk difference is \(0.1818\ldots-0.10=0.0818\ldots\), or about 8.18 percentage points.
For \(p_0=0.50\), $$ p_1=\frac{2(0.50)}{1-0.50+2(0.50)} =\frac{1.00}{1.50} \approx 0.6667. $$ The risk difference is \(0.6667\ldots-0.50=0.1667\ldots\), or about 16.67 percentage points. Both comparisons double the odds, but their absolute probability changes differ because their starting probabilities differ.
Profile-Specific Differences When Effects Interact
When the logistic model includes an interaction, the coefficient for a binary exposure is not necessarily the log odds ratio for every covariate profile. The interaction changes that coefficient across profiles. It is therefore especially useful to calculate each fitted probability at the covariate values of interest and subtract the two probabilities within each profile. The following example makes both the interaction and the probability-scale contrasts explicit.
Worked Example: Risk Differences in Two Strata
Let \(A\) be a binary exposure and \(Z\) a binary stratum indicator. Suppose the fitted model is $$ \hat\eta=-2+2Z+1A-0.5AZ, $$ with fitted probability \(\hat p=\operatorname{expit}(\hat\eta)\). Calculate the risk difference for \(A=1\) versus \(A=0\) separately at \(Z=0\) and \(Z=1\).
At \(Z=0\), the interaction term is zero. The reference profile \((A=0,Z=0)\) has predictor \(-2\) and probability $$ \hat p_{0,0}=\operatorname{expit}(-2)\approx 0.1192029. $$ The comparison profile \((A=1,Z=0)\) has predictor \(-2+1=-1\), hence $$ \hat p_{1,0}=\operatorname{expit}(-1)\approx 0.2689414. $$ Thus $$ \widehat{\operatorname{RD}}_{Z=0} =0.2689414\ldots-0.1192029\ldots =0.1497385\ldots\approx 0.1497. $$
At \(Z=1\), the reference profile \((A=0,Z=1)\) has predictor \(-2+2=0\), giving \(\hat p_{0,1}=\operatorname{expit}(0)=0.5\). The comparison profile \((A=1,Z=1)\) has predictor \(-2+2+1-0.5=0.5\), giving $$ \hat p_{1,1}=\operatorname{expit}(0.5)\approx 0.6224593. $$ Therefore $$ \widehat{\operatorname{RD}}_{Z=1} =0.6224593\ldots-0.5000000 =0.1224593\ldots\approx 0.1225. $$ The two risk differences are not equal. In this model, the log odds ratio for \(A\) is \(1\) at \(Z=0\), but \(1-0.5=0.5\) at \(Z=1\). Thus the corresponding odds ratios are \(\exp(1)\approx2.7183\) and \(\exp(0.5)\approx1.6487\). The calculation compares probabilities within each stratum; it does not average or pool the strata.
Interpretation and Common Pitfalls
A fitted risk difference is tied to the exact profiles compared, the fitted model, and the coding of the outcome as success. State the direction of subtraction and describe the profiles in context. For example, “the fitted probability for the comparison profile minus the reference profile is 0.1123” specifies the orientation; “the risk difference is 0.1123” without saying which profile is subtracted from which can be ambiguous.
The word “risk” here refers to a modelled success probability. A difference between fitted probabilities is a descriptive, model-based contrast. Giving it a causal interpretation requires additional design and identification assumptions; fitting a logistic regression alone does not establish those assumptions. Likewise, for grouped data, the prediction corresponds to the covariate profile supplied to the model. It does not automatically describe every individual within an aggregated group.
Common mistake: treating an odds ratio as a percentage-point change. The incorrect reasoning is: “The odds ratio is 2, so the probability is doubled,” or “an odds ratio of 2 means a 100-percentage-point increase.” Neither follows. An odds ratio of 2 doubles the odds, not the probability. The correction is to obtain both fitted probabilities at the profiles of interest and subtract them. The baseline probability is needed to translate the odds ratio into a probability-scale difference.
A second practical pitfall is subtracting probabilities that have been rounded too early. Compute the inverse-logit probabilities at adequate precision, subtract them, and round the final difference. This matters when the requested answer is precise to a particular decimal place, as the first worked example demonstrates.
Check Your Understanding
Use the inverse-logit probabilities at the profiles being compared, and state the direction of each difference.
- A reference profile has fitted probability \(0.18\), and a comparison profile has fitted probability \(0.26\). What is the risk difference, and how many percentage points does it represent?
- In a logistic model with a binary covariate and no interaction, what does the exponential of that covariate’s coefficient represent? What additional value is needed to determine the risk difference?
- Explain why an odds ratio of 2 can correspond to different risk differences for reference probabilities \(0.10\) and \(0.50\).
- In the interaction example, why should the risk difference be calculated separately at \(Z=0\) and \(Z=1\)?
- Does a positive fitted risk difference, by itself, establish that changing the exposure causes the outcome probability to increase? Explain briefly.