Learn R Programming

perry (version 0.1.1)

bootPE: Bootstrap prediction error estimation for fitted models

Description

Estimate the prediction error of a fitted model via the bootstrap. This works for any model for which a perry method is available.

Usage

bootPE(object, R = 1,
    bootType = c("0.632", "out-of-bag"), grouping = NULL,
    samples = NULL, ...)

Arguments

object
the fitted model for which to estimate the prediction error.
R
an integer giving the number of bootstrap samples.
bootType
a character string specifying a bootstrap estimator. Possible values are "0.632" (the default), or "out-of-bag".
grouping
a factor specifying groups of observations. If supplied, the groups are resampled rather than individual observations such that all observations within a group belong either to the bootstrap sample or the test data.
samples
an object of class "bootSamples" (as returned by bootSamples) or a control object of class "bootControl" (see bootControl
...
additional arguments to be passed down to perry.

Value

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

See Also

perry, repCV, repRS

Examples

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

# perform bootstrap prediction error estimation
bootPE(fit, R = 10, bootType = "0.632", seed = 1234)
bootPE(fit, R = 10, bootType = "out-of-bag", seed = 1234)

Run the code above in your browser using DataLab