Why Evaluate Effects Across a Grid?
In an interaction model, the estimated effect of one predictor depends on the value of another predictor, called the moderator. A single conditional-effect estimate answers the question at one moderator value. Evaluating the effect at several prespecified values makes the pattern easier to compare: the estimates may increase, decrease, or remain similar across the grid. A table can show that pattern alongside its uncertainty without reducing it to a single coefficient.
Here the focus is a continuous predictor \(X\) and a continuous moderator \(Z\) in a linear model with their product \(XZ\). The target is the conditional effect of \(X\) at each selected value \(z\) of \(Z\). This is not an average over the observed cases: each row of the grid describes the effect at one specified moderator value.
The Conditional Effect in a Linear Interaction Model
Before calculating effects or intervals, specify the model and the conditions that support the interpretation and inference. Consider the model
Here \(Y_i\) is the outcome for observation \(i\), \(\beta_0,\beta_1,\beta_2,\beta_3\) are population coefficients, and \(\varepsilon_i\) is the error. The conditional mean is assumed to have this linear form. For the usual least-squares estimates and conventional standard errors, assume the errors have mean zero conditional on the predictors, are independent across observations, and have constant variance. Exact \(t\)-based confidence intervals in a finite sample also assume normally distributed errors. With four fitted coefficients and full-rank predictors, the residual degrees of freedom are \(df=n-4\). Without the normality condition, \(t\)-based intervals may instead be used as an approximation when the sample is sufficiently large.
To see why, hold \(Z\) fixed at \(z\). The terms involving \(X\) in the conditional mean are \(\beta_1X+\beta_3Xz\). Their combined coefficient on \(X\) is \(\beta_1+\beta_3z\). Equivalently, differentiating the conditional mean with respect to \(X\) gives
Thus \(\beta_1\) is the effect of \(X\) specifically at \(Z=0\), not an effect that necessarily applies at every moderator value. The interaction coefficient \(\beta_3\) describes how much the conditional effect changes for a one-unit increase in \(Z\).
Estimating Effects and Their Uncertainty at Grid Values
Let \(z_1,\ldots,z_k\) be the prespecified moderator values. At each value \(z_j\), substitute the fitted coefficients into the conditional-effect formula:
The estimate is a linear combination of two estimated coefficients. Its variance therefore depends not only on the variance of each coefficient estimate but also on their covariance:
The standard error is the square root of this variance. With the usual \(t\)-based procedure, a pointwise confidence interval at moderator value \(z_j\) is
where \(t^*_{df}\) is the chosen critical value from the \(t\) distribution with the model’s residual degrees of freedom. “Pointwise” means the interval is constructed for the effect at that one grid value. It does not, by itself, guarantee a specified confidence level for all intervals in the grid simultaneously.
Worked Example: Calculating Effects at Three Moderator Values
Suppose a hypothetical model relates a test score \(Y\), in points, to study time \(X\), in hours, and sleep deficit \(Z\), in hours. The fitted model has \(\hat{\beta}_1=1.20\) points per study hour and \(\hat{\beta}_3=-0.30\) points per study hour per hour of sleep deficit. The estimated variances are \(0.0400\) and \(0.0100\), respectively, and their estimated covariance is \(-0.0100\). The residual degrees of freedom are 36. Calculate conditional effects at the prespecified values \(z=0,2,4\).
At \(z=0\), the estimated effect is \(1.20+(-0.30)(0)=1.20\) points per study hour. Its variance is \(0.0400+0^2(0.0100)+2(0)(-0.0100)=0.0400\), so its standard error is \(\sqrt{0.0400}=0.200\). Using \(t^*_{36}=2.028\), the 95% confidence interval is \(1.20\pm2.028(0.200)\), or \((0.794,1.606)\) points per study hour.
At \(z=2\), the estimated effect is \(1.20+(-0.30)(2)=0.600\). Its variance is \(0.0400+2^2(0.0100)+2(2)(-0.0100)=0.0400\), giving a standard error of \(0.200\). The interval is \(0.600\pm2.028(0.200)=(0.194,1.006)\) points per study hour.
At \(z=4\), the estimate is \(1.20+(-0.30)(4)=0\). Its variance is \(0.0400+4^2(0.0100)+2(4)(-0.0100)=0.120\), so its standard error is \(\sqrt{0.120}=0.346\). The interval is \(0\pm2.028(0.346)=(-0.703,0.703)\) points per study hour.
A results table keeps the estimates and their uncertainty together. In this hypothetical example, the estimated association between study time and test score decreases as sleep deficit increases. These calculations describe the fitted model; they do not establish that changing study time or sleep deficit would cause a change in score.
| Sleep deficit, \(z\) (hours) | Estimated effect (points per study hour) | SE | 95% pointwise CI |
|---|---|---|---|
| 0 | 1.20 | 0.200 | (0.794, 1.606) |
| 2 | 0.600 | 0.200 | (0.194, 1.006) |
| 4 | 0 | 0.346 | (−0.703, 0.703) |
Organizing a Grid for Comparison
A useful grid table has one row per moderator value and columns for the value itself, the estimated conditional effect, its standard error, and the confidence interval. State the moderator’s units and the effect’s units in the table or nearby text. Keep enough digits to show meaningful differences, but round consistently; calculations should use unrounded values where available.
The grid values are inputs to the calculations, not estimates. The conditional-effect estimates will often be linked because they come from the same fitted coefficients. Their standard errors can differ across the grid: as the variance formula shows, both \(z_j\) and the covariance between coefficient estimates matter. Do not assume that the standard error must grow or shrink steadily as \(z_j\) changes.
Worked Example: A Grid with a Positive Interaction
In a second hypothetical model, \(X\) is weekly practice sessions, \(Z\) is a baseline score in tens of points above a reference value, and \(Y\) is a later assessment score in points. Suppose \(\hat{\beta}_1=0.80\) points per session and \(\hat{\beta}_3=0.25\) points per session per unit of \(Z\). The estimated variances are \(0.0225\) for \(\hat{\beta}_1\) and \(0.0025\) for \(\hat{\beta}_3\); their covariance is \(0.0060\). With \(df=48\), use \(t^*_{48}=2.011\) and evaluate \(z=-1,0,1\).
At \(z=-1\), the estimated effect is \(0.80+0.25(-1)=0.550\) points per session. Its variance is \(0.0225+(-1)^2(0.0025)+2(-1)(0.0060)=0.0130\), and its standard error is \(\sqrt{0.0130}=0.114\). The 95% interval is \(0.550\pm2.011(0.114)=(0.321,0.779)\).
At \(z=0\), the effect estimate is \(0.800\), its standard error is \(\sqrt{0.0225}=0.150\), and its interval is \(0.800\pm2.011(0.150)=(0.498,1.102)\).
At \(z=1\), the effect estimate is \(0.80+0.25=1.05\). Its variance is \(0.0225+0.0025+2(1)(0.0060)=0.0370\), so the standard error is \(0.192\). The interval is \(1.05\pm2.011(0.192)=(0.663,1.437)\).
The estimates increase across this grid, consistent with the positive fitted interaction coefficient. Each interval describes uncertainty at its own moderator value. The table makes the pattern easy to read while preserving that distinction.
| Baseline score \(z\) (10-point units) | Estimated effect (points per session) | SE | 95% pointwise CI |
|---|---|---|---|
| −1 | 0.550 | 0.114 | (0.321, 0.779) |
| 0 | 0.800 | 0.150 | (0.498, 1.102) |
| 1 | 1.05 | 0.192 | (0.663, 1.437) |
Reading Changes Across the Grid
Because the conditional effect is a straight-line function of \(z\), its change between any two grid values \(z_a\) and \(z_b\) is
This identity follows by subtracting the two conditional-effect estimates: \((\hat{\beta}_1+\hat{\beta}_3z_b)-(\hat{\beta}_1+\hat{\beta}_3z_a)\); the \(\hat{\beta}_1\) terms cancel, leaving \(\hat{\beta}_3(z_b-z_a)\). Thus the fitted interaction determines the rate and direction of change in the estimated effect across the grid. This comparison describes the fitted estimates; uncertainty about a difference requires its own calculation and should not be inferred just by comparing two separate intervals.
Worked Example: Describing the Change Between Grid Endpoints
Suppose a third hypothetical analysis relates a concentration score \(Y\), in points, to an exposure measure \(X\) and a moderator \(Z\), measured in units. The fitted coefficients for the effect of \(X\) are \(\hat{\beta}_1=2.40\) points per exposure unit and \(\hat{\beta}_3=-0.40\) points per exposure unit per moderator unit. For the grid \(z=0,1.5,3\), the estimated effects are \(2.40+(-0.40)(0)=2.40\), \(2.40+(-0.40)(1.5)=1.80\), and \(2.40+(-0.40)(3)=1.20\) points per exposure unit.
The endpoint difference is \(1.20-2.40=-1.20\) points per exposure unit. The same result follows directly from the interaction: \((-0.40)(3-0)=-1.20\). So the fitted effect is 1.20 points per exposure unit lower at \(z=3\) than at \(z=0\). This is a comparison of estimates; it does not alone indicate how precisely that difference has been estimated.
Common Mistake: Ignoring Covariance or Overreading the Intervals
A common mistake is to calculate the standard error of \(\hat{\beta}_1+\hat{\beta}_3z\) by adding only the two coefficient variances. That omits the covariance term \(2z\widehat{\operatorname{Cov}}(\hat{\beta}_1,\hat{\beta}_3)\), which can materially change the result. Use the full variance formula at every grid value, including its sign.
A second mistake is to interpret separate 95% pointwise intervals as though they jointly provide 95% coverage for the entire grid, or to claim that two effects differ because their intervals do not overlap. Neither conclusion follows from the separate intervals alone. Report them as pointwise intervals, and describe the estimates’ pattern cautiously. If the scientific question is specifically about a difference between effects, calculate uncertainty for that difference rather than treating visual interval comparisons as a test.
Check Your Understanding
Use the interaction model and the distinction between pointwise intervals and grid-wide conclusions to answer these questions.
- In the model \(E(Y\mid X,Z)=\beta_0+\beta_1X+\beta_2Z+\beta_3XZ\), what is the conditional effect of \(X\) when \(Z=z\)?
- Why does the variance of an estimated conditional effect include a covariance term?
- If \(\hat{\beta}_1=1.5\) and \(\hat{\beta}_3=-0.2\), calculate the estimated effect at \(z=3\), and state its units in terms of the units of \(Y\) and \(X\).
- What does a 95% pointwise confidence interval at one moderator value describe, and what does it not guarantee about a whole grid?
- Why is comparing two separate confidence intervals not, by itself, a calculation of uncertainty for the difference between the corresponding effects?