1. Learn
  2. /
  3. Courses
  4. /
  5. Nonlinear Modeling with Generalized Additive Models (GAMs) in R

Exercise

Category-level smooths for different auto types

Now you extend your models to include different smooths for different levels of categorical terms.

Instructions

100 XP
  • Fit a model to predict city fuel efficiency (city.mpg) with smooth terms of weight, length, and price, but make each of these smooth terms depend on the drive categorical variable using by= in the smooth terms.
  • Include a separate linear term for the drive variable.