The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Child Health » Sampling Weigths for children under 5 (Using R)
Sampling Weigths for children under 5 [message #19318] Fri, 29 May 2020 11:16 Go to previous message
rafaaqp1990 is currently offline  rafaaqp1990
Messages: 2
Registered: May 2020
Dear all,
I am new to survey data and I am having trouble trying to find my error in my R-Code. I chose Philippines 2017 and I am trying to calculate the percentage of vitamin A supplementation for this country for children under 5.

This is my R-Code

phi17 <- read.dta("PHKR71FL.DTA")
# Using labels as column names
var.labels <- attr(phi17, "var.labels")
names(phi17) <- var.labels

For speficying the model I use the following code:

# Simplifying column names
phi17$weight <- as.numeric(phi17$`women's individual sample weight (6 decimals)`/1000000)
phi17$psu <- phi17$`primary sampling unit`
phi17$strata <- phi17$`stratification used in sample design`
phi17$vi_a = phi17$`vitamin a in last 6 months`

phi_17_design <- svydesign(~ psu,
strata = ~strata,
weights = ~ weight,
data = phi_17)

So, I used the weights for the women but when I calculate the percentage of children who received a vitamin A supplement in the last 6 months in Philippines 2017, i get the following results:
svymean(~ vi_a, phi_17_design, na.rm = TRUE) --> yes: 69.47%

HOWEVER, when I read the final report, the result should actually be 76%.

Does anyone recognize the mistake? Did I specified the weigths correctly??

Thank you in advance!

Best regards


Read Message
Read Message
Read Message
Previous Topic: Issues with the variable ml1 (fansidar)
Next Topic: About the Data extraction
Goto Forum:

Current Time: Mon Dec 11 14:41:19 Coordinated Universal Time 2023