Tutorials › Generalized Linear Models › Odds Ratios from Grouped Binomial Fits

Grouped Binomial Regression · Tutorial 396 of 981

Odds Ratios from Grouped Binomial Fits

Translate fitted grouped-logistic linear predictors into odds and calculate odds ratios for specified covariate contrasts.

Intermediate 10 min read

What You'll Learn

  • Define success odds and connect them to the logistic linear predictor
  • Calculate fitted odds from estimated grouped-logistic coefficients
  • Derive an odds ratio for any two specified covariate patterns
  • Interpret continuous, categorical, and interaction terms on the odds scale
  • Distinguish an odds ratio from a probability ratio or probability difference
  • Check odds-ratio calculations without introducing rounding error

From Grouped Probabilities to Odds

A grouped-binomial model describes success counts among groups of trials. Its fitted probability is often the most direct summary, but the logistic link gives a second, especially convenient scale: the success-odds scale. On that scale, a change in the linear predictor corresponds to a multiplicative change in odds. This makes it possible to interpret a coefficient or a comparison between two covariate patterns using one exponential calculation.

Let group \(i\) have \(n_i\) trials and \(Y_i\) successes, with \(Y_i\sim\operatorname{Binomial}(n_i,p_i)\). In grouped logistic regression, the success probability is modeled as \(\operatorname{logit}(p_i)=\log\{p_i/(1-p_i)\}=x_i^{\mathsf T}\beta\), where \(x_i\) is the covariate vector and \(\beta\) is the coefficient vector. The model concerns the success probability for a trial at the specified covariate pattern; the group size \(n_i\) tells us how many trials contribute to the group, not a new covariate effect on the odds.

Definition: For a success probability \(p\) with \(0<p<1\), the success odds are \(p/(1-p)\). In a logistic model with linear predictor \(\eta=x^{\mathsf T}\beta\), the odds are \(\exp(\eta)\). An odds ratio comparing two covariate patterns is the success odds at the second pattern divided by the success odds at the first.

The odds are not the probability. If \(p=0.20\), the odds are \(0.20/0.80=0.25\), or one success for every four failures. If the odds are \(o\), the corresponding probability is \(o/(1+o)\). These quantities are related, but they are not interchangeable: multiplying odds by a factor does not generally multiply probability by the same factor.

Why the Logistic Linear Predictor Is a Log-Odds

The logistic link is defined by \(\operatorname{logit}(p)=\log\{p/(1-p)\}\). Applying the exponential function to both sides shows why the linear predictor has a direct odds interpretation.

Result: If \(0<p<1\) and \(\operatorname{logit}(p)=\eta\), then the success odds are \(\exp(\eta)\), and the probability corresponding to odds \(o>0\) is \(o/(1+o)\).

Proof. Starting from the definition of the logit, \[ \log\left(\frac{p}{1-p}\right)=\eta. \] Exponentiating both sides gives \(p/(1-p)=\exp(\eta)\), which is the success odds. Conversely, if \(o=p/(1-p)\), then \(o(1-p)=p\), so \(o=p(1+o)\) and \(p=o/(1+o)\). Since \(\eta\) is finite, \(\exp(\eta)>0\), and the corresponding probability lies strictly between zero and one. \(\square\)

In practice, the coefficients are estimated. Replacing \(\beta\) by its fitted value \(\hat{\beta}\) gives the fitted linear predictor \(\hat{\eta}=x^{\mathsf T}\hat{\beta}\) and fitted odds \(\exp(\hat{\eta})\). These are model-based fitted quantities, not observed odds calculated directly from a particular group’s count. For example, an observed group with zero successes has observed odds zero, while a finite fitted logistic predictor yields positive fitted odds.

Worked Example: A One-Unit Increase in Dose

Suppose a grouped logistic fit for a dose \(x\), measured in milligrams, is \(\hat{\eta}(x)=-2+0.4x\). Calculate the fitted odds at 2 mg and 3 mg, and compare the doses.

At 2 mg, \(\hat{\eta}(2)=-2+0.4(2)=-1.2\). The fitted odds are \(\exp(-1.2)=0.301194\ldots\), or approximately \(0.3012\).

At 3 mg, \(\hat{\eta}(3)=-2+0.4(3)=-0.8\). The fitted odds are \(\exp(-0.8)=0.449329\ldots\), or approximately \(0.4493\).

The contrast is one milligram, so the fitted odds ratio for 3 mg versus 2 mg is \(\exp\{0.4(3-2)\}=\exp(0.4)=1.491824\ldots\), or approximately \(1.492\). Thus the fitted success odds at 3 mg are about 1.492 times those at 2 mg. This ratio is calculated from the unrounded model values; dividing displayed, rounded odds can give a slightly different final digit.

Odds Ratios for General Covariate Contrasts

A coefficient by itself is not always the answer to a comparison question. The comparison should first be expressed as two covariate vectors. This is particularly important when the model includes several predictors or interactions.

Theorem: Suppose two covariate patterns \(x_a\) and \(x_b\) have finite linear predictors \(x_a^{\mathsf T}\beta\) and \(x_b^{\mathsf T}\beta\) in the same logistic model. The success-odds ratio for pattern \(b\) versus pattern \(a\) is \(\exp\{(x_b-x_a)^{\mathsf T}\beta\}\). The fitted odds ratio is \(\exp\{(x_b-x_a)^{\mathsf T}\hat{\beta}\}\).

Proof. By the preceding result, the odds at \(x_b\) are \(\exp(x_b^{\mathsf T}\beta)\), and those at \(x_a\) are \(\exp(x_a^{\mathsf T}\beta)\). Their ratio is \[ \frac{\exp(x_b^{\mathsf T}\beta)}{\exp(x_a^{\mathsf T}\beta)} =\exp\{x_b^{\mathsf T}\beta-x_a^{\mathsf T}\beta\} =\exp\{(x_b-x_a)^{\mathsf T}\beta\}. \] Replacing \(\beta\) with \(\hat{\beta}\) gives the fitted odds ratio by the same algebra. \(\square\)

This formula also explains the familiar coefficient interpretations. If \(x_j\) is a numeric predictor with no interaction terms involving it, increasing \(x_j\) by one unit while holding all other predictors fixed changes the linear predictor by \(\beta_j\). The odds ratio for that increase is \(\exp(\beta_j)\). A change of \(d\) units has odds ratio \(\exp(d\beta_j)\), not generally \(d\exp(\beta_j)\).

For a categorical predictor, a coefficient usually compares one level with a reference level, with other covariates held fixed. The particular coefficient depends on the coding, but a fully specified contrast has an odds ratio given by the general formula. With an interaction, the contrast may depend on the value of another covariate, so a single coefficient need not describe the odds ratio at every covariate pattern.

Worked Example: Treatment Odds Ratio at a Fixed Age

Suppose the fitted model is \(\hat{\eta}(T,A)=-3+0.7T+0.05A\), where \(T=1\) denotes treatment, \(T=0\) denotes control, and \(A\) is age in years. Compare treatment with control at age 50.

For control at age 50, the fitted predictor is \(-3+0.7(0)+0.05(50)=-0.5\). Its fitted odds are \(\exp(-0.5)=0.606530\ldots\).

For treatment at age 50, the fitted predictor is \(-3+0.7(1)+0.05(50)=0.2\). Its fitted odds are \(\exp(0.2)=1.221403\ldots\).

The treatment-versus-control contrast changes \(T\) by one and leaves age unchanged. Therefore the fitted odds ratio is \(\exp(0.7)=2.013753\ldots\), or approximately \(2.014\). Equivalently, using the unrounded fitted odds gives \(\exp(0.2)/\exp(-0.5)=\exp(0.7)\). The coefficient for age cancels because both patterns have the same age.

Interactions Make Odds Ratios Depend on the Comparison

When a model includes an interaction, the effect of changing one predictor can vary with another predictor. Consider \(\eta(x,T)=\beta_0+\beta_x x+\beta_T T+\beta_{xT}xT\), where \(T\) is binary. At a fixed value \(x\), changing \(T\) from 0 to 1 changes the linear predictor by \(\beta_T+\beta_{xT}x\), so the treatment odds ratio is \(\exp(\beta_T+\beta_{xT}x)\). The main-effect coefficient \(\beta_T\) is the treatment log-odds contrast specifically at \(x=0\).

Worked Example: Treatment Odds Ratios With an Interaction

Suppose \(\hat{\eta}(x,T)=-2+0.3x+0.6T+0.2xT\). Calculate the treatment-versus-control fitted odds ratio at \(x=0\) and at \(x=2\), then verify the second comparison using fitted odds.

At \(x=0\), the treatment contrast in the predictor is \(0.6+0.2(0)=0.6\). The fitted odds ratio is \(\exp(0.6)=1.822119\ldots\), or approximately \(1.822\).

At \(x=2\), the contrast is \(0.6+0.2(2)=1.0\). Thus the fitted odds ratio is \(\exp(1)=2.718282\ldots\), or approximately \(2.718\).

To verify, the control predictor at \(x=2\) is \(-2+0.3(2)=-1.4\), giving fitted odds \(\exp(-1.4)=0.246597\ldots\). The treatment predictor is \(-2+0.3(2)+0.6+0.2(2)=-0.4\), giving fitted odds \(\exp(-0.4)=0.670320\ldots\). Their ratio, using the unrounded values, is \(\exp(-0.4)/\exp(-1.4)=\exp(1)=2.718282\ldots\). The interaction makes the treatment odds ratio larger at \(x=2\) than at \(x=0\).

A Practical Calculation and Interpretation Workflow

For a specified comparison, it is safer to work from the two covariate patterns than to choose a coefficient by inspection. This is especially useful when categorical coding or interactions are present.

1
Write both patterns.
Record every predictor value for the reference pattern and the comparison pattern, including the coding of categorical variables.
2
Calculate the predictor contrast.
Compute \((x_b-x_a)^{\mathsf T}\hat{\beta}\), or calculate each fitted predictor and subtract.
3
Exponentiate once.
The fitted odds ratio for pattern \(b\) versus pattern \(a\) is the exponential of that predictor contrast.
4
State the comparison in context.
Identify which pattern is in the numerator and describe the result as a multiplicative comparison of success odds.

Group sizes do not appear in this contrast formula. For any fixed fitted coefficients and covariate patterns, the fitted odds and their ratio follow from the linear predictor. Different group trial totals affect how much information the grouped observations provide when estimating the coefficients, but they do not change the algebraic interpretation of a given coefficient vector.

Common Mistake: Calling an Odds Ratio a Probability Multiplier

A frequent mistake is to interpret an odds ratio of 2 as “the probability doubles.” That is not what the model says. An odds ratio of 2 means that the success odds at one covariate pattern are twice the success odds at the other. The corresponding probability change depends on the starting probability.

For example, if the starting probability is \(0.20\), the odds are \(0.20/0.80=0.25\). Doubling the odds gives \(0.50\), which corresponds to probability \(0.50/(1+0.50)=1/3\), not \(0.40\). If the starting probability is \(0.50\), the odds are 1; doubling them gives odds 2 and probability \(2/(1+2)=2/3\), not 1. In both cases the odds double, but the resulting probabilities differ.

A second calculation pitfall is to divide odds that have already been rounded and expect to recover the exact odds ratio. Rounding can change the last displayed digits. Calculate a contrast directly from the fitted linear predictors, or retain sufficient precision until the final result and round the odds ratio separately.

Key takeaway: In grouped logistic regression, fitted odds at covariate pattern \(x\) are \(\exp(x^{\mathsf T}\hat{\beta})\). For any two patterns, the fitted odds ratio is \(\exp\{(x_b-x_a)^{\mathsf T}\hat{\beta}\}\). Interpret that ratio as a comparison of odds, not as a probability multiplier.

Check Your Understanding

Answer each question by identifying the covariate contrast and keeping odds separate from probabilities.

  1. A fitted model is \(\hat{\eta}(x)=-1+0.25x\). What are the fitted odds at \(x=4\), and what is the fitted odds ratio for \(x=6\) versus \(x=4\)?
  2. In a model with a binary treatment indicator and no interactions, what does \(\exp(\hat{\beta}_T)\) compare when treatment is coded 1 and control is coded 0?
  3. For \(\eta(x,T)=\beta_0+\beta_xx+\beta_TT+\beta_{xT}xT\), derive the treatment-versus-control odds ratio at a specified value \(x=c\).
  4. Why can’t an odds ratio of 1.5 generally be described as a 50% increase in success probability?
  5. Two grouped observations have different trial totals but the same covariate pattern. If the fitted coefficients are fixed, what determines their fitted odds, and what role do their trial totals play in estimation?
Clinical Biostats