From an Interaction Model to Numerical Results
A continuous interaction means that the slope for one quantitative predictor depends on the value of another. A coefficient table gives the model estimates, but it does not directly list every conditional slope or predicted mean that might be useful. Those quantities are calculated from the coefficients at specified predictor values. Their uncertainty must also be calculated from the uncertainty in the relevant combination of coefficients.
This tutorial works through those calculations for a model with two quantitative predictors. The examples use the same hypothetical coefficient table so that the distinction between a slope, a fitted mean, and a contrast is explicit. The numbers are illustrative, not results from a real study.
The model assumes that the conditional mean has the stated form over the predictor values being considered. For the usual \(t\)-based confidence intervals in these examples, also assume independent errors with mean zero, constant variance, and a normal error distribution conditional on the predictors. The coefficient estimates must be identifiable, and the chosen predictor profiles should be supported by the data rather than requiring extrapolation.
The Hypothetical Coefficient Table
Suppose a hypothetical analysis predicts an end-of-course score \(Y\), measured in points, from weekly study time \(X\), measured in hours, and a workload index \(Z\), measured in index points. The model includes their product \(XZ\). Assume \(n=45\), giving \(df=45-4=41\) residual degrees of freedom for the four fitted coefficients.
| Coefficient | Estimate | Standard error |
|---|---|---|
| \(\beta_0\) (intercept) | 40.00 | 0.800 |
| \(\beta_1\) (study time) | 2.000 | 0.200 |
| \(\beta_2\) (workload index) | -1.500 | 0.150 |
| \(\beta_3\) (interaction \(XZ\)) | -0.300 | 0.080 |
For these worked calculations, suppose the estimated covariances between distinct coefficient estimates are all zero. This is a simplifying feature of the hypothetical example, not a general property of interaction models. In the coefficient order \((\hat{\beta}_0,\hat{\beta}_1,\hat{\beta}_2,\hat{\beta}_3)\), the estimated covariance matrix is therefore:
Each diagonal entry is the square of the corresponding standard error. In an actual coefficient table, standard errors alone do not generally determine the uncertainty of a combination of coefficients: the covariances may also be needed. Here, the stated zero covariances make each variance calculation transparent.
Conditional Slopes and Their Confidence Intervals
At a fixed workload index \(z\), the model's slope for study time is the rate at which the conditional mean score changes with one additional study hour. It is \(\beta_1+\beta_3z\). The interaction estimate is negative, so the fitted study-time slope gets smaller as the workload index increases.
Worked Example: Study-Time Slopes at Two Workload Levels
Calculate the estimated study-time slope and a 95% confidence interval at workload index \(z=4\), then repeat at \(z=6\). These values lie within the hypothetical data's stated supported workload range of 2 to 6 index points. Use \(t^*=2.020\) for \(df=41\).
At \(z=4\). The conditional slope is
Using the zero covariance specified for this example, its standard error is
The interval is
At workload index 4, the fitted mean score increases by 0.800 points for each additional weekly study hour. The interval is compatible with a positive conditional slope, though its lower endpoint is close to zero.
At \(z=6\). The estimated slope is
Its standard error and interval are
At workload index 6, the estimated conditional slope is still positive, but this interval includes zero. The model therefore estimates a smaller slope at this workload level, with substantial uncertainty about its sign.
Fitted Means at a Predictor Profile
A fitted mean is the model's estimated conditional mean outcome at specified predictor values. Substituting a profile \((x,z)\) into the fitted equation gives that estimate. To form a confidence interval, treat the prediction as a linear combination of coefficient estimates. With zero covariances in this example, its variance is the sum of each coefficient variance multiplied by the square of that coefficient's multiplier.
Worked Example: Mean Score at Five Study Hours and Workload Index Four
Calculate the fitted mean score for \(x=5\) study hours per week and \(z=4\) workload index points. Both values are within the hypothetical data's supported ranges.
Substitute the coefficient estimates into the model:
The coefficient multipliers are \(1,5,4,\) and \(20\). Thus the estimated variance of this fitted mean is
The standard error is \(\sqrt{4.5600}=2.1354\) points. Using \(t^*=2.020\), the 95% confidence interval for the conditional mean is
For people with this specified predictor profile, the model estimates a mean score of 38.00 points. The interval expresses uncertainty in that estimated mean; it is not a range that contains 95% of individual scores.
Contrasts Between Two Predicted Profiles
A profile contrast is the difference between two fitted means. If profile A is \((x_A,z_A)\) and profile B is \((x_B,z_B)\), define the contrast as fitted mean A minus fitted mean B. The intercept cancels, but the remaining coefficient multipliers depend on both profiles. Calculate the difference in this specified order so the sign has a clear interpretation.
Worked Example: Comparing Two Study and Workload Profiles
Compare profile A, \(x_A=7\) study hours and \(z_A=4\) workload points, with profile B, \(x_B=3\) study hours and \(z_B=2\) workload points. Assume both profiles are supported by the hypothetical data. Calculate the estimated difference in mean scores and its 95% confidence interval.
First calculate both fitted means:
The contrast A minus B is \(39.60-41.20=-1.60\) points. Its coefficient multipliers for \((\hat{\beta}_0,\hat{\beta}_1,\hat{\beta}_2,\hat{\beta}_3)\) are \((0,4,2,22)\): the interaction multiplier is \(7(4)-3(2)=22\). Therefore,
The standard error is
The 95% confidence interval is
The fitted mean at profile A is 1.60 points lower than at profile B, but the confidence interval includes zero. These calculations do not establish a difference in mean scores between the profiles.
Why the Calculation Details Matter
Conditional slopes, fitted means, and profile contrasts are all functions of the same coefficient estimates, but they answer different questions. A conditional slope describes a one-unit change in one predictor while holding the other fixed. A fitted mean describes the model's estimated average outcome at one predictor profile. A profile contrast compares two such estimated averages. Their uncertainty depends on the coefficient multipliers for the specific quantity being calculated.
In this example, every variance used the diagonal covariance matrix. In a general analysis, include the covariance terms: for a combination \(\sum_j c_j\hat{\beta}_j\), its estimated variance is \(\sum_j c_j^2\widehat{\operatorname{Var}}(\hat{\beta}_j)+2\sum_{j<k}c_jc_k\widehat{\operatorname{Cov}}(\hat{\beta}_j,\hat{\beta}_k)\). Omitting nonzero covariance terms can produce an incorrect standard error and interval.
- Common mistake: treating \(\hat{\beta}_1\) as the study-time slope at every workload level. The correction is to calculate \(\hat{\beta}_1+\hat{\beta}_3z\) at the particular \(z\) of interest.
- Common mistake: using only the standard error of one coefficient for a conditional slope or contrast. The correction is to identify all coefficient multipliers first, then calculate the uncertainty of that full linear combination.
- Common mistake: calling a fitted mean an individual prediction. The correction is to state that its confidence interval concerns the conditional mean at the specified profile, not the spread of individual outcomes.
- Common mistake: interpreting a contrast without naming its order. The correction is to report, for example, “profile A minus profile B”; reversing the order reverses the sign and interval endpoints.
Always attach units and predictor values to an interpretation. Here, the conditional slope is measured in score points per additional study hour, while fitted means and profile contrasts are measured in score points. Also check that the selected predictor values and combinations are adequately supported before interpreting the calculations.
Check Your Understanding
Use the model and coefficient table in this tutorial to answer the questions. For interval calculations, use \(t^*=2.020\) and the stated zero covariances.
- At workload index \(z=3\), what is the estimated conditional slope for study time, in points per hour?
- Why does the standard error of a conditional slope generally depend on the chosen workload value?
- What quantity does a confidence interval for \(\hat{Y}(x,z)\) describe: an individual outcome or a conditional mean?
- For a contrast defined as profile A minus profile B, what happens to its sign if the order is reversed?
- What extra information, beyond coefficient standard errors, may be needed to calculate a linear combination's standard error in a general fitted model?