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

Exercise

Soil pollution in different land uses

The meuse data set has a factor variable, landuse, which specifies the type of land use or cover at the location where soil was sampled.

Instructions 1/2

undefined XP
    1
    2
  • Using a categorical-continuous interaction (e.g., the by = form), fit a model to the meuse data that predicts copper levels as a function of dist, with different smooths for each level of landuse.
  • Include a separate term for varying intercepts for each level of landuse.
  • Print the model summary.