Tutorials › Regression Analysis (Undergraduate) › Reading Conditional Slopes from Two-Predictor Interactions

Simple Slopes and Marginal Effects · Tutorial 369 of 991

Reading Conditional Slopes from Two-Predictor Interactions

Derive and interpret the slope of one predictor at chosen values of a second quantitative predictor in a regression model with an interaction.

Intermediate 9 min read

What You'll Learn

  • Write a two-predictor regression model with a product interaction term
  • Derive the slope of one predictor conditional on the value of the other
  • Interpret the main-effect and interaction coefficients in context
  • Calculate conditional slopes at specified moderator values
  • Check coefficient units, predictor scales, and relevant data ranges
  • Avoid treating a main-effect coefficient as the slope at every moderator value

Why a Predictor’s Slope Can Depend on Another Predictor

In a regression model with two quantitative predictors, the relationship between one predictor and the expected outcome need not be the same at every value of the other predictor. For example, an additional hour of study might be associated with a larger score increase for students who slept more. A product term lets a regression model describe this changing slope. The key task in this tutorial is to read the slope at a particular value of the second predictor.

The second predictor is often called a moderator when the association between the first predictor and the outcome varies with it. Here, “slope” means the change in the model’s expected outcome associated with a one-unit increase in the predictor, with the moderator held fixed. It describes a fitted association; by itself, it does not establish causation.

The Two-Predictor Interaction Model

Let \(X\) and \(Z\) be quantitative predictors and let \(Y\) be the outcome. The usual linear model containing their two-way interaction is

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

The coefficients \(\beta_0,\beta_1,\beta_2,\beta_3\) are fixed but unknown model parameters, and \(\varepsilon_i\) is the error for observation \(i\). The corresponding fitted regression equation replaces each parameter with its estimate \(b_0,b_1,b_2,b_3\).

Model assumptions: For interpreting the equation as a model for the conditional mean, assume \(E(\varepsilon_i\mid X_i,Z_i)=0\), so the conditional mean is represented by the stated regression terms. The model also assumes that this conditional mean is adequately described by the included terms over the predictor values of interest. For the usual regression inference, additional assumptions about errors, such as independence and constant variance, may be required. The algebraic slope formula below follows directly from the model equation; it does not require an inference procedure.

The interaction term \(X_iZ_i\) is the product of the two predictors for observation \(i\). The model includes both main effects, \(X_i\) and \(Z_i\), as well as their product. Including the product without the corresponding main effects generally changes the model’s meaning and can impose an inappropriate restriction.

Deriving the Conditional Slope

To find the slope for \(X\) at a specified value of \(Z\), hold \(Z=z\) fixed in the conditional mean. The terms involving \(X\) can then be collected:

$$ \begin{aligned} E(Y\mid X,Z=z) &=\beta_0+\beta_1X+\beta_2z+\beta_3Xz\\ &=(\beta_0+\beta_2z)+(\beta_1+\beta_3z)X. \end{aligned} $$

At this fixed value of \(Z\), the conditional mean is a straight line in \(X\). Its intercept is \(\beta_0+\beta_2z\), and its slope is \(\beta_1+\beta_3z\). Therefore, the conditional slope of \(X\) at \(Z=z\) is:

Result: In the model with the product \(XZ\), the slope of \(X\) when \(Z=z\) is \(\beta_1+\beta_3z\). For a fitted model, the estimated conditional slope is \(b_1+b_3z\).

The same result can be justified using a finite change rather than a derivative. If \(X\) increases from \(x\) to \(x+\Delta x\) while \(Z=z\) remains fixed, the difference in the expected outcome is:

$$ \begin{aligned} &E(Y\mid X=x+\Delta x,Z=z)-E(Y\mid X=x,Z=z)\\ &=\beta_1\Delta x+\beta_3z\Delta x\\ &=(\beta_1+\beta_3z)\Delta x. \end{aligned} $$

Thus, for a one-unit increase in \(X\), the expected outcome changes by \(\beta_1+\beta_3z\) units at \(Z=z\). This difference calculation also shows why the slope does not depend on the starting value \(x\): at each fixed \(z\), the model’s conditional mean is linear in \(X\).

The coefficient \(\beta_1\) is the slope of \(X\) specifically when \(Z=0\), because \(\beta_1+\beta_3(0)=\beta_1\). The coefficient \(\beta_3\) describes how the slope of \(X\) changes when \(Z\) increases by one unit. If \(Z\) increases by \(\Delta z\), the conditional slope changes by \(\beta_3\Delta z\). Meanwhile, \(\beta_2\) describes the slope of \(Z\) when \(X=0\); it is not the slope of \(X\).

Worked Example: A Dose Slope at Two Marker Values

Suppose a hypothetical fitted model predicts enzyme activity \(Y\), measured in activity units, from dose \(X\), measured in milligrams per day, and a baseline marker \(Z\), measured in marker points:

$$ \widehat{Y}=12+1.8X-0.4Z-0.25XZ. $$

The estimated slope of dose at marker value \(z\) is \(b_1+b_3z=1.8-0.25z\), in activity units per milligram per day.

At \(Z=2\) marker points, substitute \(z=2\):

$$ 1.8+(-0.25)(2)=1.8-0.50=1.30. $$

At this marker value, a one-milligram-per-day increase in dose is associated with an estimated 1.30-unit increase in expected enzyme activity, according to the fitted model.

At \(Z=6\) marker points:

$$ 1.8+(-0.25)(6)=1.8-1.50=0.300. $$

Here, the estimated dose slope is 0.300 activity units per milligram per day. The two estimated slopes differ by \(1.30-0.300=1.00\) activity unit per milligram per day. That change also follows from the interaction coefficient: \((-0.25)(6-2)=-1.00\). These are fitted associations, not evidence that changing a person’s dose would cause the stated change in enzyme activity.

Interpreting the Coefficients and Their Units

The interaction coefficient’s units combine the units of the outcome and both predictors. In the dose example, \(\beta_3\) is measured in activity units per (milligram per day) per marker point. Multiplying it by \(z\), measured in marker points, gives the same units as the slope of \(X\): activity units per milligram per day. Keeping track of units is a useful check that the formula has been interpreted correctly.

The zero value in “the slope when \(Z=0\)” matters. If zero is outside the meaningful range of \(Z\), or is simply an arbitrary value, the main-effect coefficient \(\beta_1\) may not describe a practically relevant slope. The conditional-slope formula is still valid, but interpretation should focus on moderator values that make sense for the question and the data. Calculating a slope far outside the observed range can amount to extrapolation.

Worked Example: Commute Distance and Traffic

Consider a hypothetical fitted model for commute time \(Y\), in minutes, using distance \(X\), in kilometres, and a traffic index \(Z\), in index points:

$$ \widehat{Y}=8+2.4X+1.1Z+0.7XZ. $$

The estimated slope of distance at traffic index \(z\) is \(2.4+0.7z\) minutes per kilometre. At \(Z=1.5\), the calculation is:

$$ 2.4+(0.7)(1.5)=2.4+1.05=3.45 \quad\text{minutes per kilometre}. $$

Thus, at traffic index 1.5, each additional kilometre of distance is associated with an estimated 3.45-minute increase in the model’s expected commute time. At \(Z=0.5\), the estimated slope is \(2.4+(0.7)(0.5)=2.75\) minutes per kilometre. The difference, \(3.45-2.75=0.70\), is \(b_3\) multiplied by the one-point difference in traffic index.

The coefficient \(b_2=1.1\) is not used to calculate either distance slope. It is the estimated traffic-index slope when distance is zero. This example also illustrates why a reported “distance coefficient” alone does not tell the full story when the product term is in the model.

How the Conditional Slope Changes Across the Moderator

The formula \(b_1+b_3z\) is a straight-line function of \(z\). If \(b_3>0\), the estimated slope of \(X\) becomes larger as \(Z\) increases; if \(b_3<0\), it becomes smaller. If \(b_3=0\), the fitted slope of \(X\) does not vary with \(Z\), although the model may still contain a \(Z\) main effect.

A conditional slope can also change sign. This happens when \(b_1+b_3z=0\), if that equation has a solution. The value \(z=-b_1/b_3\) is only meaningful for this purpose when \(b_3\ne0\), and it should be interpreted cautiously if it falls outside the observed moderator range. Finding a zero crossing describes the fitted equation; it does not, on its own, establish that the slope differs statistically from zero.

Worked Example: A Slope That Changes Sign

Suppose a hypothetical model predicts quiz score \(Y\), in points, from study time \(X\), in hours, and sleep \(Z\), in hours:

$$ \widehat{Y}=40+4X+2Z-0.6XZ. $$

The estimated study-time slope at sleep duration \(z\) is \(4-0.6z\) quiz points per study hour. At \(Z=2\) hours:

$$ 4-(0.6)(2)=4-1.2=2.8 \quad\text{quiz points per study hour}. $$

At \(Z=5\) hours, the slope is \(4-(0.6)(5)=1.0\) quiz point per study hour. At \(Z=8\) hours, it is \(4-(0.6)(8)=-0.8\) quiz points per study hour. Under this fitted equation, the estimated association between study time and quiz score is positive at \(Z=5\), but negative at \(Z=8\).

The slope is zero where \(4-0.6z=0\), so \(z=4/0.6=6.67\) hours (to three significant figures). This zero crossing is a feature of the fitted slopes. Whether it is substantively useful depends on whether sleep durations near 6.67 hours are represented in the data and whether the model is appropriate there.

A Practical Reading Sequence

When reading a fitted two-predictor interaction model, identify the predictor whose slope is requested, identify the moderator value, and then use the matching coefficient pair. For the slope of \(X\) at \(Z=z\), those coefficients are \(b_1\) and \(b_3\). Substitute the given \(z\), calculate, and state the result with units and context.

1
Identify the model terms.
Find the coefficient of \(X\) and the coefficient of the product \(XZ\); these are \(b_1\) and \(b_3\).
2
Set the moderator value.
Use the specified value \(z\) of \(Z\), with its original scale and units.
3
Calculate and interpret.
Compute \(b_1+b_3z\), then describe the fitted change in expected \(Y\) for a one-unit increase in \(X\) at that moderator value.

This calculation gives a point estimate of a conditional slope. It does not provide its standard error, confidence interval, or test of whether it differs from zero. Those require additional calculations and are separate questions from reading the slope formula.

Common Mistakes and Why They Matter

  • Using \(b_1\) as the slope everywhere. That is only the slope at \(Z=0\). At another value \(z\), use \(b_1+b_3z\).
  • Using the wrong coefficient. The slope of \(X\) depends on the coefficient of \(X\) and the coefficient of \(XZ\). The coefficient of \(Z\) describes a different conditional slope.
  • Leaving out the moderator value. A conditional slope is not fully specified until the value of \(Z\) is stated. “The slope is 2” is incomplete without naming the moderator value and units.
  • Ignoring units or scale. The numerical answer depends on how \(Z\) is measured. If \(Z\) is measured in points, use the supplied value in points, not a rescaled value without also rescaling the coefficient.
  • Turning association into causation. A fitted conditional slope describes the model’s expected outcome pattern. Causal language requires a design and assumptions beyond the interaction equation.
  • Extrapolating without warning. A calculated value is algebraically available at any \(z\), but slopes at moderator values far beyond the data may not be reliable descriptions of the observed setting.
Key takeaway: In a model containing \(X\), \(Z\), and \(XZ\), the fitted slope of \(X\) at moderator value \(Z=z\) is \(b_1+b_3z\). The main-effect coefficient \(b_1\) is only the slope at \(Z=0\); the interaction coefficient \(b_3\) determines how that slope changes with \(Z\).

Check Your Understanding

For each question, show the relevant substitution and state the result in context when units are provided.

  1. A fitted model is \(\widehat{Y}=5+3X+2Z-0.4XZ\). What is the estimated slope of \(X\) when \(Z=5\)?
  2. In the model \(Y=\beta_0+\beta_1X+\beta_2Z+\beta_3XZ+\varepsilon\), what does \(\beta_1\) represent, and why is it not generally the slope of \(X\) for every value of \(Z\)?
  3. If \(b_3\) is positive, how does the fitted slope of \(X\) change as \(Z\) increases by two units?
  4. A model predicts sales in dollars from advertising in hundreds of dollars, \(X\), and store size in square metres, \(Z\). What are the units of the interaction coefficient?
  5. Why might a conditional slope calculated at a moderator value far outside the observed data range be difficult to interpret?