BaşlayınÜcretsiz Başlayın

Category-level smooths for different auto types

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

Bu egzersiz

Nonlinear Modeling with Generalized Additive Models (GAMs) in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • 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.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

library(mgcv)
# Fit the model
mod_city3 <- gam(city.mpg ~ ___, 
                 data = mpg, method = "REML")

# Plot the model
plot(mod_city3, pages = 1)
Kodu Düzenle ve Çalıştır