Why an Interaction Matters
A fertilizer increase may have a different association with crop yield under different irrigation conditions. If a model includes fertilizer and irrigation only as separate additive terms, it assumes the fertilizer slope is identical at every irrigation level. An interaction allows that slope to vary by group. The practical question is not merely whether fertilizer and irrigation are each related to yield, but whether the estimated fertilizer response differs between irrigation levels.
The example throughout this tutorial is hypothetical. Imagine an experiment in which fertilizer rates and two irrigation levels are assigned to separate plots. Let \(x\) denote fertilizer rate in units of 10 kg/ha, so \(x=1\) means 10 kg/ha. Let \(I=0\) denote lower irrigation and \(I=1\) higher irrigation. Yield, \(Y\), is measured in tonnes per hectare (t/ha).
The Interaction Model
For two irrigation levels and a quantitative fertilizer predictor, a linear interaction model is
Here \(\beta_0,\beta_1,\beta_2,\beta_3\) are population regression coefficients, and \(\varepsilon_i\) is the error for plot \(i\). The interaction term is the product \(x_iI_i\). When \(I=0\), that product is zero; when \(I=1\), it equals \(x\). Thus the model gives a separate fertilizer slope for each irrigation level while retaining one equation.
The coefficients depend on the chosen reference group and units. Here, \(\beta_0\) is the mean yield at \(x=0\) under lower irrigation; \(\beta_2\) is the difference in mean yield between irrigation levels at \(x=0\). If fertilizer were measured in kg/ha rather than units of 10 kg/ha, the numerical slopes would be one tenth as large, with the same physical interpretation after units are stated.
Before using ordinary least-squares estimates and the usual \(t\)-based uncertainty calculations, the model needs appropriate conditions. The conditional mean of yield should follow the stated linear form over the fertilizer rates being analyzed. Errors from separate plots should be independent, have mean zero at each combination of predictors, and have a common variance. For exact small-sample \(t\) inference, the errors are also assumed normally distributed. In an experiment, random assignment of treatment combinations can support causal comparisons; in observational data, fitted relationships alone do not establish causation.
Worked Example: Fit the Group-Specific Lines
Worked Example: Fit the Group-Specific Lines
Suppose the hypothetical experiment has three plots at each of three fertilizer rates under each irrigation level. The rates are \(x=0,1,2\), and the observed yields are:
| Irrigation | Yield at \(x=0\) (t/ha) | Yield at \(x=1\) (t/ha) | Yield at \(x=2\) (t/ha) |
|---|---|---|---|
| Lower (\(I=0\)) | 3.8, 4.0, 4.2 | 4.8, 5.0, 5.2 | 5.8, 6.0, 6.2 |
| Higher (\(I=1\)) | 4.3, 4.5, 4.7 | 5.8, 6.0, 6.2 | 7.3, 7.5, 7.7 |
The cell means are 4, 5, and 6 t/ha for lower irrigation, and 4.5, 6, and 7.5 t/ha for higher irrigation. Since the fertilizer rates are equally spaced, the lower-irrigation slope is
The higher-irrigation slope is
The fitted lower-irrigation line has intercept 4 and slope 1. The higher-irrigation line has intercept 4.5 and slope 1.5. Matching these lines to the model gives \(\hat{\beta}_0=4.00\), \(\hat{\beta}_1=1.00\), \(\hat{\beta}_2=0.50\), and \(\hat{\beta}_3=0.50\), so the fitted model is
The interaction estimate, 0.50 t/ha per 10 kg/ha, is the estimated difference between the fertilizer slopes. It is not the yield difference between irrigation groups at every fertilizer rate: that difference changes with \(x\).
How the Interaction and Its Uncertainty Are Calculated
The slope formulas follow by substituting each irrigation value into the model. At \(I=0\), the conditional mean is \(\beta_0+\beta_1x\), whose coefficient on \(x\) is \(\beta_1\). At \(I=1\), it is \((\beta_0+\beta_2)+(\beta_1+\beta_3)x\), whose coefficient on \(x\) is \(\beta_1+\beta_3\). Subtracting the first slope from the second gives \(\beta_3\). This also explains why an interaction test is a test of equal fertilizer slopes.
In the hypothetical data, each cell has deviations of \(-0.2,0,0.2\) t/ha from its mean. The residual sum of squares is therefore six times the within-cell sum of squares:
There are 18 plot observations and four fitted coefficients, so the residual degrees of freedom are \(df=18-4=14\). The estimated error variance is \(MSE=SSE/df=0.48/14=0.03429\ (\text{t/ha})^2\).
For each irrigation group, the fertilizer values have mean 1 and sum of squared deviations \(3[(0-1)^2+(1-1)^2+(2-1)^2]=6\). The estimated variance of either group’s slope is \(MSE/6\), so its standard error is \(\sqrt{0.03429/6}=0.0756\) t/ha per 10 kg/ha. Because the groups are independent, the variance of the difference between their slopes is the sum of their variances. Thus the interaction standard error is
Under the stated normal-error assumptions, a 95% confidence interval for the interaction is \(\hat{\beta}_3\pm t^*SE(\hat{\beta}_3)\), where \(t^*=2.145\) for 14 degrees of freedom. The interval is \(0.50\pm2.145(0.1069)=(0.271,0.729)\) t/ha per 10 kg/ha. It describes a range of plausible values for the population difference in fertilizer slopes under this model and design.
Worked Example: Test Whether Fertilizer Slopes Differ
Test \(H_0:\beta_3=0\) against \(H_a:\beta_3\ne0\) at \(\alpha=0.05\). The null says the two irrigation levels have equal fertilizer slopes. The test statistic is
The two-sided p-value is approximately 0.0004. If the null model and assumptions hold, a test statistic at least this far from zero in either direction would be very unusual. Since this p-value is below 0.05, the data provide evidence that the fertilizer slopes differ between the irrigation levels. The estimated difference is positive: the slope is steeper under higher irrigation by about 0.50 t/ha per 10 kg/ha. This conclusion concerns the modeled range and does not show that every additional fertilizer amount will have the same effect outside that range.
Fitted Yields and Group Comparisons
A fitted value is the model’s estimated mean yield at specified predictor values. For instance, at \(x=1\), the predicted yields are 5.00 t/ha under lower irrigation and 6.00 t/ha under higher irrigation. The estimated difference at that fertilizer rate is 1.00 t/ha. More generally, the fitted difference between higher and lower irrigation at fertilizer value \(x\) is \(\hat{\beta}_2+\hat{\beta}_3x\). Here it is \(0.50+0.50x\): it is 0.50 t/ha at \(x=0\), 1.00 t/ha at \(x=1\), and 1.50 t/ha at \(x=2\).
A confidence interval for a fitted mean reflects uncertainty in the estimated conditional mean, not the scatter of a new individual plot around that mean. For this balanced example, the standard error of a fitted group mean at \(x=1\) is \(\sqrt{MSE/9}\), because each group has nine plots and \(x=1\) is the group’s mean fertilizer value. This is \(\sqrt{0.03429/9}=0.0617\) t/ha. Using \(t^*=2.145\), the 95% interval for the lower-irrigation fitted mean is \(5.00\pm2.145(0.0617)=(4.868,5.132)\) t/ha. The corresponding interval for the higher-irrigation fitted mean is \((5.868,6.132)\) t/ha.
Worked Example: Quantify a Group Difference at a Chosen Rate
At \(x=1\), the estimated higher-minus-lower irrigation contrast is \(\hat{\beta}_2+\hat{\beta}_3=0.50+0.50=1.00\) t/ha. In this balanced design, each group mean at this rate is based on three plots. The standard error of the difference is
A 95% confidence interval is \(1.00\pm2.145(0.1512)=(0.676,1.324)\) t/ha. This interval concerns the mean yield difference at \(x=1\), not the interaction slope difference. In this example, it is wider than the intervals for the individual fitted means because the contrast’s uncertainty combines uncertainty from both groups. These results are model-based; they do not make the interval a prediction range for the yield of a single future plot.
Common Pitfall and Practical Interpretation
A common mistake is to read \(\hat{\beta}_1=1.00\) as the fertilizer slope for both irrigation levels. That coefficient is the slope only for the reference level \(I=0\). Under higher irrigation, the slope is \(\hat{\beta}_1+\hat{\beta}_3=1.00+0.50=1.50\). Omitting the interaction term would impose equal slopes, contrary to what this fitted model estimates.
Another error is to describe \(\hat{\beta}_3=0.50\) as a 0.50 t/ha yield increase for higher irrigation, regardless of fertilizer. It is a difference in slopes, with units of t/ha per 10 kg/ha. The fitted group difference at a particular fertilizer rate is instead \(\hat{\beta}_2+\hat{\beta}_3x\), and its units are t/ha. Always state the fertilizer rate when reporting a group contrast.
Finally, an interaction is a statement about how a modeled relationship varies across the specified groups. It does not guarantee a biological mechanism, and the linear response should not be extrapolated beyond the fertilizer rates represented by the data without additional justification. In a randomized experiment, treatment assignment can support causal interpretation for the studied conditions; otherwise, describe the result as an association.
Check Your Understanding
Use the model and hypothetical results above to answer these questions.
- What does \(\beta_2\) represent in this coding, and at what fertilizer value is that difference defined?
- If the estimated interaction were \(-0.30\) t/ha per 10 kg/ha, how would the higher-irrigation fertilizer slope compare with the lower-irrigation slope?
- Using the fitted model, calculate the higher-minus-lower irrigation yield difference at \(x=2\).
- Explain why the interaction coefficient does not have the same units as the fitted yield difference between irrigation groups.
- What assumptions support the usual \(t\)-based confidence interval and test in this example?