The DHS Program User Forum
Discussions regarding The DHS Program data and results
Today's Messages (on)  | Unanswered Messages (off)

Forum: Weighting data
 Topic: Query on Cluster-Level Modeling with DHS Data and Sampling Weights
Re: Query on Cluster-Level Modeling with DHS Data and Sampling Weights [message #30076 is a reply to message #30047] Fri, 20 September 2024 06:41
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3159
Registered: February 2013
Senior Member
Following is a response from Senior DHS staff member, Tom Pullum:

You are using R. Below I will paste a simple example in Stata, showing what I would do. The example shows how the weights and number of cases come into play with a binary outcome and a glm model. Substantively, this would not be a good analysis of the data, but it is just intended as an example of the setup. Hope you can convert to R and hope this is helpful.
* Example of individual-level and cluster-level analysis with the same variables
* Kenya 2014 DHS survey

use "...KEIR81FL.DTA" , clear

* construct a binary outcome variable for 4+ children
gen     nch4plus=0
replace nch4plus=1 if v201>=4

* construct dummies for wealth quintiles
xi i.v190
rename _I* *

* Individual-level analysis
svyset v001 [pweight=v005], strata(v023) singleunit(centered)
glm nch4plus v190_* , family(binomial) link(logit) eform


* Cluster-level analysis; first switch to clusters as units
gen cases=1
collapse (first) v005 v023 (sum) nch4plus cases (mean) v190_*, by(v001)

svyset [pweight=v005], strata(v023) singleunit(centered)
glm nch4plus v190_* , family(binomial cases) link(logit) eform



Current Time: Fri Sep 20 21:09:17 Coordinated Universal Time 2024