Session Ready
Exercise

With and without an interaction term

In the linear model architecture, you specify an interaction between two explanatory variables by using * notation rather than +.

In this exercise, you'll compare models of birth weight as a function of gestational period and the mother's smoking status. One model will not have an interaction between the two and the other will.

Recall that an interaction describes how one explanatory variable (e.g. smoke) changes the effect size of the other (e.g. gestation).

Instructions
100 XP
  • Train a linear model with the formula baby_wt ~ gestation + smoke and the data Birth_weight
  • Train another linear model similar to the first, but include an interaction between gestation and smoke.
  • Use fmodel() to plot each model and note the difference between the two. Note that, in this case, you don't have to specify any additional arguments to fmodel() beyond the model; it automatically figures out the best way to plot things.