randomSplits: Random data splits

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

Description

Split observations or groups of observations into training and test data to be used for (repeated) random splitting (also known as random subsampling or Monte Carlo cross-validation).

Usage

1
  randomSplits(n, m, R = 1, grouping = NULL)

Arguments

n

an integer giving the number of observations to be split into training and test data. This is ignored if grouping is supplied in order to split groups of observations into folds.

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.

Value

An object of class "randomSplits" with the following components:

n

an integer giving the number of observations or groups.

m

an integer giving the number of observations or groups in the test data.

R

an integer giving the number of random data splits.

subsets

an integer matrix in which each column contains the indices of the observations or groups in the test data of the corresponding random data split.

grouping

a list giving the indices of the observations belonging to each group. This is only returned if a grouping factor has been supplied.

Note

This is a simple wrapper function for perrySplits with a control object generated by splitControl.

Author(s)

Andreas Alfons

See Also

perrySplits, splitControl, cvFolds, bootSamples

Examples

1
2
3
set.seed(1234)  # set seed for reproducibility
randomSplits(20, m = 5)
randomSplits(20, m = 5, R = 10)

aalfons/perry documentation built on May 10, 2019, 2:06 a.m.