Bookmark and Share

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]

st: Understanding how lincom gets results after margins


From   "Ariel Linden, DrPH" <ariel.linden@gmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Understanding how lincom gets results after margins
Date   Thu, 31 Oct 2013 15:52:22 -0400

Hi All,

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? 

Thanks!

Ariel

**** 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***


*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index