Chapter 7 Moving Beyond Linearity

Learning objectives:

Model relationships between a predictor and an outcome with

  1. polynomial regression
  2. step functions
  3. regression splines
  4. smoothing splines
  5. local regression
  6. generalized additive models

Chapter 7 resources:

  1. The text at https://www.statlearning.com/
  2. Cohort 1 videos
  3. Author videos
  4. Author slides
  5. Emil Hvitfeldt’s Tidymodels examples
  6. Kim Larsen’s GAM: The Predictive Modeling Silver Bullet
  7. Noam Ross’ GAMs in R: A Free, Interactive Course using mgcv
  8. onmee’s ISLR solutions for Chapter 7

Black motorcycle parked at road toward mountain

suppressPackageStartupMessages({
  library(splines)
  library(tidymodels)
  
  library(ISLR)
  library(boot)
  library(MASS)
  library(leaps)
  library(gam)
  library(ggplot2)
})

tidymodels_prefer()

#require(caTools)
attach(Wage)
attach(Auto)
## The following object is masked from Wage:
## 
##     year
## The following object is masked from package:lubridate:
## 
##     origin
## The following object is masked from package:ggplot2:
## 
##     mpg