Using R to weight data for domestic violence [message #20418] |
Fri, 30 October 2020 13:13 |
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?
|
|
|