The DHS Program User Forum      
Discussions regarding The DHS Program data and results
Home » Data » Weighting data » Problems with of Malawi 2010 DHS in survey package (R)
Problems with of Malawi 2010 DHS in survey package (R) [message #15363] Thu, 05 July 2018 15:49 Go to next message
JulianneMeisner is currently offline  JulianneMeisner
Messages: 1
Registered: July 2018
Location: Seattle
Hi everyone,

I'm trying to perform small area estimation on household cattle ownership for the 2010 Malawi DHS, using the survey package in R.

I have created the dataset "data" by merging MWHR61FL.DTA and MWIR61FL.DTA on household ID, which I generated from "v001" and "v002" in the individual (MWIR61FL.DTA) dataset, and from "hv001" and "hv002" in the household (MWHR61FL.DTA) dataset.

My code is as follows:
dhs.des<-svydesign(id=data$v021, weights=data$v005/1000000, strata=data$v022, data=data)
cattle<-svyby(~hv246a, ~v001, dhs.des2, svymean)

This gives nonsensical standard errors (mean 4.3e-17), as does svytotal.

Before chasing down a problem with the survey package or my implementation of it, I wanted to make sure that I'm setting up the design correctly in the svydesign command.

Many thanks,
Re: Problems with of Malawi 2010 DHS in survey package (R) [message #15402 is a reply to message #15363] Thu, 12 July 2018 17:41 Go to previous message
boyle014 is currently offline  boyle014
Messages: 37
Registered: December 2015
Location: Minneapolis
I can't answer the question about your coding, but I can tell you that nearly all the household variables, including cattle, are automatically attached to women in IPUMS DHS. You can log in with your DHS Program username (which is your email) and password. I'd select the Malawi 2010 sample first. Then select all the variables you need. You can find the cattle variables (yes/no and #) through the Search function or the drop-down Topics menu (they are under Household Characteristics -> Agricultural Possessions). The plus-sign by variables adds them to your data cart.

Once you've got the sample and variables selected, click on View Data Cart to create and download your data file. (The data are free; we just use the cart metaphor because people understand it).

If you're using R, you probably want to change the data format to .csv.

Good luck with your research!

Professor Elizabeth Boyle
Sociology & Law, University of Minnesota, USA
Principal Investigator, IPUMS-DHS
Previous Topic: Country-level weights for MLM
Next Topic: Sampling weight calculation for Under five children of Bangladesh
Goto Forum:

Current Time: Fri Jul 20 06:29:31 Eastern Daylight Time 2018