The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Weighting data » Survey design in R (Getting warining that Sample size greater than population size)
Re: Survey design in R [message #29601 is a reply to message #29599] Tue, 09 July 2024 10:15 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3150
Registered: February 2013
Senior Member

Following is a response from Senior DHS staff member, Ali Roghani:

The warning you are encountering when using tbl_svysummary() from the gtsummary package is likely related to how the weights are scaled in your survey design. In R, the svymean.survey.design2() function is quite strict about weight scaling. To eliminate the warning, you can inflate the weights column so that it sums to the number of individuals it actually represents, rather than the number of survey respondents. Here's how we can do that:

# Adjust weights to sum to the actual population size
 total_population <- 25000000 # Replace with your actual population size
 mydata$wt_scaled <- mydata$wt * total_population / sum(mydata$wt) 
svy_design <- svydesign(id = ~hv021,  data = mydata,  strata = ~hv023,  weights = ~wt_scaled,  nest = TRUE) 

Using the adjusted weights in your svydesign() may eliminate the warning.
 
Read Message
Read Message
Previous Topic: Weighting for calendar module
Next Topic: Mali 2012/13 - Multilevel Modeling Weights
Goto Forum:
  


Current Time: Fri Aug 30 11:29:05 Coordinated Universal Time 2024