The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Weighting data » Query on Cluster-Level Modeling with DHS Data and Sampling Weights (Building models whereby the response variable and covariates, are aggregated at the cluster level.)
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 Go to previous messageGo to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3172
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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Calculating residuals for adjusted logistic regression models after using the svy command
Next Topic: DHS weights and random effects in a GLMM
Goto Forum:
  


Current Time: Sat Oct 19 19:20:56 Coordinated Universal Time 2024