Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte(owndecision treat gender) 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 0 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 1 0 1 1 1
treat=0,1,2; (3 treatments: 0=common, 1=asymmetric, 2=private)
gender=1 if female, 0 otherwise
I would like the average marginal effects of defection (owndecision=1) by gender for asymmetric and private and to produce a graph that looks like this:
Array
Code:
logit owndecision i.gender#i.treat
------------------------------------------------------------------------------
owndecision | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
gender#treat |
0 1 | 1.466337 .7372854 1.99 0.047 .0212843 2.91139
0 2 | 2.590267 1.179689 2.20 0.028 .2781187 4.902415
1 0 | 1.041454 .6522961 1.60 0.110 -.237023 2.319931
1 1 | 1.977163 .6868733 2.88 0.004 .6309158 3.32341
1 2 | 0 (empty)
margins, dydx(treat) over(gender)
------------------------------------------------------------------------------
| Delta-method
| dy/dx Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
1.treat |
gender |
0 | .3472222 .1606046 2.16 0.031 .032443 .6620015
1 | .1828704 .1157482 1.58 0.114 -.0439919 .4097326
-------------+----------------------------------------------------------------
2.treat |
gender |
0 | .5138889 .1600699 3.21 0.001 .2001576 .8276201
1 | . (not estimable)
------------------------------------------------------------------------------
Note: dy/dx for factor levels is the discrete change from the base level.
marginsplot
Array
Any help would be appreciated. Thank you.
0 Response to calculating and graphing marginal effects from logit with interaction effect of two categorical variables
Post a Comment