The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Nutrition and Anthropometry » incorrect stunting rates
Re: incorrect stunting rates [message #14233 is a reply to message #14227] Wed, 07 March 2018 15:09 Go to previous messageGo to previous message
Trevor-DHS is currently offline  Trevor-DHS
Messages: 805
Registered: January 2013
Senior Member
I'm matching the numbers from the report with the following code:
library(foreign)
library(survey)
# switch to directory where my data exists
setwd("C:/Data/DHS_stata/")

# read the PR dataset
data <- read.dta("BUPR61FL.dta", convert.factors = TRUE)

# subset for children measured with valid measures who are de facto
data2 <- data[!is.na(data$hc70) & data$hc70<9000 & data$hv103==1,]

# making a variable for stunting
data2$stunt <- ifelse(data2$hc70 < -200,'stunted','not_stunted')

# create weight variable
data2$wt <- data2$hv005/1000000

# survey settings
data.w <- svydesign(id = ~ hv001, data = data2, weight = ~ wt, strata = ~ hv022)

# tabulate stunting by sex
svyby(~stunt, ~hv104, data.w, svymean)

        hv104 stuntnot_stunted stuntstunted se.stuntnot_stunted se.stuntstunted
male     male        0.3790181    0.6209819          0.01352742      0.01352742
female female        0.4687265    0.5312735          0.01374611      0.01374611

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: DHS of India 2015/16 and 2005/06
Next Topic: Consent for additional tests
Goto Forum:
  


Current Time: Sun Dec 22 04:36:49 Coordinated Universal Time 2024