Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Understanding how lincom gets results after margins
From
[email protected] (Jeff Pitblado, StataCorp LP)
To
[email protected]
Subject
Re: st: Understanding how lincom gets results after margins
Date
Thu, 31 Oct 2013 16:29:38 -0500
Ariel Linden <[email protected]> is trying to use -lincom- after
-margins-, but is not getting the expected result:
> After running a poisson regression, I ran -margins- to get individual pre
> and post values for a treatment and control group. Next, I ran -lincom- in
> order to estimate the difference in differences, ie,. (treatment_post -
> treatment_pre) - (control_post - control_pre).
>
> The results from -lincom- do not produce the same values as when calculating
> them manually from the table produced by -margins-. Interestingly enough,
> the results from -lincom- are exactly as those produced in the poisson
> regression table for the interaction treatment#period. Can someone explain
> this discrepancy, and explain how lincom got these results?
>
> **** start code****
>
> . margins postperiod , over(pilot ) coefleg
>
> Predictive margins Number of obs =
> 54794
> Model VCE : Robust
>
> Expression : Predicted number of events, predict()
> over : pilot
> ----------------------------------------------------------------------------
> ------
> | Margin Legend
> -----------------+----------------------------------------------------------
> ------
> pilot#postperiod |
> control#pre | .0604865 _b[0bn.pilot#0bn.postperiod]
> control#post | .0576589 _b[0bn.pilot#1.postperiod]
> treated#pre | .0629165 _b[1.pilot#0bn.postperiod]
> treated#post | .0602585 _b[1.pilot#1.postperiod]
> ----------------------------------------------------------------------------
> ------
>
> lincom (_b[1.pilot#1.postperiod] - _b[1.pilot#0bn.postperiod]) -
> (_b[0bn.pilot#1.postperiod] - _b[0bn.pilot#0bn.postperiod])
>
> ( 1) [imaging_post_index_tot]0b.pilot#0b.postperiod -
> [imaging_post_index_tot]0b.pilot#1o.postperiod -
> [imaging_post_index_tot]1o.pilot#0b.postperiod +
> [imaging_post_index_tot]1.pilot#1.postperiod = 0
>
> ----------------------------------------------------------------------------
> --
> imaging_po~t | Coef. Std. Err. z P>|z| [95% Conf.
> Interval]
> -------------+--------------------------------------------------------------
> --
> (1) | .0047102 .0810194 0.06 0.954 -.1540849
> .1635053
> ----------------------------------------------------------------------------
> --
>
> * calculating differences in differences manually from -margins- table:
> . di (.0602585 - .0629165) - (.0576589 - .0604865)
> .0001696
>
> **** end code***
-lincom- operates on the current estimation results in -e()-. Without the
-post- option in the call to -margins-, this means that -lincom- is using the
-e()- results from the most currently estimated model. Ariel needs to specify
the -post- option with -margins- to get -lincom- to work with -margins- own
estimation results.
We notice that Ariel used the -coeflegend- with -margins- without also
specifying the -post- option. -margins- should have produced an error
message, because it otherwise gives the impression that -e(b)- is from margins
instead of the originally fitted estimation. We will fix this in a future
update to Stata 13.
--Jeff
[email protected]
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/