The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Weighting data » Clustered Standard Errors
Re: Clustered Standard Errors [message #22298 is a reply to message #22292] Wed, 24 February 2021 09:01 Go to previous messageGo to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3035
Registered: February 2013
Senior Member
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:

The generic form of svyset is this:

svyset cluster_ID [pweight=v005], strata(stratum_ID) singleunit(centered) 

In this syntax, the first variable after "svyset" (here "cluster_ID") is the PSU. "singleunit(centered)" is related to the "strata(stratum_ID)" term. It keeps the program from crashing if it encounters only one PSU within a stratum. There are a couple of alternatives to "centered" but I have done comparisons and the results are indistinguishable for the different options. You are usually ok without the singleunit option but I usually include it because I hate crashes.

Below I will paste an example from one time when I was pooling two surveys from 2008 and 2018. The two surveys had different specifications of strata. You can see how "egen group" was used. Note that "egen group" does NOT combine or pool. It does just the opposite. For example, say that in the PR file you wanted to construct a variable for all combinations of urban/rural (hv025=1 or 2) and male/female (hv104=1 or 2). You would use "egen place_sex=egen(hv025 hv104)" to get a four-category variable for the combinations of hv025 and hv104. This can be handy for making tables or interpreting interaction terms. In the example below, it basically distinguishes the designs of the 2008 and 2018 samples. Hope this helps.

* In the 2008 survey
egen stratum_ID_2008=group(shstate v025)
gen tempvar=stratum_ID_2008

* In the 2018 survey
gen stratum_ID_2018=v023
gen tempvar=stratum_ID_2018

* Append, and construct "survey" using v007...

* In the combined file
egen stratum_ID=group(tempvar survey)
drop tempvar

egen cluster_ID=group(v001 survey)

svyset cluster_ID [pweight=v005], strata(stratum_ID) singleunit(centered)

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Confirming correct survey design
Next Topic: What is the difference between v005 and sweight DHS India?
Goto Forum:
  


Current Time: Thu Apr 18 22:13:25 Coordinated Universal Time 2024