I'm working on an analysis of survey-weighted data from a stratified random sample using the survey library. I have my survey design object:
wsvy <- svydesign(ids=df$psu, strata=df$strata, weights=df$pweight, fpc=df$N, data=df)
and am estimating a proportion using svyciprop, as such:
prop <- svyciprop(~I(y==1), wsvy, method=CI_METHOD, level=0.95)
When I use any of these methods -- "beta", "xlogit", "asin", or "mean" -- everything is fine and I get results. However, if I instead use "logit" or "likelihood", I get the following error:
Error in svyglm.survey.design(I(y==1) ~ 1, design, family = quasibinomial) : all variables must be in design= argument
I've looked around and have found similar questions, but none that have addressed this particular issue, or that have helped me resolve it. I have tried rewriting my survey object this way:
wsvy <- svydesign(ids=~psu, strata=~strata, weights==~pweight, fpc=~N, data=df)
to no avail. I am currently using the "beta" method, but because Clopper-Pearson is so conservative I would prefer to use one of these other methods (honestly, I'd prefer to use Agresti-Coull or Wilson but these are not included in the svyciprop package).
Does anyone know what's going wrong here? Thank you!