Re: Weithted analysis in R [message #29723 is a reply to message #29696] |
Fri, 26 July 2024 14:57 |
Janet-DHS
Messages: 888 Registered: April 2022
|
Senior Member |
|
|
Following is a response from Senior DHS staff member, Ali Roghani:
This warning likely stems from how the weights are currently scaled in your dataset. To eliminate this warning, you can adjust the weights column so that it represents the total population size rather than just the number of survey respondents.
Here's a step-by-step guide to making this adjustment:
First, define the total population size. Replace with your actual population size:
total_population <- XXXXXX
Next, scale the weights in your dataset:
tb_data$wt_scaled <- tb_data$wt * total_population /sum(tb_data$wt)
Finally, create your survey design object using the scaled weights:
tb1 <- svydesign(ids = ~v021, weights = ~wt_scaled, data = tb_data, strata = ~v022, nest = TRUE)
Using the adjusted weights in your code should remove the warning.
The best source of estimates of population size for different countries and years is the U.N. Population Division:https://population.un.org/wpp/.
Please let us know if this does not solve the problem or if you have other questions.
|
|
|