Interaction Effect — Definition, Formula & Example
An interaction effect is present when the effect of one factor on an outcome changes depending on the level of a second factor. For example, a fertilizer might boost a crop a lot when plants get plenty of water but barely help when water is scarce.
In a factorial design with factors and , an interaction exists when the population mean response is not additive in the two factors. That is, the difference in mean response between levels of is not the same at every level of . For a design with cell means , the interaction contrast is , and there is no interaction exactly when this contrast equals . In the regression model , if and are indicator variables coded and , then equals this contrast. Under other codings, such as , is a constant multiple of the contrast rather than equal to it. Under any of these codings, still means no interaction.
Key Formula
Where:
- = Mean response when factor A is at level i and factor B is at level j (each level is 0 or 1)
- = Effect of changing A from level 0 to level 1 while B is at level 1
- = Effect of changing A from level 0 to level 1 while B is at level 0
Worked Example
Problem: A gardener runs a experiment on tomato plants. Factor A is fertilizer (none or used). Factor B is watering (low or high). The mean yields per plant are: no fertilizer with low water, 4 pounds; no fertilizer with high water, 6 pounds; fertilizer with low water, 5 pounds; fertilizer with high water, 11 pounds. Find the interaction effect.
Step 1: Find the fertilizer effect under low water. Compare the fertilizer and no-fertilizer means at that level.
Step 2: Find the fertilizer effect under high water.
Step 3: Subtract the two effects. The result is the difference of differences.
Answer: The interaction effect is 4 pounds per plant. Fertilizer adds 4 more pounds with high water than with low water. The contrast is symmetric, so you get the same value if you compare the water effects instead: . With 0/1 coding, this is the coefficient on the product term. These are sample means, so you still need a hypothesis test to decide whether the true interaction differs from 0.
Visualization
Why It Matters
When an interaction is present, a single main effect misrepresents both conditions. In the example, the average fertilizer effect is 3 pounds, which matches neither the 1-pound nor the 5-pound effect. The same issue shows up in pharmacology, where two drugs together can act differently than either drug alone. It also shows up in A/B testing, where a website redesign might raise sales on phones but not on laptops.
Common Mistakes
Mistake: Thinking an interaction means the two factors are correlated or related to each other.
Correction: Interaction describes how the factors jointly affect the response, not how the factors relate to one another. In a balanced, randomly assigned factorial experiment, the factors are independent by design, yet they can still interact. Check whether one factor's effect changes across levels of the other. Nonparallel lines on an interaction plot signal this.
