repRS: (Repeated) random splitting for fitted models
Description
Estimate the prediction error of a fitted model via
(repeated) random splitting (also known as random
subsampling or Monte Carlo cross-validation). This works
for any model for which a perry method is
available.
Usage
repRS(object, m, R = 1, grouping = NULL, splits = NULL,
...)
Arguments
object
the fitted model for which to estimate the
prediction error.
m
an integer giving the number of observations or
groups of observations to be used as test data.
R
an integer giving the number of random data
splits.
grouping
a factor specifying groups of
observations. If supplied, the data are split according
to the groups rather than individual observations such
that all observations within a group belong either to the
training or test data.
splits
an object of class "randomSplits"
(as returned by randomSplits) or a control
object of class "splitControl" (see
splitControl<
# load data and fit an LS regression modeldata("mtcars")
fit <- lm(mpg ~ wt + cyl, data=mtcars)
# perform random splittingrepRS(fit, m = 6, R = 10, seed = 1234)