Tutorials › Generalized Linear Models › Worked Risk-Ratio Contrasts Under The Log Link

Alternative Binary Links · Tutorial 377 of 981

Worked Risk-Ratio Contrasts Under The Log Link

Translate log-binomial coefficients into fitted risks and reference-group risk ratios, including comparisons adjusted for covariates.

Intermediate 9 min read

What You'll Learn

  • Calculate fitted risks from a log-binomial model with categorical predictors
  • Interpret exponentiated coefficients as risk ratios against a reference category
  • Form risk ratios for comparisons between two nonreference categories
  • Calculate covariate-adjusted risks and contrasts at specified covariate values
  • Check that fitted probabilities are feasible for the covariate patterns being interpreted
  • Distinguish risk ratios from odds ratios

From a Log-Binomial Model to a Risk Ratio

A log-binomial model is especially useful when the scientific question is about relative risks rather than odds. Its coefficients have a direct multiplicative interpretation: a coefficient for a predictor corresponds to a change in the log of the risk, so exponentiating it gives a risk ratio. To make that interpretation useful, however, we must specify the comparison being made, the reference category, and which other covariates are held fixed.

Let \(Y_i\) be a binary response for subject \(i\), with \(Y_i=1\) denoting the event of interest. Write \(p_i=P(Y_i=1\mid x_i)=E[Y_i\mid x_i]\). For a log-binomial model, the conditional mean is related to a linear predictor by the log link.

Definition: A log-binomial model has conditional response \(Y_i\mid x_i\sim\operatorname{Bernoulli}(p_i)\) and linear predictor \(\eta_i=x_i^\mathsf{T}\beta\), with \( \log(p_i)=\eta_i \), or equivalently \(p_i=\exp(\eta_i)\). A valid fitted risk must satisfy \(0\leq p_i\leq 1\) for every covariate pattern to which the model is applied.

Categorical predictors are represented by indicator variables relative to a chosen reference category. In a main-effects model, a coefficient for one category compares that category with the reference category while the other predictors are held fixed. The model’s risk-ratio interpretation is conditional on those specified covariate values; it is not automatically a comparison of averages over different covariate distributions.

Reference-Category Contrasts

Suppose a categorical predictor \(G\) has reference level \(0\) and two other levels, \(1\) and \(2\). Let \(I(G=1)\) and \(I(G=2)\) be indicators for those nonreference levels. With other covariates collected in \(z\), a model with no interactions involving \(G\) can be written

$$ \log p(G,z)=\beta_0+\beta_1 I(G=1)+\beta_2 I(G=2)+z^\mathsf{T}\gamma. $$

At a fixed covariate value \(z\), the reference-category risk is \(\exp(\beta_0+z^\mathsf{T}\gamma)\). The risk at level \(1\) is that same quantity multiplied by \(\exp(\beta_1)\); the risk at level \(2\) is multiplied by \(\exp(\beta_2)\). Therefore, \(\exp(\beta_1)\) and \(\exp(\beta_2)\) are risk ratios against the reference level. To compare levels \(1\) and \(2\) directly, subtract their linear predictors: the log risk ratio is \(\beta_1-\beta_2\), so the risk ratio is \(\exp(\beta_1-\beta_2)\).

Result: For two covariate patterns \(x_a\) and \(x_b\) in a log-binomial model, their fitted risk ratio is \( \hat p(x_a)/\hat p(x_b)=\exp\{(x_a-x_b)^\mathsf{T}\hat\beta\} \), provided both fitted risks are positive. A reference-group comparison uses the same formula with the reference pattern as \(x_b\).

This result follows directly from the inverse link, not from a rare-outcome approximation. It applies to any specified pair of patterns, although interpreting a contrast as the effect of one predictor alone requires the two patterns to agree on the other covariates.

Worked Example: Three Exposure Groups

Suppose a fitted model has a three-level exposure: usual care is the reference, and the other levels are program A and program B. There are no other predictors. The fitted log-binomial model is \( \log p=\log(0.12)+\log(1.5)I(A)+\log(0.75)I(B) \). Calculate the fitted risk for each group, the two reference-group risk ratios, and the risk ratio for A versus B.

For usual care, both indicators are zero, so \( \hat p_{\text{usual}}=\exp\{\log(0.12)\}=0.12 \).

For program A, \(I(A)=1\) and \(I(B)=0\), giving \( \hat p_A=\exp\{\log(0.12)+\log(1.5)\}=0.12(1.5)=0.18 \). The reference-group risk ratio is \(0.18/0.12=1.5\), matching the exponentiated A coefficient.

For program B, \( \hat p_B=\exp\{\log(0.12)+\log(0.75)\}=0.12(0.75)=0.09 \). Its risk ratio against usual care is \(0.09/0.12=0.75\). Both nonreference fitted risks, as well as the reference risk, lie between zero and one.

The direct comparison of A with B is \( \hat p_A/\hat p_B=0.18/0.09=2 \). Equivalently, the difference in their log risks is \(\log(1.5)-\log(0.75)=\log(1.5/0.75)=\log(2)\), and exponentiating gives \(2\). Program A has twice the fitted risk of program B in this model.

Why the Contrast Formula Works

The risk-ratio calculation is a general property of the log link. It is worth deriving explicitly because the coefficient itself is on the log-risk scale, whereas the reported comparison is usually on the risk-ratio scale.

Derivation: Let the fitted risks at two patterns be \(\hat p(x_a)=\exp(x_a^\mathsf{T}\hat\beta)\) and \(\hat p(x_b)=\exp(x_b^\mathsf{T}\hat\beta)\). If \(\hat p(x_b)>0\), then
$$ \frac{\hat p(x_a)}{\hat p(x_b)} = \frac{\exp(x_a^\mathsf{T}\hat\beta)} {\exp(x_b^\mathsf{T}\hat\beta)} = \exp\{(x_a-x_b)^\mathsf{T}\hat\beta\}. $$
Thus, a contrast in the linear predictor becomes a log risk ratio, and its exponential is the fitted risk ratio. \(\square\)

For a categorical predictor, the design-vector difference specifies exactly which coefficients contribute. If the comparison is between two nonreference categories, both indicator coefficients enter, with opposite signs. If the comparison changes one category while keeping every other predictor fixed, the coefficients for those unchanged predictors cancel.

Covariate-Adjusted Risks

Adjustment means comparing fitted risks at the same values of the other predictors. In a main-effects model, the covariates can substantially change the fitted risks themselves, while canceling from the risk ratio for a particular categorical predictor. The next result states the condition precisely: the predictor must enter additively on the log-risk scale, without an interaction that changes its coefficient across covariate values.

Result: Suppose \(A\) is binary and the model is \( \log p(A,z)=\beta_0+\beta_A A+q(z) \), where \(q(z)\) is any specified function of the other covariates that does not depend on \(A\). At any fixed \(z\) with positive fitted risks, the fitted risk ratio comparing \(A=1\) with \(A=0\) is \(\exp(\beta_A)\).

To prove this, evaluate the fitted risks at the same \(z\), first with \(A=1\) and then with \(A=0\):

$$ \frac{p(1,z)}{p(0,z)} = \frac{\exp\{\beta_0+\beta_A+q(z)\}} {\exp\{\beta_0+q(z)\}} = \exp(\beta_A). $$

The shared intercept and covariate term cancel, which establishes the result. In a fitted model, the same calculation uses \(\hat\beta_A\), giving \(\exp(\hat\beta_A)\). The covariate values still matter for each absolute risk and for checking whether those risks are feasible. \(\square\)

Worked Example: Treatment Risk Ratio Adjusted for Age and Smoking

Suppose \(A=1\) indicates treatment, age is measured in decades above age 50, and \(S=1\) indicates smoking. Consider the fitted model \( \log p=\log(0.08)+\log(1.4)A+\log(1.1)\text{Age}+\log(1.25)S \). Calculate the control and treatment risks for a 60-year-old smoker, then calculate the adjusted treatment risk ratio.

For this subject, \(\text{Age}=1\) and \(S=1\). Under control, \(A=0\), so \( \hat p(0,1,1)=0.08(1.1)(1.25)=0.11 \). The intermediate multiplication is \(0.08(1.1)=0.088\), and \(0.088(1.25)=0.11\).

Under treatment, \(A=1\), so \( \hat p(1,1,1)=0.08(1.4)(1.1)(1.25)=0.154 \). The treatment risk is \(0.11(1.4)=0.154\). Both fitted risks are feasible, and their ratio is \(0.154/0.11=1.4\).

The treatment risk ratio is therefore 1.4 at these age and smoking values. The same ratio applies at any other covariate values for which the model is used and both risks are positive, because this model contains no treatment-by-covariate interactions. The absolute risks need not be the same at those other values.

Worked Example: Comparing Two Categories After Adjustment

Suppose an exposure has reference level \(R\), level \(A\), and level \(B\), and the fitted main-effects model is \( \log p=\log(0.05)+\log(1.5)I(A)+\log(0.8)I(B)+\log(1.1)\text{Age}+\log(1.2)U \). Here age is measured in decades above 50 and \(U=1\) denotes an urban site. Find the fitted risks for all three exposure levels at age 70 in an urban site, and compare A directly with B.

At age 70, \(\text{Age}=2\), and at an urban site \(U=1\). The reference-level risk is \( \hat p_R=0.05(1.1)^2(1.2)=0.05(1.21)(1.2)=0.0726 \).

For A, multiply the reference risk by 1.5: \( \hat p_A=0.0726(1.5)=0.1089 \). For B, multiply it by 0.8: \( \hat p_B=0.0726(0.8)=0.05808 \). Each fitted risk is below one.

The direct A-versus-B risk ratio is \(0.1089/0.05808=1.875\). The same answer follows from the coefficients: the A coefficient minus the B coefficient is \(\log(1.5)-\log(0.8)=\log(1.5/0.8)\), and \(1.5/0.8=1.875\). The age and site terms affect each fitted risk but cancel in this same-profile comparison.

Interpreting and Reporting the Result

A clear report identifies both the comparison and what is held fixed. For example: “At the specified age and smoking status, the fitted risk under treatment is 1.4 times the fitted risk under control.” If the model has no treatment-by-covariate interactions, the conditional ratio is constant across covariate profiles, but the statement should still identify the fitted model and target population. A risk ratio of 1.4 means a 40% higher risk relative to the comparator; it does not mean a 40-percentage-point increase.

The log-binomial model also differs from logistic regression in a crucial interpretive detail. Exponentiated logistic-regression coefficients are odds ratios, whereas exponentiated log-binomial coefficients are risk ratios. These quantities are close when risks are small, but generally differ otherwise.

Common Mistakes

  • Calling an exponentiated coefficient an odds ratio. In a log-binomial model it is a risk ratio. The link is applied to the probability, not to the odds.
  • Using a coefficient for the wrong comparison. A nonreference coefficient compares its category with the reference category. For two nonreference categories, subtract their coefficients before exponentiating.
  • Changing covariates while claiming to isolate one predictor. A conditional contrast for a categorical predictor compares profiles that agree on the other covariates.
  • Reporting only a ratio when absolute risks are needed. A ratio of 1.5 can correspond to risks of 0.02 and 0.03 or to risks of 0.40 and 0.60. Calculate and report fitted risks when their magnitudes matter.
  • Ignoring feasibility. The exponential of a linear predictor is positive, but it is not automatically at most one. Interpret fitted risks only at covariate patterns where the model gives valid probabilities.
Key takeaway: In a log-binomial model, calculate each fitted risk by exponentiating its linear predictor. A risk ratio is obtained by subtracting the two linear predictors and exponentiating the difference; for a reference-category contrast, this is the exponentiated relevant coefficient or coefficient contrast.

Check Your Understanding

Use the fitted log-risk structure, the reference category, and the covariate profile to make each comparison precise.

  1. A three-level predictor has reference risk \(0.10\), with fitted coefficients \(\log(1.3)\) and \(\log(0.7)\) for levels A and B. Find the three fitted risks and the risk ratio for A versus B.
  2. In a main-effects model, treatment has coefficient \(\log(1.6)\), while age and smoking also appear in the linear predictor. What is the fitted treatment risk ratio at a fixed age and smoking status?
  3. Why must the coefficients for two nonreference categories be subtracted to compare those categories directly?
  4. Give one reason a fitted risk ratio does not by itself describe the absolute risks in the two groups.
  5. A log-binomial coefficient exponentiates to 1.4. Explain why this is not generally an odds ratio, and state its risk-ratio interpretation.
Clinical Biostats