The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Countries » India » NFHS-4 India sample design in R (NFHS-4 India sample design in R)
NFHS-4 India sample design in R [message #22268] Mon, 22 February 2021 08:55 Go to next message
asya_dm is currently offline  asya_dm
Messages: 2
Registered: February 2021
Hi! I am using data from NFHS-4 India for some analysis and I would like to account for complex survey design (using the survey package in R) before estimating the distribution of certain variables. However, I always get an error message when I try to calculate totals,means or other statistics and I am not sure why.

This is how my code looks like:

dhs_design <-
id = ~ v021, #primary sampling unit
strata = ~v023, #stratification used in sample design
data = dhs_children,
weights = ~v005/1000000)

svytotal( x= ~ multiple_birth, dhs_design, na.rm = TRUE)

The error message that I get:
Error in onestrat(x[index, , drop = FALSE], clusters[index], nPSU[index][1], :
Stratum (902) has only one PSU at stage 1

Can you please let me know if I have correctly accounted for sample design? Is the stratification variable correct?
Your help will be very much appreciated.

Re: NFHS-4 India sample design in R [message #22278 is a reply to message #22268] Tue, 23 February 2021 07:49 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 2167
Registered: February 2013
Senior Member

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

You need to run the following line code before you run the svydesign to avoid errors from single-PSU strata.

options(survey.lonely.psu = "adjust")
Previous Topic: Household structure of NFHS-4
Next Topic: NFHS 4 district codes
Goto Forum:

Current Time: Tue Mar 2 16:20:47 Coordinated Universal Time 2021