Two Plots, Two Questions
An interaction can be displayed in more than one useful way. A plot of conditional slopes shows how the estimated effect of one predictor changes across values of a moderator. A plot of fitted mean relationships shows the model’s predicted outcome across values of a predictor, often with separate lines for selected moderator values or groups. These displays are related, but they do not answer the same question.
Choose the display according to the quantity you want readers to interpret. If the question is “How does the slope for study time vary with sleep duration?”, put sleep duration on the horizontal axis and conditional slope on the vertical axis. If the question is “What outcome does the model predict at different study times for people with different sleep durations?”, put study time on the horizontal axis and fitted outcome on the vertical axis. In either case, the labels and reference values must make the plotted quantity unambiguous.
The Model Behind the Displays
For two quantitative predictors \(X\) and \(Z\), consider the linear interaction model
Here \(Y_i\) is the outcome for observation \(i\), and \(\varepsilon_i\) is the error. For the fitted mean to be interpreted as the conditional mean, assume the model’s mean structure is appropriate: \(E(Y_i\mid X_i,Z_i)=\beta_0+\beta_1X_i+\beta_2Z_i+\beta_3X_iZ_i\). The fitted coefficients, written \(\hat{\beta}_j\), estimate the corresponding model coefficients. The plots below display fitted values or effects calculated from these estimates; they are not plots of raw observations.
The model makes these two quantities distinct. The conditional slope changes with \(z\), while a fitted mean prediction depends on both \(x\) and \(z\). The point displays in this tutorial show estimated values only; they do not show uncertainty intervals.
Deriving the Conditional Slope
To obtain the slope for \(X\), hold \(Z=z\) fixed and compare fitted means at two \(X\) values. The model’s fitted mean at \(X=x\) is
Increase \(x\) by a small amount \(h\), leaving \(z\) unchanged. The difference in fitted means is
Dividing by \(h\) gives the estimated change in fitted mean per one-unit increase in \(X\). Thus the conditional slope is \(\hat{\beta}_1+\hat{\beta}_3z\). This formula supplies the vertical coordinate for a conditional-slope plot. For a fitted-mean plot, instead calculate the full fitted mean at each chosen combination of \(x\) and \(z\).
Worked Example: Plotting a Slope Across Sleep Values
Worked Example: Plotting a Slope Across Sleep Values
Suppose a hypothetical model relates exam score \(Y\), in points, to study time \(X\), in hours per week, and sleep duration \(Z\), in hours per night. Its estimated equation is
The question is how the estimated study-time slope changes with sleep duration, so a conditional-slope plot is the direct choice. From the interaction formula, the estimated slope for study time at sleep duration \(z\) is
For example, at \(z=6\) hours of sleep, the slope is \(4-0.5(6)=1\) point per study hour. To construct the plot, calculate a few coordinates:
Plot the points \((4,2)\), \((6,1)\), and \((8,0)\), and connect them with a straight line because the estimated slope is linear in sleep duration. Label the horizontal axis “Sleep duration (hours/night)” and the vertical axis “Estimated change in exam score (points) per additional study hour.” The line communicates that, in this fitted model, the study-time slope declines by 0.5 exam points per additional hour of sleep. It does not show predicted exam scores.
Worked Example: Plotting Fitted Means for Selected Values
Worked Example: Plotting Fitted Means for Selected Values
Use the same hypothetical model, \(\hat{Y}=52+4X+1.5Z-0.5XZ\). Now the question is how predicted exam scores vary with study time for people with different sleep durations. This calls for a fitted-mean plot with study time on the horizontal axis and predicted exam score on the vertical axis. Choose two clearly stated sleep values, \(Z=4\) and \(Z=8\) hours per night, and calculate fitted scores at \(X=2,5,8\) study hours per week.
At \(Z=4\), the fitted equation reduces to \(\hat{Y}=52+1.5(4)+(4-0.5(4))X=58+2X\). Therefore, the three fitted values are \(58+2(2)=62\), \(58+2(5)=68\), and \(58+2(8)=74\) points.
At \(Z=8\), the fitted equation reduces to \(\hat{Y}=52+1.5(8)+(4-0.5(8))X=64+0X\). The fitted value is \(64+0(2)=64\) points at \(X=2\), \(64+0(5)=64\) points at \(X=5\), and \(64+0(8)=64\) points at \(X=8\).
| Study time (hours/week) | Predicted score at 4 hours of sleep (points) | Predicted score at 8 hours of sleep (points) |
|---|---|---|
| 2 | 62 | 64 |
| 5 | 68 | 64 |
| 8 | 74 | 64 |
Plot study time on the horizontal axis, labelled in hours per week, and predicted exam score on the vertical axis, labelled in points. Use one line for “Sleep = 4 hours/night” and another for “Sleep = 8 hours/night.” The first line rises by 2 points per additional study hour; the second is horizontal because its conditional slope is zero. These lines display fitted mean relationships at the stated sleep values, not individual students’ scores.
Worked Example: Making Group References Explicit
Worked Example: Making Group References Explicit
Suppose a hypothetical study models a response score \(Y\) using session count \(X\) and program group \(G\), where \(G=0\) denotes the standard program and \(G=1\) denotes the new program. The estimated model is
For the standard program, substitute \(G=0\): \(\hat{Y}=10+2X\). For the new program, substitute \(G=1\): \(\hat{Y}=15+1.5X\). If the question concerns predicted response scores across session counts, plot fitted means rather than conditional slopes. For session counts \(X=0,4,8\), the standard-program predictions are \(10+2(0)=10\), \(10+2(4)=18\), and \(10+2(8)=26\) score units. The new-program predictions are \(15+1.5(0)=15\), \(15+1.5(4)=21\), and \(15+1.5(8)=27\) score units.
The horizontal axis should read “Number of sessions,” and the vertical axis should name the response score and its units. The legend should identify “Standard program (\(G=0\))” and “New program (\(G=1\)).” Because the model predicts different fitted scores for the two groups at the same session count, the plotted lines make the group contrast across session counts visible. The \(X=0\) predictions are the fitted means at zero sessions, so the axis and accompanying text should not leave the group coding implicit.
Choosing Values and Building a Readable Display
A plot is most informative when the plotted values connect directly to the question. For a conditional-slope plot, choose moderator values and compute the corresponding slope at each one. For a fitted-mean plot, choose values of the horizontal predictor and calculate predictions for each displayed moderator value or group. The chosen values are part of the definition of the display: a line labelled only “low” or “high” is difficult to interpret unless those labels have precise numerical meanings.
Before presenting an interaction plot, check that its visual elements answer basic questions:
- What is on each axis? Name the variable or quantity, its role in the model, and its units.
- Which values are being held fixed? State each moderator value, or define every group and its reference coding.
- What does a plotted point represent? Distinguish a fitted mean outcome from a conditional slope.
- What is the fitted pattern? Describe the direction and, where relevant, how the slope changes across the moderator.
Use the values in the model’s original units when that makes the display easiest to read. If predictors were centered, explain what zero represents before using it as a reference. For example, zero on a centered age variable may represent age 30 years rather than age zero. A plotted prediction at a given centered value must be translated back to its original meaning in the axis label or caption.
These plots are summaries of a fitted model. They do not establish that changing a predictor would cause the predicted outcome to change, and they do not show how uncertain the fitted values are. A point estimate or line alone should not be presented as though it were exact.
Common Mistakes
- Putting the wrong quantity on the vertical axis. A conditional slope is not a predicted outcome. Label a slope axis in outcome units per unit of the predictor; label a fitted-mean axis in outcome units.
- Leaving the moderator values unstated. Lines for “low” and “high” moderator values are not reproducible or interpretable unless the values are specified.
- Reading the intercept as a typical prediction. The intercept is the fitted mean when all model predictors equal zero. That may not be a substantively meaningful profile, particularly with uncentered predictors.
- Assuming different-looking lines prove a real difference. A point-estimate display shows the pattern implied by the fitted coefficients. It does not, by itself, establish that the interaction or any particular conditional effect is statistically distinguishable from zero.
The correction is to decide first which model quantity answers the scientific question, calculate it from the fitted model, and label both the units and reference values. Keep the plotted interpretation at the level of the model’s fitted pattern.
Check Your Understanding
Try these questions using the distinction between conditional slopes and fitted mean predictions.
- In \(\hat{Y}=8+3X+2Z-0.4XZ\), what expression gives the estimated slope for \(X\) at \(Z=z\), and what are its units if \(Y\) is measured in points and \(X\) in hours?
- A researcher wants to show predicted outcome values across \(X\) for two specified values of \(Z\). Which quantity belongs on the vertical axis?
- For the model in question 1, calculate the conditional slope at \(Z=5\).
- Why should a legend state the actual moderator values rather than only saying “low” and “high”?
- What does a fitted-mean plot communicate that a conditional-slope plot does not directly show?