Learn R Programming

perry (version 0.1.1)

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<
...
additional arguments to be passed down to perry.

Value

  • An object of class "perry" as returned by perry.

See Also

perry, repCV, bootPE

Examples

Run this code
# load data and fit an LS regression model
data("mtcars")
fit <- lm(mpg ~ wt + cyl, data=mtcars)

# perform random splitting
repRS(fit, m = 6, R = 10, seed = 1234)

Run the code above in your browser using DataLab