Home » Topics » General » DHS ZIMBABWE 2015 (DEFF and Survey package R)
DHS ZIMBABWE 2015 [message #23885] |
Wed, 29 December 2021 06:13 |
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 |
Bridgette-DHS
Messages: 3203 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
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Dec 6 12:49:28 Coordinated Universal Time 2024
|