Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stratified CV brakes in particular setting #61

Open
rachaelvp opened this issue Mar 30, 2022 · 0 comments
Open

Stratified CV brakes in particular setting #61

rachaelvp opened this issue Mar 30, 2022 · 0 comments
Labels

Comments

@rachaelvp
Copy link
Member

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant