Re: survey weights in R [message #25946 is a reply to message #25942] |
Fri, 13 January 2023 12:14 |
Shireen-DHS
Messages: 140 Registered: August 2020 Location: USA
|
Senior Member |
|
|
Hello,
I have done this recently in R and the code below works. I see you have the option to adjust for error your received but can you try the following code for your data?
# setting the survey design using the weight (wt), psu, and strata
mysurvey<-svydesign(id=Mendata$v021, data=IRdata, strata=Mendata$v022, weight=Mendata$wt, nest=T)
options(survey.lonely.psu="adjust")
# chi-square results
svychisq(~InternetUsage+RuralOrUrban, mysurvey)
Best,
Shireen Assaf
The DHS Program
|
|
|