library(dplyr) # for data manipulation
library(ggplot2) # for awesome graphics
library(rsample) # splitting data
library(caret) # for cross-validation, etc.
library(vip) # variable importance
library(modeldata) # ames data
data(ames)
# Stratified sampling with the rsample package
set.seed(77654) # I used a different seed than in the book
split <- initial_split(ames, prop = 0.7, strata = "Sale_Price")
ames_train <- training(split)
ames_test <- testing(split)
mars1 <- earth::earth(
Sale_Price ~ .,
data = ames_train
)