Helper function to do a LOOCV on a gam or lm model
loogam(mod, k = 1, n = 100, LOO = FALSE)
mod | A model returned by a gam or lm fit |
---|---|
k | folds. k=1 is LOO, k=2 is LTO |
n | samples. How many folds to use. |
LOO. | Whether to return the LOO RSME and MdAE for the LOO models. If set to TRUE, function will be slow. |
A list with predictions (fitted), actual, errors (fitted-actual), MAE and RMSE. Also AIC and AICc are returned for the LOO models.
#> 4 term additive + random effectGu & Wahba 4 term additive model#> [1] 3.994149