[R] crosstable and regression for survey data (weighted)

haps halptekin at gmail.com
Wed Jun 27 14:17:15 CEST 2012


Thanks Pablo for your answer, it was very insightful, but I guess I got
something wrong. 

I formed a survey design as:
> library(survey) 
> mydesign <- svydesign(ids=~vill_neigh_code+clust, strata=~strat,
> weights=~sweight, data=mydata)
where 
strat: stratum (urban or (sub-county) rural). 
clust: batch of interviews that were part of the same random walk 
vill_neigh_code: village or neighbourhood code 
sweight: probability weights
Then, I run a logistic regression as
> logit.1 <- svyglm(response~var1+var2+var3+var4+var5+var6, design=mydesign,
> data=mydata, nest=TRUE, family=quasibinomial())
And I get this error message:
Error in svyglm.survey.design(response ~ var1 + var2 + var3 + var4 +  : 
  all variables must be in design= argument
What should I change in the syntax in this case?

--
View this message in context: http://r.789695.n4.nabble.com/crosstable-and-regression-for-survey-data-weighted-tp4634083p4634617.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list