Learn R Programming

perry (version 0.3.1)

perrySplits: Data splits for resampling-based prediction error measures

Description

Split observations or groups of observations into segments to be used for (repeated) \(K\)-fold cross-validation, (repeated) random splitting (also known as random subsampling or Monte Carlo cross-validation), or the bootstrap.

Usage

perrySplits(n, control)

Arguments

n

an integer giving the number of observations to be split.

control

a control object of class "foldControl" (as generated by foldControl), "splitControl" (as generated by splitControl) or "bootControl" (as generated by bootControl).

Value

For the foldControl method, an object of class "cvFolds" giving folds for (repeated) \(K\)-fold cross-validation (see cvFolds).

For the splitControl method, an object of class "randomSplits" giving random data splits (see randomSplits).

For the bootControl method, an object of class "bootSamples" giving bootstrap samples (see bootSamples).

See Also

foldControl, splitControl, bootControl, cvFolds, randomSplits, bootSamples

Examples

Run this code
# NOT RUN {
set.seed(1234)  # set seed for reproducibility

## data folds for K-fold cross-validation
perrySplits(20, foldControl(K = 5))
perrySplits(20, foldControl(K = 5, R = 10))

## random data splits
perrySplits(20, splitControl(m = 5))
perrySplits(20, splitControl(m = 5, R = 10))

## bootstrap samples
perrySplits(20, bootControl())
perrySplits(20, bootControl(R = 10))

# }

Run the code above in your browser using DataLab