Main vs interaction effects
y: body mass (g)
x1: bill length
x2: island Dream
x3: island Torgersen
ˆy=^β0+^β1x1+^β2x2+^β3x3
Bill length only impacts body mass via the term β1x1. x2 and x3 can be thought of as turning on or off a constant.
Main
term <chr> | estimate <dbl> | std.error <dbl> | statistic <dbl> | p.value <dbl> |
---|---|---|---|---|
(Intercept) | 1225.79107 | 243.180592 | 5.040662 | 7.576684e-07 |
bill_length_mm | 77.11933 | 5.306978 | 14.531683 | 1.656434e-37 |
islandDream | -919.07448 | 58.622251 | -15.677912 | 5.151598e-42 |
islandTorgersen | -523.29201 | 85.549545 | -6.116830 | 2.638570e-09 |
Interaction
ˆy=^β0+^β1x1+^β2x2+^β3x3+^β4x1x2+^β5x1x3
What’s different? The interaction terms (β4x1x2 and β5x1x3).
term <chr> | estimate <dbl> | std.error <dbl> | statistic <dbl> | p.value <dbl> |
---|---|---|---|---|
(Intercept) | -1726.02014 | 292.078750 | -5.909434 | 8.425393e-09 |
bill_length_mm | 142.34194 | 6.418333 | 22.177401 | 9.138892e-68 |
islandDream | 4478.69269 | 395.307334 | 11.329647 | 2.030517e-25 |
islandTorgersen | 2870.56340 | 777.685075 | 3.691164 | 2.603717e-04 |
bill_length_mm:islandDream | -120.60139 | 8.770689 | -13.750505 | 1.930223e-34 |
bill_length_mm:islandTorgersen | -76.57134 | 19.534154 | -3.919870 | 1.073890e-04 |
Interpreting interactions can be difficult, especially without writing things down. To make it easier, we will compare the implied linear models:
Plug in 0 for islandDream
(x2) and 0 for islandTorgersen
(x3) to get the linear model for islandBiscoe
penguins
Plug in 1 for islandDream
(x2) and 0 for islandTorgersen
(x3) to get the linear model for islandDream
penguins
Plug in 0 for islandDream
(x2) and 1 for islandTorgersen
(x3) to get the linear model for islandTorgersen
penguins
- Biscoe fitted model:
ˆy=−1726.0+142.3x1
- Dream fitted model:
ˆy=−1726.0+142.3x1+4478.7−120.6x1
Combine terms:
ˆy=2752.7+21.7x1
Exercise 1
Write out the fitted model for Torgersen island below.
- Torgersen model: ˆy=[write here]