The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Weighting data » Using R to weight data for domestic violence
Using R to weight data for domestic violence [message #20418] Fri, 30 October 2020 13:13 Go to previous message
banakani is currently offline  banakani
Messages: 1
Registered: October 2020
Member
Hello everyone,

I would like to set up the survey design for Cote d'Ivoire DHS 2011-2012 using R. I am focused on domestic violence.

I used this code:

wt <- ipv_studyf$d005/1000000 # creating the variable weight

ipvdesign <- svydesign(ids = ipv_studyf$v021, # clustering- psu
strata = ipv_studyf$v023, # strata variable
weights = wt, # the weighting variable
data = ipv_studyf, # the dataset
variance="HT" ) # Horvitz-Thompson estimator

However, I keep getting this error message:

Error in na.weight(data.frame(weights)) : missing values in `weights'

I read some comments in the weighting data/ How to Weight Data in R, however, nobody has faced this issue before.


    Would you mind to help me with this?
    Should I remove all the missing values for this column?
    How can I fix this error message?
Could you please help me to fix it?
 
Read Message
Read Message
Previous Topic: Pooled Cross sections
Next Topic: All women factor in stata
Goto Forum:
  


Current Time: Thu Mar 28 19:58:54 Coordinated Universal Time 2024