bootMSE: Bootstrap Estimate of Mean Squared Error Using SISAL Object

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/bootMSE.R

Description

Using a linear model produced by sisal, computes a bootstrap estimate of MSE in test data.

Usage

1
2
3
4
bootMSE(object, dataset = NULL, R = 1000,
        inputs = c("L.f", "L.v", "full"),
        method = c("OLS", "magic"), standardize = "inherit",
        stepsAhead = NULL, noiseSd = NULL, verbose = 1, ...)

Arguments

object

an object of class "sisal", containing the results of input selection and the corresponding ordinary least squares and ridge regression models. Must be compatible with dataset. See ‘Details’.

dataset

dataset to work on. A character string, a numeric vector or a list with components "X" and "y". When the default value NULL is used, the function attempts to detect the dataset from attributes of object. See ‘Details’.

R

the number of bootstrap replicates. Usually a single positive integral number. See boot::boot.

inputs

a character string. Which set of input variables to use. Choices are "L.f" (smallest set with error under threshold), "L.v" (minimum validation error) and "full" (full model). See sisal.

method

a character string. "OLS" for ordinary least squares regression or "magic" for a ridge regression model with an automatically selected regularization parameter. See sisal.

standardize

"inherit" or a logical flag. If TRUE, standardizes the data to zero mean and unit variance. If FALSE, uses original data. If "inherit" (the default), the value of this argument is copied from object. This affects the scale of the results.

stepsAhead

If doing time series prediction, this indicates how many steps ahead to predict. A non-negative integral value or NULL. If NULL (the default), the value is copied from an attribute of object, put there by testSisal.

noiseSd

standard deviation of the noise to be added to the dependent variable when dataset is "toy". The noise is a saved dataset. Thus it is always identical, only scaled by noiseSd. If NULL (the default), the value is copied from object.

verbose

verbosity level. A single numeric value. If 0, output is disabled. If greater than 0, shows some information about what the function is doing. Currently there is only one non-zero verbosity level (the default).

...

arguments passed to boot::boot.

Details

Four types of values are supported in dataset.

  1. Use one of "laser", "poland", "toy" and "tsToy" to work on the test part of a dataset included in or specifically supported by the package. The first two options will load their respective datasets over a network connection. See sisalData, toy.test and tsToy.test.

  2. Use a numeric vector to work with time series data. The use of the "laser" and "poland" datasets is recognized. Loading the datasets in advance reduces unnecessary network traffic when doing multiple repeats with the same dataset.

  3. Use a list with a numeric matrix "X" and a numeric vector "y" to supply inputs "X" and output "y". This is appropriate when using your own data for something else than time series prediction based on past values of the same time series.

  4. Use NULL (the default value) for automatic detection of the dataset. This works if object was created with testSisal.

When using time series data, the names of the inputs used in object must match the regular expression "lag\.\d+", i.e. "lag" followed by a dot and an integer without spaces or any other formatting. This is automatically taken care of by laggedData and testSisal.

When using other than time series data, the user-supplied dataset must contain all the input variables used in the selected linear model (i.e. full model or a subset of inputs) of object.

Value

An object of class "boot", as returned by boot::boot.

Author(s)

Mikko Korpela

See Also

boot::boot, sisal, testSisal

Examples

1
2
foo <- testSisal(dataset="toy", Mtimes=10)
bootMSE(foo)

sisal documentation built on Feb. 16, 2020, 1:07 a.m.