[R] problem on package "survey" , function svyglm,
Milan Bouchet-Valat
nalimilan at club.fr
Mon Apr 14 21:07:54 CEST 2014
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
More information about the R-help
mailing list