reg_crossval | R Documentation |
K-fold cross-validation of regression models estimated with lm()
reg_crossval(formula, data, nfolds, obs_order = "random")
formula |
an object of class "formula": a symbolic description of the model to be fitted. |
data |
a data frame with the data used for fitting the models. |
nfolds |
the number of folds in the cross-validation. |
obs_order |
order of the observations when splitting the data. obs_order = "random" gives a random order. |
RMSE Root mean squared prediction error on test data
library(regkurs) RMSE_CV = reg_crossval(mpg ~ hp, data = mtcars, nfolds = 4, obs_order = 1:32) print(RMSE_CV)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.