Announcement

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

  • Formatting of regression table

    Hi. My code below produces the table below. I'd like the three columns of Covid positive rate, Covid recovery rate, and Covid fatality rate. Instead of appending each regression to duplicate the rows, I'd like only one row each of SO_PositiveTriage, SO_HomeIso, SO_MentalHealth, tested, and intercept. I'd appreciate any help on how to format this.

    Code:
    use "${coeffdir}\coefficients_two.dta", clear
    
    
    *covid positive
    reg b_confirmed_2_b i.so_positivetriage i.so_homeiso i.so_mentalhealth tested, absorb(weeknum)
    estimates store positive
    
    *covid recovery
    reg b_recovered_2_b i.so_positivetriage i.so_homeiso i.so_mentalhealth, absorb(weeknum)
    estimates store recovery
    
    *covid fatality
    reg b_deceased_2_b i.so_positivetriage i.so_homeiso i.so_mentalhealth tested, absorb(weeknum)
    estimates store fatality
    
                
    etable, estimates(positive recovery fatality) showstars showstarsnote title("Heterogeneity analysis") export(mydoc.docx, replace)
    
    
    Heterogeneity analysis
    ---------------------------------------------------------------------
                           b_confirmed_2_b b_recovered_2_b b_deceased_2_b
    ---------------------------------------------------------------------
    SO_PositiveTriage                                                    
      1                         0.233 **                                 
                              (0.024)                                    
    SO_HomeIso                                                           
      1                        -0.151 **                                 
                              (0.022)                                    
    SO_MentalHealth                                                      
      1                        -0.012                                    
                              (0.012)                                    
    tested                     -0.002 **                                 
                              (0.001)                                    
    Intercept                   0.050 **                                 
                              (0.005)                                    
    SO_PositiveTriage                                                    
      1                                         0.184 **                 
                                              (0.021)                    
    SO_HomeIso                                                           
      1                                        -0.140 **                 
                                              (0.019)                    
    SO_MentalHealth                                                      
      1                                        -0.003                    
                                              (0.010)                    
    Intercept                                   0.027 **                 
                                              (0.003)                    
    SO_PositiveTriage                                                    
      1                                                        0.005 **  
                                                             (0.001)     
    SO_HomeIso                                                           
      1                                                       -0.003 **  
                                                             (0.001)     
    SO_MentalHealth                                                      
      1                                                       -0.001 **  
                                                             (0.000)     
    tested                                                    -0.000     
                                                             (0.000)     
    Intercept                                                  0.002 **  
                                                             (0.000)     
    Number of observations       3239            3239           3239     
    ---------------------------------------------------------------------

  • #2
    Try adding this line after calling etable:

    Code:
    collect layout (colname#result[_r_b _r_se] result[N]) (etable_depvar#stars) (), name(ETable)

    Comment


    • #3
      Hemanshu Kumar Thank you. That worked perfectly!

      Comment


      • #4
        Hemanshu Kumar The code line appears to work only for displaying the results in stata, not on the output word document. Is there anyway the the document can reflect this?

        Comment


        • #5
          You should be able to see the same results in the docx file if you eliminate the export() option from your collect command above, and add a collect export command after the collect layout line I suggested.

          Comment

          Working...
          X