Announcement

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

  • Saving regression output and graph

    Hi. The code below generates the output below and a graph. From the two tables below, would like to save the results - variables include: _t, _x78, _x_t78 and Treated - to word and also save the graph, but am unable to figure out how to do this. Any help in doing so would be much appreciated

    Code:
    *code
    xtitsa week_doctele i.age_cat i.doc_desig i.gender_cat i.department_cat i.LVPexp_cat week_num, ///
    single trperiod(78) posttrend figure  (legend(order(1 "observed" 2 "fitted values")        ///
    size(small)) title("") note("") subtitle("") ytitle("Number of consultations")       ///
    ylabel(#5, labsize(small) angle(horizontal)) xtitle("")    legend(size(vsmall))                      ///
    legend(region(lstyle(none)))                                                                 ///
    xlab(40 "(1 Jan '22 - 29 Jun '23)" 92 "(30 Jun '23 - 31 Dec '23)", ///
    noticks labsize (vsmall)) xtick(`tickcall',  tlength(*2)) xline(78) scheme(s1color))  ///        
     replace 
    
    *output
    
    
    Panel variable: con_id (unbalanced)
     Time variable: week, 1 to 105, but with gaps
             Delta: 1 unit
    
    Iteration 1:  Tolerance = .07869841
    Iteration 2:  Tolerance = .00048275
    Iteration 3:  Tolerance = 3.027e-06
    Iteration 4:  Tolerance = 1.925e-08
    
    GEE population-averaged model                        Number of obs    =  5,557
    Group variable: con_id                               Number of groups =    120
    Family: Gaussian                                     Obs per group:  
    Link:   Identity                                                  min =      1
    Correlation: exchangeable                                         avg =   46.3
                                                                      max =     98
                                                         Wald chi2(25)    = 497.68
    Scale parameter = .0022993                           Prob > chi2      = 0.0000
    
    --------------------------------------------------------------------------------
     _week_doctele | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
    ---------------+----------------------------------------------------------------
                _t |   .0002157    .000152     1.42   0.156    -.0000823    .0005137
              _x78 |   .0100048    .002305     4.34   0.000     .0054871    .0145224
            _x_t78 |   .0006123   .0001359     4.51   0.000      .000346    .0008787
                   |
           age_cat |
                3  |   -.004508   .0096042    -0.47   0.639    -.0233318    .0143158
                4  |  -.0231224   .0131303    -1.76   0.078    -.0488573    .0026125
                5  |    .017706   .0200912     0.88   0.378    -.0216721    .0570842
                   |
         doc_desig |
                1  |   .0227044    .026191     0.87   0.386    -.0286291    .0740379
                2  |   .0300528   .0252098     1.19   0.233    -.0193575    .0794631
                3  |   .0336499    .026022     1.29   0.196    -.0173523    .0846522
                4  |   .0409049   .0258264     1.58   0.113    -.0097139    .0915236
                5  |    .056655   .0258541     2.19   0.028      .005982     .107328
                6  |   .0179768   .0322637     0.56   0.577    -.0452588    .0812124
                   |
      2.gender_cat |  -.0002757   .0063751    -0.04   0.966    -.0127708    .0122193
                   |
    department_cat |
                2  |   -.024566   .0330424    -0.74   0.457    -.0893279    .0401959
                3  |   .0081761   .0140167     0.58   0.560    -.0192962    .0356484
                4  |   .0012444   .0166673     0.07   0.940    -.0314229    .0339117
                5  |  -.0445234   .0361716    -1.23   0.218    -.1154184    .0263717
                6  |   .0029972   .0145861     0.21   0.837     -.025591    .0315853
                7  |  -.0047628   .0161365    -0.30   0.768    -.0363899    .0268642
                8  |  -.0057845   .0167741    -0.34   0.730     -.038661     .027092
                9  |   .0867646    .042242     2.05   0.040     .0039717    .1695575
               10  |   .0193193   .0139812     1.38   0.167    -.0080834     .046722
                   |
        LVPexp_cat |
                2  |   .0004767   .0091958     0.05   0.959    -.0175467    .0185001
                3  |  -.0051734    .011059    -0.47   0.640    -.0268487    .0165019
                   |
          week_num |  -.0001071    .000022    -4.87   0.000    -.0001501    -.000064
             _cons |   2.464422   .4999659     4.93   0.000     1.484507    3.444337
    --------------------------------------------------------------------------------
    
    
                        Postintervention Linear Trend: 78
    
    Treated: _b[_t]+_b[_x_t78]
    ------------------------------------------------------------------------------
    Linear Trend |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         Treated |   .0008281   .0002052     4.04   0.000     .0004259    .0012302
    ------------------------------------------------------------------------------

  • #2
    To save the regression results to Word, you can use the -etable- command with its -export()- option.

    There is no single command I am aware of to save a graph to Word. You can -graph export- the graph to a format that Word can read: I usually use .png for this. Then you can bring that file into Word with Insert Picture in Word.

    Comment


    • #3
      Clyde Schechter Thanks, Clyde. The -etable- command only lets me export the variables from the main table, not the "Treated" variable from the "Postintervention Linear Trend" bit at the end. How can I get that too?

      Comment


      • #4
        I don't know. That's a question for somebody who is got at working with the -collect- commands. I hope one of them is following along and will respond.

        Comment

        Working...
        X