perrySplits: Data splits for resampling-based prediction error measures

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

View source: R/perrySplits.R

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

1
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).

Note

Users may prefer the wrapper functions cvFolds, randomSplits and bootSamples.

Author(s)

Andreas Alfons

See Also

foldControl, splitControl, bootControl, cvFolds, randomSplits, bootSamples

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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))

perry documentation built on Nov. 3, 2021, 5:08 p.m.