Stratified CV brakes when the number of events for some stratum is greater than V, and for others it's less than V. This is the error: Error in strata_folds[[strata]][[v]] : subscript out of bounds.
Here's an example; this fails because number of level 1 events is < V and number of level 0 events > V.
strata_ids <- c(rep(0,15), rep(1,9))
folds <- origami::make_folds(strata_ids = strata_ids)
None of these examples fail:
strata_ids1 <- c(rep(0,15), rep(1,15)) # even prevalence, both levels > V
folds1 <- origami::make_folds(strata_ids = strata_ids1)
strata_ids2 <- c(rep(0,20), rep(1,10)) # uneven prevalence, both levels > V
folds2 <- origami::make_folds(strata_ids = strata_ids2)
strata_ids3 <- c(rep(0,5), rep(1,5)) # even prevalence, both levels < V
folds3 <- origami::make_folds(strata_ids = strata_ids3)
strata_ids4 <- c(rep(0,8), rep(1,9)) # uneven prevalence, both levels < V
folds4 <- origami::make_folds(strata_ids = strata_ids4)
Stratified CV brakes when the number of events for some stratum is greater than V, and for others it's less than V. This is the error:
Error in strata_folds[[strata]][[v]] : subscript out of bounds.Here's an example; this fails because number of level 1 events is < V and number of level 0 events > V.
None of these examples fail: