Interaction

Definition taught in Analysis of variance examples, part of Data analysis

Interaction

Interaction plots. From Analysis of variance examples.
Type Definition
Taught in Analysis of variance examples
Part Data analysis
Worked examples 3

Two factors interact when the effect of one depends on the level of the other: the difference in mean response between two levels of the first factor is not the same at every level of the second. In the two-factor model, there is no interaction when every \gamma_{ij}=0.

Examples

Wheat in four regions

Worked example from Analysis of variance examples

Three fertilizers were each tried three times in each of four regions, giving 36 wheat yields.

yield <- c(9.18, 8.26, 8.57, 10.05, 8.92, 9.39, 11.23, 11.11, 9.72, 11.60, 9.83, 11.07,
           9.69, 8.25, 9.83, 9.80, 10.90, 10.75, 12.13, 12.01, 9.67, 12.09, 10.15, 12.04,
           7.87, 8.91, 7.78, 8.33, 8.18, 9.78, 9.38, 10.10, 10.90, 11.73, 8.86, 11.23)
fertilizer <- gl(3, 12, 36, labels = paste("Fertilizer", 1:3))
region <- gl(4, 3, 36, labels = paste("Region", 1:4))
anova(lm(yield ~ region * fertilizer))
#                   Df Sum Sq Mean Sq F value    Pr(>F)
# region             3 29.340  9.7801 11.2388 8.451e-05
# fertilizer         2  8.560  4.2798  4.9182   0.01622
# region:fertilizer  6  0.695  0.1159  0.1332   0.99067
# Residuals         24 20.885  0.8702

Question. Do region and fertilizer affect yield, and do they interact?

Solution. The interaction is negligible: F=0.13 with p-value 0.99, and the interaction plot shows nearly parallel lines. Dropping it gives the additive model, lm(yield ~ region + fertilizer), whose error mean square, 0.719 on 30 degrees of freedom, pools the interaction into the error. Both main effects are then clear: region with F=13.6 and p=9\times10^{-6}, fertilizer with F=5.95 and p=0.007. Mean yields rise from 8.70 in region 1 to 10.96 in region 4; fertilizer 2 gives the highest mean, 10.61, against 9.91 and 9.42 for the others.

Analysing one region alone throws information away. In region 1 by itself, anova(lm(yield ~ fertilizer, subset = region == "Region 1")) gives F=1.87 and p=0.23: with only 9 observations, the error variance is poorly estimated, and the fertilizer effect that the full analysis finds is not visible.

Pesticide and fertilizer

Worked example from Analysis of variance examples

A crop was grown with pesticide (no or yes) and fertilizer (low, medium or high), three plots per combination. The mean yields were

Low Medium High
No pesticide 3.20 2.87 5.70
Pesticide 6.77 9.01 8.16

Question. What does a two-factor analysis show?

Solution. A two-sample t test of pesticide alone, ignoring fertilizer, gives t=-7.30 and p=1.8\times10^{-6}. The two-factor analysis with interaction shows why that single number is incomplete. The interaction is enormous, F=574 on (2,12) degrees of freedom: without pesticide the yield is best at high fertilizer, with pesticide it is best at medium. The effect of pesticide is 3.57 at low fertilizer, 6.14 at medium and 2.45 at high. Reporting one average “pesticide effect” would hide that the best fertilizer level depends on whether pesticide is used. With interaction this strong, the useful summary is the table of cell means.

Age and smoking interact

Worked example from Linear model examples

Question. Does the association between the mother’s age and birth weight depend on smoking?

Solution.

model2 <- lm(bwt ~ age * smoke, data = birthwt)
summary(model2)
#             Estimate Std. Error t value Pr(>|t|)
# (Intercept) 2406.058    292.190   8.235 3.18e-14 ***
# age           27.731     12.149   2.283   0.0236 *
# smoke        798.175    484.342   1.648   0.1011
# age:smoke    -46.572     20.447  -2.278   0.0239 *

The interaction is significant (p=0.024). For non-smokers, birth weight rises by 27.7 g per year of the mother’s age; for smokers, the slope is 27.73-46.57=-18.8 g per year, a decline. The coefficient of smoke alone, +798 g, is the difference between smokers and non-smokers at age zero, an extrapolation with no meaning; with an interaction in the model, main-effect coefficients have to be read together with it. Age had no association with birth weight in the additive model above precisely because the two groups’ slopes point in opposite directions and largely cancel.

Figures

Birth weight against the mother’s age, with separate least-squares lines for non-smokers and smokers. The lines have opposite slopes: that is the interaction. From Linear model examples.

Used in

See also

Bonferroni correction

Glossary and index