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 Sun, 09 July 2023 06:23
 Alanood Messages: 18Registered: 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
 Bridgette-DHS Messages: 3094Registered: 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
 Alanood Messages: 18Registered: November 2022 Member

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
 Bridgette-DHS Messages: 3094Registered: 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