Description Usage Arguments Value Author(s) See Also Examples
Generate an object that controls how to split n observations or groups of observations into K folds to be used for (repeated) K-fold cross-validation. K should thereby be chosen such that all folds are of approximately equal size.
1 2 3 4 5 6 | foldControl(
K = 5,
R = 1,
type = c("random", "consecutive", "interleaved"),
grouping = NULL
)
|
K |
an integer giving the number of folds into which the observations should be split (the default is five). |
R |
an integer giving the number of replications for repeated K-fold cross-validation. |
type |
a character string specifying the type of folds to be
generated. Possible values are |
grouping |
a factor specifying groups of observations. |
An object of class "foldControl"
with the following
components:
K
an integer giving the number of folds. A value of
K
equal to the number of observations or groups yields
eave-one-out cross-validation.
R
an integer giving the number of replications. This will be ignored for for leave-one-out cross-validation and other non-random splits of the data.
type
a character string specifying the type of folds.
grouping
if supplied, a factor specifying groups of observations. The data will then be split according to the groups rather than individual observations such that all observations within a group belong to the same fold.
Andreas Alfons
perrySplits
, cvFolds
,
splitControl
, bootControl
1 2 3 | set.seed(1234) # set seed for reproducibility
perrySplits(20, foldControl(K = 5))
perrySplits(20, foldControl(K = 5, R = 10))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.