data(ozone1)
(a <- earth(O3 ~ ., data = ozone1, degree = 2))
# yields:
# Selected 11 of 21 terms, and 8 of 9 predictors
# Importance: temp, humidity, ibt, doy, dpg, ibh, vis, wind, vh-unused
# Number of terms at each degree of interaction: 1 5 5
# GCV 13.5 RSS 3768 GRSq 0.791 RSq 0.822
update(a, formula = O3 ~ . - temp) # requires forward pass and pruning
# yields:
# Selected 14 of 21 terms, and 8 of 8 predictors
# Importance: ibt, humidity, doy, vh, ibh, dpg, wind, vis
# Number of terms at each degree of interaction: 1 5 8
# GCV 13.1 RSS 3499 GRSq 0.796 RSq 0.834
update(a, nprune = 8) # requires only pruning
# yields:
# Selected 8 of 21 terms, and 6 of 9 predictors
# Importance: temp, humidity, ibt, doy, dpg, ibh-unused, vis, vh-unused, wind-unused
# Number of terms at each degree of interaction: 1 5 2
# GCV 15.1 RSS 4435 GRSq 0.766 RSq 0.79
update(a, penalty=1, ponly=TRUE) # pruning pass only with a new penalty
# yields:
# Selected 13 of 21 terms, and 8 of 9 predictors
# Importance: temp, humidity, ibt, doy, dpg, ibh, vis, wind, vh-unused
# Number of terms at each degree of interaction: 1 5 7
# GCV 12.5 RSS 3671 GRSq 0.805 RSq 0.826
Run the code above in your browser using DataLab