Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exporting Lincoln result using Outreg2

    Hello,

    i am trying to export my ITSA output tables to Microsoft Word using Outreg2 command, however; the post-intervention Trend (Lincoln) results are not being exported when i run the command outreg2 using myreg.doc, replace ctitle(Model 1) label and i really want them to be include. How can i do that?

    Thanks.
    Daughtry

  • #2
    I would switch to margins here since it has a -post- option to export results to ereturn. lincom is somewhat an outdated command. Here is an example.

    Code:
    sysuse auto
    regress mpg weight headroom length
    lincom  length-headroom
    margins, expression(_b[length]-_b[headroom]) post
    *RESULTS NOW AVAILABLE IN ERETURN

    Res.:

    Code:
    . lincom  length-headroom
    
     ( 1)  - headroom + length = 0
    
    ------------------------------------------------------------------------------
             mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             (1) |  -.0270668   .5700088    -0.05   0.962    -1.163913     1.10978
    ------------------------------------------------------------------------------
    
    .
    . margins, expression(_b[length]-_b[headroom]) post
    Warning: expression() does not contain predict() or xb().
    Warning: prediction constant over observations.
    
    Predictive margins                              Number of obs     =         74
    Model VCE    : OLS
    
    Expression   : _b[length]-_b[headroom]
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           _cons |  -.0270668   .5700088    -0.05   0.962    -1.144263     1.09013
    ------------------------------------------------------------------------------

    Comment


    • #3
      Hi Andrew,

      Thanks for the reply. However, i am not too sure if that command will produce the results i am looking for; because, when i use ITS analysis and run the following command,
      itsa skilledbirth, treatid(1) trperiod(`=tm(2016m11)') contid(17) replace posttrend figure, The results as shown below are produced. This is particularly important because the command also produces a comparison of Linear Postintervention Trends and gives the difference between the Treated and control groups. however, the command outreg2 using myreg.doc, replace ctitle(Model 1) label only exports the first part leaving out the second. Kindly help me. Thanks again.


      panel variable: district (strongly balanced)
      time variable: months, jan 2013 to dec 2018
      delta: 1 month

      Regression with Newey-West standard errors Number of obs = 140
      maximum lag: 0 F( 7, 132) = 9.03
      Prob > F = 0.0000

      ------------------------------------------------------------------------------
      | Newey-West
      skilledbirth | Coef. Std. Err. t P>|t| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      _t | .002029 .0011567 1.75 0.082 -.000259 .0043171
      _z | .0113954 .0372538 0.31 0.760 -.0622964 .0850871
      _z_t | .0004281 .0012506 0.34 0.733 -.0020458 .0029019
      _x682 | .0188988 .0293461 0.64 0.521 -.0391507 .0769484
      _x_t682 | -.0047734 .0023283 -2.05 0.042 -.009379 -.0001677
      _z_x682 | -.0502957 .0380814 -1.32 0.189 -.1256245 .0250331
      _z_x_t682 | .0054849 .0027957 1.96 0.052 -.0000452 .011015
      _cons | .7808479 .0347094 22.50 0.000 .7121892 .8495066
      ------------------------------------------------------------------------------


      Comparison of Linear Postintervention Trends: 682


      Treated : _b[_t] + _b[_z_t] + _b[_x_t682] + _b[_z_x_t682]
      Controls : _b[_t] + _b[_x_t682]
      Difference : _b[_z_t] + _b[_z_x_t682]
      ------------------------------------------------------------------------------
      Linear Trend | Coeff Std. Err. t P>|t| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      Treated | 0.0032 0.0015 2.1518 0.0332 0.0003 0.0061
      Controls | -0.0027 0.0020 -1.3581 0.1767 -0.0067 0.0013
      -------------+----------------------------------------------------------------
      Difference | 0.0059 0.0025 2.3649 0.0195 0.0010 0.0109
      ------------------------------------------------------------------------------

      Comment


      • #4
        To get the output underneath the regression table:

        Code:
        margins, expression(_b[_t] + _b[_z_t] + _b[_x_t682] + _b[_z_x_t682]) post
        margins, expression(_b[_t] + _b[_x_t682]) post
        margins, expression( _b[_z_t] + _b[_z_x_t682]) post
        Start by exporting the output from the command and then append the outputs from these margins commands, one by one.

        Comment


        • #5
          Andrew, you are a life saver. Thanks so much.

          Comment


          • #6
            Hello, Andrew

            I'm doing ttest using the following codes:
            Code:
            svy: mean g0_edu if sample==1 & area==0 & total_int_women1==1, over(Covid19) coeflegend
            test  _b[[email protected]] -  _b[[email protected]]
            I have to repeat the process for 9 more variables. Is there any way to get the output into table format consisting of means of the variables by the group variable, followed by the difference between the means and then the t-statistic with significance stars?

            Thanks.

            Comment


            • #7
              Please start a new thread as your question differs from the content addressed in this thread and I will respond there. Title it as "Exporting svy: mean and test results into a table" or something similar.

              Comment


              • #8
                Sure, Andrew.

                Comment

                Working...
                X