Le lundi 14 avril 2014 à 13:59 -0400, Hanze Zhang a écrit : > Hi, > > I want to do logistic regression based on a complex sample design. I used > package survey, but when I ran svyglm, an error message came out: > Error in onestrat(x[index, , drop = FALSE], clusters[index], > nPSU[index][1], : > Stratum (16) has only one PSU at stage 1 > > > My code is below: > > a.design<-svydesign(id = ~CASENUM ,strata = ~STRATUM ,data = a ,weights = > ~SIZAGYWT ) > summary(logistic1 <- svyglm(ANYCONTR ~ CHAIN+OWN+HPPAT, family = > binomial(link = "logit"), design=a.design)) > > > How to solve this issue? Thank you. You need to merge manually the stratum with only one PSU with another stratum. See 3.2.1 in http://books.google.fr/books?id=L96ludyhFBsC (look for "single" in the whole book to find it).
Regards ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.