Description Usage Arguments Value Note Author(s) See Also Examples
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).
1 | randomSplits(n, m, R = 1, grouping = NULL)
|
n |
an integer giving the number of observations to be split into
training and test data. This is ignored if |
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. |
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.
This is a simple wrapper function for perrySplits
with a
control object generated by splitControl
.
Andreas Alfons
perrySplits
, splitControl
,
cvFolds
, bootSamples
1 2 3 | set.seed(1234) # set seed for reproducibility
randomSplits(20, m = 5)
randomSplits(20, m = 5, R = 10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.