The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » General » DHS ZIMBABWE 2015 (DEFF and Survey package R)
DHS ZIMBABWE 2015 [message #23885] Wed, 29 December 2021 06:13 Go to next message
p.pajak is currently offline  p.pajak
Messages: 3
Registered: December 2021
Member
Good Morning,

I am in the process of analysing the 2015 DHS from Zimbabwe. I am using R (I am quite new to the programme) and I am currently stuck as my DEFFs are all coming out negative (it should not happen in my case) or not at all.
I am analysing the data from 1 region only and I already did the cleaning and subset of my data.
I set my survey design following the instructions I found online from other users:
DHSdesign<-svydesign(id= ~fin_df$PSU, #V021
strata= ~fin_df$STRATA, #V022
weights= ~fin_df$PERWEIGHT, #V005
data=fin_df)

Now, I want to calculate the DEFF for the variable C_SEX2 from my fin_df dataframe and I type the following:
DEFF<- svymean(~fin_df$C_SEX2, design=DHSdesign, na = TRUE, deff = TRUE)

the output is the following:
Warning message:
In svymean.survey.design2(~fin_df$C_SEX2 == 1, design = DHSdesign, :
Sample size greater than population size: are weights correctly scaled?

mean SE DEff
fin_df$C_SEX20 0.548656 0.021449 NA
fin_df$C_SEX21 0.451344 0.021449 NA

I also tried:
DEFF1 <- svytotal(~fin_df$C_SEX2, design=DHSdesign, na = TRUE, deff = TRUE)
total SE DEff
fin_df$C_SEX20 144.736 12.150 -5.2710
fin_df$C_SEX21 119.065 9.295 -3.0851

Can anyone see a mistake or advise me?

Thank you very much in advance :)

Best wishes,
Patrizia

[Updated on: Wed, 29 December 2021 06:14]

Report message to a moderator

Re: DHS ZIMBABWE 2015 [message #23898 is a reply to message #23885] Mon, 03 January 2022 21:13 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 2537
Registered: February 2013
Senior Member
Following is a response from DHS Senior Sampling Specialist, Mahmoud Elkasabi:

To calculate DEFF with R, using the svydesign function, the weights must first be divided by 1,000,000. To analyze data for one region (or another subpopulation), the subset function should be used. Here is the R code:

DHSdesign<-svydesign(id= ~fin_df$PSU, #V021
strata= ~fin_df$STRATA, #V022
weights= ~fin_df$PERWEIGHT, #V005/1000000
data=fin_df)

DHSdesign_sub <-subset(DHSdesign,V024=xx)

# the DHSdesign_sub should be now used instead

DEFF<- svymean(~fin_df$C_SEX2, design=DHSdesign_sub, na = TRUE, deff = TRUE)

[Updated on: Mon, 03 January 2022 21:13]

Report message to a moderator

Re: DHS ZIMBABWE 2015 [message #23909 is a reply to message #23898] Fri, 07 January 2022 13:08 Go to previous messageGo to next message
p.pajak is currently offline  p.pajak
Messages: 3
Registered: December 2021
Member
Good Evening,

Thank you for providing me with the R code. My weights have already been divided by 1000 000 as I am using IPUMS DHS data and I have done the subset by the region of interest in fin_df. I think the issue is that r considers this survey design with replacement if I give the command as written above and therefore by putting DEFF=TRUE doesn't work. It only works if I write DEFF=replace.

Could you please let me know if this is correct.

Many thanks!
Re: DHS ZIMBABWE 2015 [message #23910 is a reply to message #23909] Fri, 07 January 2022 15:30 Go to previous messageGo to next message
p.pajak is currently offline  p.pajak
Messages: 3
Registered: December 2021
Member
Just to clarify further my answer please see below my code:
DHSdesign<-svydesign(id= ~fin_df$PSU,
strata= ~fin_df$STRATA,
weights= ~fin_df$PERWEIGHT, # the weights have already been divided by 1000000
data=fin_df) # fin_df has already been subset by region of interest

This is the outcome I obtain by calling the summary of my survey design
summary(DHSdesign)

Stratified 1 - level Cluster Sampling design (with replacement)
With (36) clusters.

Therefore I need to use DEFF = "replace" to obtain the DEFF as below:
svymean(~fin_df$C_SEX2, design=DHSdesign, na = TRUE, deff = "replace")

I read in another comment that to change the design to "without replacement" I would need to specify the fpc which is not provided by DHS and therefore doesn't need to be included.
Hope this helps clarify my answer! Thank you very much for the assistance.
Re: DHS ZIMBABWE 2015 [message #23916 is a reply to message #23910] Mon, 10 January 2022 09:50 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 2537
Registered: February 2013
Senior Member

Following is another response from DHS Senior Sampling Specialist, Mahmoud Elkasabi:

Yes, this is correct, deff="replace" should be used instead.
Previous Topic: gender matching interviewer / participant in Zimbabwe & Burundi
Next Topic: Jordan - Cousin Marriage Question
Goto Forum:
  


Current Time: Mon Jun 27 13:35:29 Coordinated Universal Time 2022