View source: R/5_DEPRECATED_createFoldsSB.R
| createFolds2 | R Documentation | 
DEPRECATED!
Create folds with blocking and stratification (BS)
for (repeated) k-fold cross-validation
Function randomly divides observations into folds that are used for (repeated)
k-fold cross-validation. In these folds observations are:
blocked by values in variable ID (i.e. observations
with the same "ID" are treated as one unit (a block) and are always
in the same fold);
stratified by levels of factor variable gr (the proportions of
these grouped units of observations per each group (level) are kept aproximately
constant throughout all folds).
createFolds2(data = NULL, gr = NULL, ID = NULL, k = 5, returnTrain = TRUE, ...)
stratifiedFolds(
  data = NULL,
  gr = NULL,
  ID = NULL,
  k = 5,
  returnTrain = TRUE,
  ...
)
createFoldsBS(
  data = NULL,
  stratify_by = NULL,
  block_by = NULL,
  k = 5,
  returnTrain = TRUE,
  times = 1,
  seeds = NULL,
  gr = stratify_by,
  ID = block_by
)
| data | A data frame, that contains variables which names are denoted
by arguments  | 
| k | (integer) A number of folds, default  | 
| returnTrain | (logical) If  | 
| stratify_by, gr | A vector or a name of factor variable in  | 
| block_by, ID | A vector or a name of variable in  | 
| times | (integer) number of repetitions for repeated cross-vatidtion. | 
| seeds | (vector of integers |  (See  | 
A list of folds. In each fold there are indices observations.
The structure of outpus is the similar to one created with
createFolds().
If k is such big, that some folds have no observations of a certain group
(i.e. level in gr), an error is returned. In that case smaller value of
k is recommended. 
 
createFolds2, stratifiedFolds is a wrapper of
createFoldsBS.
Vilmantas Gegzna
createFolds
Test if folds are blocked and stratified cvo_test_bs
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.