Description Usage Arguments Value Author(s) See Also Examples
Splits a vector of observation names or indices into a list of k groups, to be used as cross-validation (CV) test groups.
1 | 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
1 2 3 4 5 6 7 | # 5-fold groups
cv5 <- createCVgroups(n=100, k=5)
cv5
# Leave-one-out
cvLOO <- createCVgroups(n=100, k=0)
cvLOO
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.