Please consider the following example data
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte stateid int birthyear float(imr post treat highwealth cluster) 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . . . 0 1 . 3 . . . 0 1 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . . . 0 1 . 3 2008 0 1 0 1 3446 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . . . 0 1 . 3 . . . 0 0 . 3 2004 0 0 0 1 3396 4 . 0 . 0 1 . 4 . . . 0 1 . 4 . 0 . 0 1 . 4 . 0 . 0 1 . 4 . 0 . 0 1 . 4 . . . 0 1 . 4 . . . 0 1 . 4 . 0 . 0 1 . 4 . 0 . 0 1 . 4 . 0 . 0 1 . 4 . . . 0 1 . 4 . . . 0 1 . 4 . 0 . 0 1 . 4 2007 0 0 0 1 3425 5 . 0 . 0 1 . 5 . 0 . 0 1 . 5 2005 0 0 0 1 3406 5 . . . 0 1 . 5 . 0 . 0 1 . 5 . 0 . 0 1 . 5 . 0 . 0 1 . 5 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 2007 0 0 0 1 3430 3 2006 0 0 0 1 3422 3 2007 0 0 0 1 3435 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . . . 0 1 . 3 2007 0 0 0 1 3435 3 2011 0 1 0 1 3477 3 2005 0 0 0 1 3401 3 . . . 0 1 . 3 . . . 0 1 . 3 . . . 0 1 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . . . 0 1 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 2002 0 0 0 1 3364 3 . . . 0 1 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . . . 0 1 . 3 2009 0 1 0 1 3449 3 . . . 0 1 . 3 . . . 0 0 . 3 . . . 0 0 . 3 2010 0 1 0 1 3466 3 2011 0 1 0 1 3482 3 . . . 0 1 . 3 2004 0 0 0 0 3399 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 2011 0 1 0 1 3483 3 2006 0 0 0 1 3417 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 2010 0 1 0 1 3469 3 2007 0 0 0 1 3427 3 . 0 . 0 1 . 3 2008 0 0 0 1 3438 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 2006 0 0 0 1 3417 3 . . . 0 0 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . . . 0 1 . 3 . 0 . 0 1 . 3 . . . 0 1 . 3 . 0 . 0 1 . 3 2008 1 0 0 1 3441 3 2001 0 0 0 0 3352 3 . . . 0 1 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . 3 . 0 . 0 1 . end label values imr binarylabel label def binarylabel 0 "no", modify label def binarylabel 1 "yes", modify
Code:
areg imr i.treat##i.post i.stateid highwealth, absorb(birthyear) cluster(cluster)
I went through the very helpful guide by Richard Williams on https://www3.nd.edu/~rwilliam/stats/Margins01.pdf and did the following:
Code:
margins treat#post, at( highwealth=(0 1)) vsquish
Code:
Predictive margins Number of obs = 172,020 Model VCE: Robust Expression: Linear prediction, predict() 1._at: highwealth= 0 2._at: highwealth= 1 ------------------------------------------------------------------------------------------------ | Delta-method | Margin std. err. t P>|t| [95% conf. interval] -------------------------------+---------------------------------------------------------------- _at#treat#post| 1 0 0 | . (not estimable) 1 0 1 | . (not estimable) 1 1 0 | . (not estimable) 1 1 1 | . (not estimable) 2 0 0 | . (not estimable) 2 0 1 | . (not estimable) 2 1 0 | . (not estimable) 2 1 1 | . (not estimable) ------------------------------------------------------------------------------------------------
Can someone please help me understand what is going on here and offer a solution?
Thanks
0 Response to -margins- and -marginsplot- for heterogeneity analysis
Post a Comment