Supervised Learning in R: Regression
Nina Zumel and John Mount
Win-Vector, LLC
Example of an additive relationship:
plant_height ~ bacteria + sun
The simultaneous influence of two variables on the outcome is not additive.
plant_height ~ bacteria + sun + bacteria:sun
The simultaneous influence of two variables on the outcome is not additive.
plant_height ~ bacteria + sun + bacteria:sun
sun: categorical {"sun", "shade"}Like two separate models: one for sun, one for shade.
yield ~ Stress + SO2 + O3

Metabol ~ Gastric + Sex

Interaction - Colon (:)
y ~ a:b
Main effects and interaction -  Asterisk (*)
y ~ a*b
# Both mean the same
y ~ a + b + a:b
Expressing the product of two variables - I
y ~ I(a*b)
same as $y \propto a b$
| Formula | RMSE (cross validation) | 
|---|---|
| Metabol ~ Gastric + Sex | 1.46 | 
| Metabol ~ Gastric * Sex | 1.48 | 
| Metabol ~ Gastric + Gastric:Sex | 1.39 | 
Supervised Learning in R: Regression