I am conducting a DID-analysis. Among other things, I am looking to see how a treatment impacts the salary for men and women. However, just comparing the coefficient tells only half of the story. I also need to take into account the baseline salary for men and women.
Therefore, I have been looking into using – margins, eydx - to calculate percentage difference in y for a difference in treatment (0 1) for men and women. I would like to know whether or not this is a correct approach.
Here is some coding and some example data. In the data, men and women experience the same decline of 5000 but the eydx provides the two different percentage decreases, respectively 12.5% for men and 16.6% for women. This all seems very logical to me (and maybe this questions is redundant).
Code:
* For men reg salary i.time##i.treatment##i.gender margins treatment, at(time=(97 98 99 101 102 103) gender =(0)) marginsplot qui reg salary i.time##i.treatment##i.gender margins treatment, at(time=(99 101) gender =(0)) margins, eydx(treatment) at(time=(99 101) gender =(0)) post margins, coeflegend di (exp(_b[1.treatment:2._at])-1)*100 * women reg salary i.time##i.treatment##i.gender margins treatment, at(time=(97 98 99 101 102 103) gender =(1)) marginsplot qui reg salary i.time##i.treatment##i.gender margins treatment, at(time=(99 101) gender =(1)) margins, eydx(treatment) at(time=(99 101) gender =(1)) post margins, coeflegend di (exp(_b[1.treatment:2._at])-1)*100
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(id time treatment salary gender) 1 97 1 30000 1 1 98 1 30000 1 1 99 1 30000 1 1 100 1 30000 1 1 101 1 25000 1 1 102 1 25000 1 1 103 1 25000 1 2 97 1 30000 1 2 98 1 30000 1 2 99 1 30000 1 2 100 1 30000 1 2 101 1 25000 1 2 102 1 25000 1 2 103 1 25000 1 5 97 1 40000 0 5 98 1 40000 0 5 99 1 40000 0 5 100 1 40000 0 5 101 1 35000 0 5 102 1 35000 0 5 103 1 35000 0 6 97 0 30000 1 6 98 0 30000 1 6 99 0 30000 1 6 100 0 30000 1 6 101 0 30000 1 6 102 0 30000 1 6 103 0 30000 1 7 97 0 30000 1 7 98 0 30000 1 7 99 0 30000 1 7 100 0 30000 1 7 101 0 30000 1 7 102 0 30000 1 7 103 0 30000 1 8 97 0 40000 0 8 98 0 40000 0 8 99 0 40000 0 8 100 0 40000 0 8 101 0 40000 0 8 102 0 40000 0 8 103 0 40000 0 9 97 0 40000 0 9 98 0 40000 0 9 99 0 40000 0 9 100 0 40000 0 9 101 0 40000 0 9 102 0 40000 0 9 103 0 40000 0 12 97 1 40000 0 12 98 1 40000 0 12 99 1 40000 0 12 100 1 40000 0 12 101 1 35000 0 12 102 1 35000 0 12 103 1 35000 0 13 97 0 40000 0 13 98 0 40000 0 13 99 0 40000 0 13 100 0 40000 0 13 101 0 40000 0 13 102 0 40000 0 13 103 0 40000 0 14 97 0 40000 0 14 98 0 40000 0 14 99 0 40000 0 14 100 0 40000 0 14 101 0 40000 0 14 102 0 40000 0 14 103 0 40000 0 15 97 0 30000 1 15 98 0 30000 1 15 99 0 30000 1 15 100 0 30000 1 15 101 0 30000 1 15 102 0 30000 1 15 103 0 30000 1 16 97 0 30000 1 16 98 0 30000 1 16 99 0 30000 1 16 100 0 30000 1 16 101 0 30000 1 16 102 0 30000 1 16 103 0 30000 1 17 97 1 40000 0 17 98 1 40000 0 17 99 1 40000 0 17 100 1 40000 0 17 101 1 35000 0 17 102 1 35000 0 17 103 1 35000 0 18 97 1 40000 0 18 98 1 40000 0 18 99 1 40000 0 18 100 1 40000 0 18 101 1 35000 0 18 102 1 35000 0 18 103 1 35000 0 19 97 1 30000 1 19 98 1 30000 1 end
0 Response to Using eydx to calculate percentage difference in Y in difference-in-difference-analysis for men and women
Post a Comment