createCVgroups {predkmeans} | R Documentation |
Splits a vector of observation names or indices into a list of k groups, to be used as cross-validation (CV) test groups.
createCVgroups(x = NULL, n = length(x), k = 10, useNames = TRUE)
x |
vector of observation ID's (character or numeric) to split into cv groups. |
n |
number of observations to split into cv groups. Defaults to the length of |
k |
number of cross-validation groups. Must be less than or equal to |
useNames |
logical indicator of whether the names of 'x' should be used to identify observations within cv groups. |
A list of length k
giving the IDs of observations within each test group.
Joshua Keller
predkmeansCVest predkmeansCVpred
# 5-fold groups
cv5 <- createCVgroups(n=100, k=5)
cv5
# Leave-one-out
cvLOO <- createCVgroups(n=100, k=0)
cvLOO