The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » India » survey weights in R (stuck up in integrating survey weights in analyzing the DHS7 India data)
Re: survey weights in R [message #25946 is a reply to message #25942] Fri, 13 January 2023 12:14 Go to previous messageGo to previous message
Shireen-DHS is currently offline  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
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Missing Region for 2015 SPSS India dataset
Next Topic: Inconsistencies in heights between NFHS-3 NFHS-4
Goto Forum:
  


Current Time: Sat Nov 30 21:18:10 Coordinated Universal Time 2024