Can't get exact match between one regional calculation and reported stunting value [message #18225] |
Thu, 17 October 2019 12:38 |
dhsLearner
Messages: 4 Registered: October 2019
|
Member |
|
|
I am trying to calculate childhood (under 5) stunting rates by region in Senegal in 2012. For one region, I am getting a different result than what it is reported in the Senegal sumary report. Here is my R code:
#read in data
PR2012<-fread("..\\dhs\\dataForR\\continuousSurvey2012\\SNPR6DFL.csv ")
# Create a binary variable for children stunted
PR2012$stuntedUnderFive<-ifelse(PR2012$hc70< -200, 1, 0)
# Assign NA when z score is >9900 sd (NA) #9998 are don't know responses
PR2012$stuntedUnderFive<-ifelse(PR2012$hc70>9900|
PR2012$hc1> 59, NA, PR2012$stuntedUnderFive)
# Create weight variable
PR2012$wt<-PR2012$hv005/1000000
# Tabluate stunted by region
PR2012%>%
group_by(shzone)%>% #shzone is the four regions (north, east, south west)
summarize(meanStunting = weighted.mean(stuntedUnderFive,wt,na.rm = T))
Results:
1 centre 0.190
2 nord 0.168
3 ouest 0.145
4 sud 0.266
I calculate West (ouest) as 14.5%, but it is reported as 14.7% in the summary (https://dhsprogram.com/pubs/pdf/FR288/FR288eng.pdf).
Can anyone help me figure out what I am doing incorrectly?
|
|
|
|
Re: Can't get exact match between one regional calculation and reported stunting value [message #18227 is a reply to message #18226] |
Thu, 17 October 2019 14:25 |
dhsLearner
Messages: 4 Registered: October 2019
|
Member |
|
|
Thank you. This was the problem. Wow there are so many fine print notes and variables that go along with them. Definitely need to keep my eyes out for filters like this.
For future reference to other people looking at this forum post, I added hv103 (did child stay in house night before) to my code as follows:
PR2012$stuntedUnderFive<-ifelse(PR2012$hc70>9900|
PR2012$hc1> 59 | PR2012$hv103 =="no", NA, PR2012$stuntedUnderFive)
|
|
|