Dear surveyCV Package Author
I am reaching out to seek assistance with an issue I encountered while using your surveyCV package for cross-validation in my survey data analysis. I am currently using R version 4.3.2, surveyCV package version0.2.0 ,on a Windows 11 operating system.The issue I encountered is as follows:When attempting to use the folds.svy function for stratified sampling of my survey data, I encountered the following error message:Error in folds.svy(Data = Data, nfolds = nfolds, strataID = strataID, : not all nfolds <= table(foldID.clus$strat) are TRUE. This issue arises when I try to partition my dataset into 5 folds for cross-validation. Below is a simplified code example that reproduces this error:
Error in folds.svy(Data = Data, nfolds = nfolds, strataID = strataID, : not all nfolds <= table(foldID.clus$strat) are TRUE.
cv.svyglm(tmal1, nfolds =2)
mean SE
. Model_1 0.45621 0.01
This issue arises when I try to partition my dataset into 5 folds for cross-validation. But when I try to partition my dataset into 2 folds for cross-validation, it can Runs smoothly!
I have attempted to check my dataset for any apparent issues and consulted the documentation, but have not found a way to resolve this issue. I am unsure if it is a problem with my data or if there are some limitations in the function itself that I am not aware of. I greatly appreciate the effort you have put into developing this package; it has been immensely helpful for my research. I would be grateful if you could assist me in resolving this issue or guide me on how to proceed further.
Thank you very much for your time and assistance!
Dear surveyCV Package Author I am reaching out to seek assistance with an issue I encountered while using your surveyCV package for cross-validation in my survey data analysis. I am currently using R version 4.3.2, surveyCV package version0.2.0 ,on a Windows 11 operating system.The issue I encountered is as follows:When attempting to use the folds.svy function for stratified sampling of my survey data, I encountered the following error message:Error in folds.svy(Data = Data, nfolds = nfolds, strataID = strataID, : not all nfolds <= table(foldID.clus$strat) are TRUE. This issue arises when I try to partition my dataset into 5 folds for cross-validation. Below is a simplified code example that reproduces this error:
NHANES_design <- svydesign( data = demo.train, ids = ~sdmvpsu, strata = ~sdmvstra, nest = TRUE, weights = ~nhs_wt, survey.lonely.psu = "adjust")
table(demo.train$sdmvpsu)
1 2 3
3578 3499 107
tmal1 <- svyglm(y~x+age+sex+eth+marital+PIR+edu, NHANES_design,family = quasibinomial())
cv.svyglm(tmal1, nfolds =5)
Error in folds.svy(Data = Data, nfolds = nfolds, strataID = strataID, : not all nfolds <= table(foldID.clus$strat) are TRUE.
cv.svyglm(tmal1, nfolds =2)
mean SE
. Model_1 0.45621 0.01
This issue arises when I try to partition my dataset into 5 folds for cross-validation. But when I try to partition my dataset into 2 folds for cross-validation, it can Runs smoothly! I have attempted to check my dataset for any apparent issues and consulted the documentation, but have not found a way to resolve this issue. I am unsure if it is a problem with my data or if there are some limitations in the function itself that I am not aware of. I greatly appreciate the effort you have put into developing this package; it has been immensely helpful for my research. I would be grateful if you could assist me in resolving this issue or guide me on how to proceed further. Thank you very much for your time and assistance!