Tutorials › Regression Analysis (Undergraduate) › Include Interactions Only for Stated Scientific Questions

Purpose-Driven Model Specification · Tutorial 608 of 991

Include Interactions Only for Stated Scientific Questions

Translate a stated question about whether an association varies across groups or values into a suitable candidate interaction term.

Intermediate 10 min read

What You'll Learn

  • Define effect modification in terms of an association that varies with another predictor.
  • Translate a quantitative-by-quantitative question into a product term.
  • Identify interaction terms for quantitative-by-categorical and categorical-by-categorical questions.
  • Interpret an interaction coefficient in the units and coding of the model.
  • Explain why a scientific rationale—not a search through every possible pair—is the basis for proposing interactions.
  • Check that an interaction specification retains its constituent main effects.

Why Ask Whether an Association Varies?

A regression model without an interaction usually describes one association as applying across the values or groups of another predictor. Sometimes that is exactly the scientific question. In other cases, the question is whether the association changes—for example, whether a treatment's association with an outcome differs by baseline severity, or whether the relationship between age and an outcome differs between groups.

An interaction term gives a model a way to represent such variation. The scientific question should come first: state what association might vary, and with respect to which other variable. An interaction should not be included merely because two predictors are available or because trying many combinations might produce a small p-value.

Definition: In a regression model, effect modification means that the modeled association between a predictor and the outcome varies with the value or category of another predictor. An interaction term is a model term that allows that variation. The meaning of “association” here is tied to the model's outcome scale and functional form; it does not by itself imply a causal effect.

From a Question to a Product Term

Consider two quantitative predictors, \(X\) and \(Z\), and a quantitative outcome \(Y\). A linear regression model with an interaction can be written as

$$ Y_i=\beta_0+\beta_1X_i+\beta_2Z_i+\beta_3X_iZ_i+\varepsilon_i. $$

Here \(i\) indexes the observations, and \(X_iZ_i\) is the product of the two predictor values for observation \(i\). The parameters \(\beta_0,\beta_1,\beta_2,\beta_3\) describe the conditional mean model, while \(\varepsilon_i\) represents the part of \(Y_i\) not captured by that mean.

For linear regression, the model specifies the conditional mean of \(Y_i\) given its predictors. A common set of assumptions for fitting and conducting conventional inference includes a correctly specified conditional mean, errors with mean zero and constant variance, and independent errors; normal errors are additionally used for exact small-sample t-based inference. These are assumptions about the statistical model and data, not reasons to include a particular interaction. Here the main task is to specify a candidate mean model from a scientific question, not to claim those assumptions have been verified.

Interpretation: Under this model, the change in the conditional mean of \(Y\) for a one-unit increase in \(X\), holding \(Z\) fixed, is \(\beta_1+\beta_3Z\). Thus \(\beta_3\) describes how that \(X\)-association changes for each one-unit increase in \(Z\). Its units are outcome units per unit of \(X\) per unit of \(Z\).

The term \(\beta_1X\) alone would make the modeled \(X\)-association constant across \(Z\). The product term changes that: at different values of \(Z\), the slope for \(X\) can differ. Similarly, the \(Z\)-slope is \(\beta_2+\beta_3X\). The derivation is direct: with \(Z\) held fixed, collect the terms involving \(X\):

$$ \begin{aligned} E(Y_i\mid X_i,Z_i) &=\beta_0+\beta_1X_i+\beta_2Z_i+\beta_3X_iZ_i\\ &=(\beta_0+\beta_2Z_i)+(\beta_1+\beta_3Z_i)X_i. \end{aligned} $$

The coefficient \(\beta_1\) is therefore the \(X\)-association specifically at \(Z=0\), not a universal \(X\)-association. If zero is not a meaningful or observed value of \(Z\), that reference point may be awkward. Centering \(Z\) at a meaningful value changes the interpretation of the main-effect coefficient, while the interaction still represents change in the \(X\)-association across \(Z\).

Worked Example: Does a Treatment Association Vary With Baseline Severity?

Suppose a hypothetical clinical question asks whether the association between receiving a treatment and a follow-up symptom score varies with baseline severity. Let \(T=1\) for treatment and \(T=0\) for comparison, and let \(S\) be baseline severity points. The outcome \(Y\) is follow-up symptom score in points. A candidate model is

$$ E(Y\mid T,S)=\beta_0+\beta_1T+\beta_2S+\beta_3TS. $$

The stated question concerns variation in the treatment-group difference as baseline severity changes, so \(TS\) is the corresponding candidate interaction. At severity \(S\), the modeled difference between the treatment and comparison groups is obtained by subtracting their conditional means:

$$ \begin{aligned} E(Y\mid T=1,S)-E(Y\mid T=0,S) &=(\beta_0+\beta_1+\beta_2S+\beta_3S)-(\beta_0+\beta_2S)\\ &=\beta_1+\beta_3S. \end{aligned} $$

For an arithmetic illustration only, suppose the candidate model has coefficients \(b_1=-2\) points and \(b_3=0.4\) points per severity point. At \(S=3\), the modeled group difference is \(-2+(0.4)(3)=-0.8\) points. At \(S=8\), it is \(-2+(0.4)(8)=1.2\) points. The difference changes by \(1.2-(-0.8)=2.0\) points across those five severity points, matching \(0.4(8-3)=2.0\). These hypothetical coefficients illustrate interpretation; they are not results from a real study. Even if the treatment assignment were observational, the model would describe adjusted association rather than establish a causal treatment effect.

When One Predictor Is Categorical

A categorical predictor can also participate in an interaction. With a two-group variable \(G\), coded \(0\) and \(1\), and a quantitative predictor \(X\), the term \(GX\) allows the \(X\)-slope to differ between groups:

$$ E(Y\mid G,X)=\beta_0+\beta_1G+\beta_2X+\beta_3GX. $$

For \(G=0\), the slope for \(X\) is \(\beta_2\). For \(G=1\), it is \(\beta_2+\beta_3\). Thus \(\beta_3\) is the difference between the two group-specific slopes. The group difference at \(X=0\) is \(\beta_1\); at another value \(X\), it is \(\beta_1+\beta_3X\). As before, the reference value \(X=0\) matters when interpreting the main effect.

Worked Example: Does the Age Association Differ by Group?

A hypothetical research question asks whether the association between age and a cognitive score differs between two groups. Let \(G=0\) denote Group A, \(G=1\) denote Group B, and \(X\) be age in years. The outcome \(Y\) is a score in points. The question maps to a candidate \(GX\) term, alongside the main effects \(G\) and \(X\).

For an arithmetic illustration, suppose the candidate model uses \(b_2=0.5\) points per year and \(b_3=-0.2\) points per year. The Group A slope is \(0.5\) points per year. The Group B slope is \(0.5+(-0.2)=0.3\) points per year. Their difference is \(0.3-0.5=-0.2\) points per year, exactly the interaction coefficient. This describes different modeled age associations; it does not say that age causes the score to change.

If age is measured from 20 years rather than from zero, the group-specific slope difference remains \(-0.2\) points per year, but the group main effect is interpreted at age 20. This can make the main effect more relevant without changing the scientific question about differing slopes.

If both predictors are categorical, an interaction can represent a difference in group contrasts across categories. With two binary predictors, \(A\) and \(B\), the product \(AB\) lets the combined category's mean depart from what the two separate main effects would imply. This is useful when the scientific question is explicitly about whether the contrast for one factor differs by the level of the other.

Worked Example: Is a Program Difference Different Across Locations?

Imagine a hypothetical question about whether a program's association with an outcome differs between urban and rural locations. Let \(A=1\) for program participants and \(A=0\) otherwise; let \(B=1\) for urban and \(B=0\) for rural. Suppose the outcome is a score in points, and the four hypothetical cell means are: nonparticipants in rural locations, 10; participants in rural locations, 13; nonparticipants in urban locations, 12; participants in urban locations, 16.

The program difference in rural locations is \(13-10=3\) points. The program difference in urban locations is \(16-12=4\) points. The difference between these program contrasts is \(4-3=1\) point. A model with main effects and the product \(AB\) represents this contrast:

$$ E(Y\mid A,B)=\beta_0+\beta_1A+\beta_2B+\beta_3AB. $$

The product coefficient equals the difference in differences:

$$ \begin{aligned} \beta_3 &=\{E(Y\mid A=1,B=1)-E(Y\mid A=0,B=1)\}\\ &\quad-\{E(Y\mid A=1,B=0)-E(Y\mid A=0,B=0)\}\\ &=(16-12)-(13-10)=4-3=1\text{ point}. \end{aligned} $$

This calculation shows exactly what the interaction asks the model to represent: whether the program-group contrast differs by location. It does not establish that the program caused either difference.

Choose Interactions Deliberately

A useful specification starts with a sentence naming the association of interest and the variable that might modify it. Translate the sentence into model terms only after identifying the variables' roles and measurement. For example, “the age association differs by group” calls for an age-by-group term; “the program contrast differs across locations” calls for a program-by-location term. A vague instruction to “include interactions” does not identify a scientific question.

1
State the target association.
Name the predictor whose modeled association with the outcome is under discussion.
2
Name the possible modifier.
Specify which other predictor's values or categories might change that association.
3
Translate the question into a term.
Use the relevant product or factor interaction, respecting the variables' coding and functional forms.
4
Check the interpretation.
State what modeled slope, contrast, or difference in contrasts the term would represent, including its reference values and units.

The product term is tied to the scales used in the model. A linear interaction asks whether a slope or contrast changes linearly with the other predictor on the modeled outcome scale. If the outcome is transformed, or the predictors are represented with a different functional form, the meaning of interaction changes accordingly. A scientific question must therefore be precise about the association and scale it concerns.

For a hierarchical specification, an interaction is ordinarily accompanied by its constituent main-effect terms, even if an individual main-effect test is weak. This preserves the intended interpretation of the interaction and follows the hierarchy principle. The interaction is not a substitute for the main effects.

Common Mistake: Adding Every Possible Product

A common mistake is to form products for every pair of predictors and then retain whichever terms appear strongest in the observed data. That approach confuses a large search with a scientific rationale. It can generate unstable specifications, make findings dependent on the particular sample, and encourage overinterpretation of chance patterns. It also produces interactions that may not correspond to any meaningful question.

The correction is to propose an interaction because a specific effect-modification question calls for it, and to document that reason. If no defensible question asks whether one association varies with another predictor, a product term is not automatically needed. Conversely, a scientifically required interaction should not be discarded solely because its individual test is weak. The question guides the candidate specification; subsequent evaluation addresses the evidence and suitability of that model.

Key takeaway: Include an interaction when a stated scientific question asks whether a modeled association varies across values or groups of another predictor. Identify the relevant scale, coding, reference values, and units, and retain the constituent main effects in a hierarchical specification.

Check Your Understanding

For each question, identify the candidate interaction and state what variation it represents.

  1. A researcher asks whether the association between exercise hours and blood pressure differs by age. Which product term would represent this question if both variables are quantitative?
  2. A study asks whether the association between a continuous exposure and an outcome differs between two groups. What term allows the exposure slopes to differ, and what does its coefficient represent?
  3. In a model with \(Y=\beta_0+\beta_1X+\beta_2Z+\beta_3XZ+\varepsilon\), what is the modeled slope for \(X\) at \(Z=z\)?
  4. Why should the main effects generally remain in a model containing their interaction term?
  5. Explain why including every available pairwise product is not a sound substitute for stating effect-modification questions.