data(ozone1)
set.seed(1) # optional, for cross validation reproducibility
# note: should really use ncross=30 below but for a quick demo we don't
earth.mod <- earth(O3~temp, data=ozone1, nfold=10, ncross=3, varmod.method="lm")
# call predict.earth, which calls predict.varmod
predict(earth.mod, newdata=ozone1[200:203,], interval="pint", level=.95)
Run the code above in your browser using DataLab