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
command for Cluster Average of Women's employment [message #27261] Sun, 09 July 2023 06:23 Go to next message
Alanood is currently offline  Alanood
Messages: 18
Registered: November 2022
Member
Hi

I would greatly appreciate your guidance on calculating the cluster average of women's working status excluding women's own employment status to avoid in-built association using Stata.
I am applying instrumental variable approach and I need to use this variable as an instrument for maternal employment.


Thank you
Re: command for Cluster Average of Women's employment [message #27296 is a reply to message #27261] Thu, 13 July 2023 12:49 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3185
Registered: February 2013
Senior Member

Following is a response from Senior DHS staff member, Tom Pullum:

In Stata you can calculate a cluster-level mean with an "egen" command. For example, you could calculate the cluster-specific mean of v201 (children ever born) for all the women in a cluster using "egen v201_mean=mean(v201), by(v001)". This can be modified to construct a woman-specific variable that omits the woman herself from the calculation. Alternatively, the difference (the cluster mean minus the woman's value) will be statistically independent of the cluster mean.

Questions about instrumental variables are outside the scope of the assistance that DHS staff will provide.

Re: command for Cluster Average of Women's employment [message #27298 is a reply to message #27296] Thu, 13 July 2023 13:41 Go to previous messageGo to next message
Alanood is currently offline  Alanood
Messages: 18
Registered: November 2022
Member
Thank you for your replay

Regarding your point " This can be modified to construct a woman-specific variable that omits the woman herself from the calculation. "
How this can be done ?

If the average is done by this command
egen v201_mean=mean(v201), by(v001)

How can I exclude the women itself from v201_mean.

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: 3185
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
Previous Topic: Setting the Data for Survey Analysis-Stata
Next Topic: stunting calculation
Goto Forum:
  


Current Time: Sat Nov 2 01:02:23 Coordinated Universal Time 2024