The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset use in Stata » command for Cluster Average of Women's employment
Re: command for Cluster Average of Women's employment [message #27311 is a reply to message #27298] Mon, 17 July 2023 07:53 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3230
Registered: February 2013
Senior Member
Following is a response from Senior DHS staff member, Tom Pullum:

I will illustrate with v201; you need to revise with your employment variable.

egen v201_total=total(v201), by(v001)
egen v201_n=count(v201),by(v001)

gen v201_mean=v201_total/v201_n
* v201_mean can also be obtained from "egen v201_mean=mean(v201), by(v001)"

* Now construct a mean for the cluster, for each respondent, that omits each respondent
gen v201_mean_adj=(v201_total-v201)/(v201_n-1)

correlate v201 v201_mean
correlate v201 v201_mean_adj
* The respondent's value of v201 is correlated with both of these means, although 
*   less so with the mean for which she is removed
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Setting the Data for Survey Analysis-Stata
Next Topic: stunting calculation
Goto Forum:
  


Current Time: Tue Feb 18 15:07:04 Coordinated Universal Time 2025