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

Connected

Exercise

Multivariate GAMs of auto performance

GAMs can accept multiple variables of different types. In the following exercises, you'll work with the mpg dataset available in the gamair package to practice fitting models of different forms.

Instructions

100 XP
  • Use the head() and str() functions to examine the mpg data set.
  • Fit a GAM to these data to predict city.mpg as the sum of smooth functions of weight, length, and price.
  • Use the plot() function provided to visualize the model.