Tutorials › Generalized Linear Models › Interaction Effects as Ratios of Ratios

Count Effects and Predictions · Tutorial 471 of 981

Interaction Effects as Ratios of Ratios

See how a two-predictor interaction makes one predictor’s expected-count ratio depend on the level of the other predictor.

Intermediate 10 min read

What You'll Learn

  • Write the two-predictor log-mean model with an interaction term
  • Derive an expected-count ratio for a finite change in one predictor
  • Express how that ratio changes across levels of the other predictor
  • Interpret the interaction coefficient for binary and continuous predictors
  • Distinguish a ratio of expected counts from a ratio of observed counts
  • Identify how predictor coding and scale affect interaction interpretation

Why an Interaction Is a Ratio of Ratios

In a log-mean model, a predictor’s effect on the expected count is often expressed as a ratio: compare the expected count at one predictor value with the expected count at another. With an interaction, that ratio can itself change across levels of a second predictor. The natural comparison is then a ratio of ratios: the expected-count ratio at one level of the second predictor, divided by the corresponding ratio at another level.

This is useful because an interaction coefficient can otherwise be difficult to interpret on the log scale. The ratio-of-ratios expresses it on the multiplicative scale of expected counts, while making clear which predictor changes and which predictor defines the comparison.

The Two-Predictor Log-Mean Model

Let \(Y\) be a count response and let \(x\) and \(z\) be two predictors. Write the conditional expected count as \(\mu(x,z)=E[Y\mid x,z]\). In a Poisson GLM with a log link and a product interaction, the model is

$$ \log \mu(x,z)=\beta_0+\beta_1x+\beta_2z+\beta_3xz, \qquad \mu(x,z)=\exp(\beta_0+\beta_1x+\beta_2z+\beta_3xz). $$

Here \(\beta_3\) is the interaction coefficient. The expected count is positive for every finite linear predictor. The algebra below concerns the conditional mean; it does not compare two realized counts, which may differ from their expected values because of random variation.

Definition: For a change in \(x\) from \(x\) to \(x+\Delta\), at a fixed value \(z\), the expected-count ratio is \(\mu(x+\Delta,z)/\mu(x,z)\). For two levels \(z_0\) and \(z_1\), the ratio of these expected-count ratios is $$ \frac{\mu(x+\Delta,z_1)/\mu(x,z_1)} {\mu(x+\Delta,z_0)/\mu(x,z_0)}. $$

The model is linear in \(x\) and \(z\) on the log-mean scale, not necessarily on the count scale. The interaction term \(xz\) makes the slope with respect to \(x\) depend on \(z\), which is precisely why the expected-count ratio for a given change in \(x\) can differ between levels of \(z\).

Deriving the Ratio of Ratios

Theorem: Under the two-predictor log-mean model above, for any finite \(x,z_0,z_1,\Delta\), the ratio of the expected-count ratio for changing \(x\) by \(\Delta\) at \(z_1\) to the corresponding ratio at \(z_0\) is $$ \frac{\mu(x+\Delta,z_1)/\mu(x,z_1)} {\mu(x+\Delta,z_0)/\mu(x,z_0)} =\exp\{\beta_3\Delta(z_1-z_0)\}. $$ This result requires positive conditional means, as supplied by the finite log-mean model.

Proof. At a fixed \(z\), subtract the log mean at \(x\) from the log mean at \(x+\Delta\):

$$ \begin{aligned} \log\frac{\mu(x+\Delta,z)}{\mu(x,z)} &=\log\mu(x+\Delta,z)-\log\mu(x,z)\\ &=\{\beta_0+\beta_1(x+\Delta)+\beta_2z+\beta_3(x+\Delta)z\}\\ &\quad-\{\beta_0+\beta_1x+\beta_2z+\beta_3xz\}\\ &=\Delta(\beta_1+\beta_3z). \end{aligned} $$

Thus the expected-count ratio at \(z\) is \(\exp\{\Delta(\beta_1+\beta_3z)\}\). Divide this ratio at \(z_1\) by the ratio at \(z_0\), or subtract their logarithms:

$$ \begin{aligned} \log\left[ \frac{\mu(x+\Delta,z_1)/\mu(x,z_1)} {\mu(x+\Delta,z_0)/\mu(x,z_0)} \right] &=\Delta(\beta_1+\beta_3z_1)-\Delta(\beta_1+\beta_3z_0)\\ &=\beta_3\Delta(z_1-z_0). \end{aligned} $$

Exponentiating both sides gives the stated identity. The terms \(\beta_0\), \(\beta_1\), and \(\beta_2\) cancel from the ratio of ratios; only the interaction term determines how the \(x\)-ratio changes across \(z\). \(\square\)

The result also shows what a zero interaction means. If \(\beta_3=0\), the ratio of ratios is 1 for every such comparison, so the expected-count ratio for a fixed change in \(x\) is the same at every \(z\). Conversely, for any nonzero \(\Delta\) and \(z_1-z_0\), a ratio of ratios of 1 implies \(\beta_3=0\) in this model.

Worked Examples

Worked Example: Two Binary Predictors

Suppose \(x\) indicates a treatment (0 = control, 1 = treatment) and \(z\) indicates a patient group (0 = group A, 1 = group B). Consider

$$ \log\mu(x,z)=\log(10)+\log(1.5)x+\log(2)z+\log(1.4)xz. $$

At \(z=0\), the expected-count ratio for treatment versus control is

$$ \frac{\mu(1,0)}{\mu(0,0)} =\exp\{\log(1.5)\}=1.5. $$

At \(z=1\), it is

$$ \frac{\mu(1,1)}{\mu(0,1)} =\exp\{\log(1.5)+\log(1.4)\}=1.5(1.4)=2.1. $$

Therefore, the ratio of the treatment expected-count ratio in group B to that in group A is \(2.1/1.5=1.4\). The cell means verify this directly: \(\mu(0,0)=10\), \(\mu(1,0)=15\), \(\mu(0,1)=20\), and \(\mu(1,1)=42\). Hence

$$ \frac{42/20}{15/10}=\frac{2.1}{1.5}=1.4 =\exp\{\beta_3\}. $$

Because both predictors are binary and each comparison changes its indicator from 0 to 1, the interaction coefficient is the logarithm of this ratio of ratios.

Worked Example: A Two-Unit Change Across Continuous Predictor Levels

Suppose \(x\) and \(z\) are continuous, and the log-mean model is

$$ \log\mu(x,z)=\log(5)+0.08x+0.04z-0.03xz. $$

Compare a two-unit increase in \(x\), from \(x=1\) to \(x=3\), at \(z=0\) and \(z=3\). At \(z=0\), the ratio is

$$ \frac{\mu(3,0)}{\mu(1,0)} =\exp\{2(0.08-0.03(0))\} =\exp(0.16)\approx1.174. $$

At \(z=3\), the ratio is

$$ \frac{\mu(3,3)}{\mu(1,3)} =\exp\{2(0.08-0.03(3))\} =\exp(-0.02)\approx0.980. $$

The ratio of these two ratios is approximately \(0.980/1.174\approx0.835\). The theorem gives the same result directly:

$$ \exp\{\beta_3\Delta(z_1-z_0)\} =\exp\{(-0.03)(2)(3-0)\} =\exp(-0.18)\approx0.835. $$

Thus, for this two-unit increase in \(x\), the expected-count ratio at \(z=3\) is about 0.835 times the ratio at \(z=0\). It does not mean that either expected count is 0.835 times the other; it compares the two \(x\)-ratios.

Worked Example: A Binary Predictor Modified by a Continuous Predictor

Let \(x\) indicate whether an exposure is present (0 = absent, 1 = present), and let \(z\) be a continuous measure. Suppose

$$ \log\mu(x,z)=\log(8)+(\log 2)x-0.10z+0.05xz. $$

At \(z=0\), the expected-count ratio for exposure present versus absent is \(\exp(\log 2)=2\). At \(z=10\), the ratio is

$$ \frac{\mu(1,10)}{\mu(0,10)} =\exp\{\log 2+0.05(10)\} =2e^{0.5}\approx3.297. $$

The ratio of the exposure ratios at \(z=10\) and \(z=0\) is therefore \(3.297/2=e^{0.5}\approx1.649\). This agrees with the general formula using \(\Delta=1\) and \(z_1-z_0=10\):

$$ \exp\{\beta_3\Delta(z_1-z_0)\} =\exp\{0.05(1)(10)\} =e^{0.5}. $$

Here the interaction says that the exposure expected-count ratio is multiplied by about 1.649 as \(z\) increases by 10 units. This is a comparison of ratios, not a claim that the expected count itself increases by that factor.

Binary Predictors and the Four-Mean Identity

For two binary predictors, the ratio-of-ratios interpretation can be written directly in terms of the four conditional means. Let \(\mu_{xz}=\mu(x,z)\), where \(x,z\in\{0,1\}\). The ratio for changing \(x\) from 0 to 1 at \(z=1\) is \(\mu_{11}/\mu_{01}\); at \(z=0\), it is \(\mu_{10}/\mu_{00}\). Their ratio is

$$ \frac{\mu_{11}/\mu_{01}}{\mu_{10}/\mu_{00}} =\frac{\mu_{11}\mu_{00}}{\mu_{01}\mu_{10}}. $$
Result: In the binary-by-binary log-mean model \(\log\mu_{xz}=\beta_0+\beta_1x+\beta_2z+\beta_3xz\), the four-mean ratio above equals \(\exp(\beta_3)\).

Proof. Taking logarithms of the four-mean ratio gives

$$ \begin{aligned} \log\frac{\mu_{11}\mu_{00}}{\mu_{01}\mu_{10}} &=\log\mu_{11}+\log\mu_{00}-\log\mu_{01}-\log\mu_{10}\\ &=(\beta_0+\beta_1+\beta_2+\beta_3)+\beta_0\\ &\quad-(\beta_0+\beta_2)-(\beta_0+\beta_1)\\ &=\beta_3. \end{aligned} $$

Exponentiating proves the result. Positivity of the four means ensures the ratios and logarithms are defined. \(\square\)

This identity is the expected-count analogue of a difference of differences on the log scale. It also makes the null interpretation precise: \(\beta_3=0\) exactly when the two \(x\)-ratios are equal, or equivalently when this four-mean ratio equals 1.

Interpreting the Coefficient and Avoiding Common Errors

For continuous predictors, \(\beta_3\) is the change in the log expected-count ratio for a one-unit increase in \(z\), for a one-unit change in \(x\). More generally, the ratio of ratios is \(\exp\{\beta_3\Delta(z_1-z_0)\}\). If this quantity exceeds 1, the \(x\)-ratio is larger at \(z_1\) than at \(z_0\); if it is below 1, the ratio is smaller. The sign of \(\beta_3\) alone describes the direction only after the directions of \(\Delta\) and \(z_1-z_0\) have been specified.

A common mistake is to interpret \(\exp(\beta_3)\) as the expected-count ratio for changing \(x\). In the general model, the ratio for a one-unit change in \(x\) at \(z\) is \(\exp(\beta_1+\beta_3z)\), not \(\exp(\beta_3)\). The latter is the ratio of those \(x\)-ratios when \(z\) increases by one unit and \(x\) changes by one unit. It equals the ratio of ratios for the 0-to-1 comparisons in the binary-by-binary model.

Another frequent error is to describe a ratio of ratios as a ratio of counts at two different predictor profiles. The comparison instead has four expected means: first form the \(x\)-ratio at each specified \(z\), then divide one ratio by the other. Finally, the interaction depends on predictor units and coding. Changing a continuous predictor’s unit changes the numerical coefficient, and reversing the order of either comparison reverses the corresponding contrast. State the predictor changes and reference levels whenever reporting the interpretation.

Key takeaway: In a log-mean model with an \(xz\) interaction, changing \(x\) by \(\Delta\) changes its expected-count ratio across \(z_0\) and \(z_1\) by the factor \(\exp\{\beta_3\Delta(z_1-z_0)\}\). Interpret that factor as a comparison of expected-count ratios, not as a stand-alone count effect.

Check Your Understanding

For each question, identify the predictor changes before interpreting the comparison.

  1. In the two-predictor log-mean model, what is the expected-count ratio for changing \(x\) by \(\Delta\) at a fixed \(z\)?
  2. If \(\beta_3=0\), what does the model imply about the expected-count ratio for a fixed change in \(x\) across levels of \(z\)?
  3. For binary \(x\) and \(z\), express the ratio of the \(x\)-ratio at \(z=1\) to the \(x\)-ratio at \(z=0\) using the four conditional means.
  4. If \(\beta_3<0\), must the \(x\)-ratio be smaller at \(z_1\) than at \(z_0\)? State what additional direction information is needed.
  5. Why is \(\exp(\beta_3)\) not generally the expected-count ratio for a one-unit increase in \(x\)?
Clinical Biostats