Announcement

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

  • #16
    Thanks for all this! And thanks for asking my goals. Although there might be other use cases, what I want are publishable tables that put the coefficients on a different and more interpretable scale. So this works:
    Code:
    sysuse auto, clear
    regress mpg gear_ratio
    esttab , se transform(@*.425 .425)
    But the transform(@*.425 .425) option is not transparent and not documented in help esttab. It is documented in help estout, but even there it would take some study to figure out that you need to say transform(@*.425 .425) and not something simpler.

    I just noticed that there is an equivalent example in help outreg2, whose syntax is simpler in this case:
    Code:
      
        sysuse auto, clear
        reg mpg gear_ratio
        outreg2 using myfile, replace
        outreg2 using myfile, stats(coef se) stnum(replace coef=coef*.425, replace se=se*.425)

    Comment


    • #17
      daniel klein : After your most recent version of program define multiply_coefficients_by
      is there a way to export a publishable table with the transformed results?

      Comment


      • #18
        My final version has a bug!

        The covariance matrix must be multiplied by

        Code:
        `multiplier'^2
        I have omitted the power.


        That said, here is a quick and dirty example using Stata's collect

        Code:
        . sysuse auto, clear
        (1978 automobile data)
        
        . 
        . collect clear
        
        . regress mpg gear_ratio
        
              Source |       SS           df       MS      Number of obs   =        74
        -------------+----------------------------------   F(1, 72)        =     44.07
               Model |  927.719285         1  927.719285   Prob > F        =    0.0000
            Residual |  1515.74017        72  21.0519469   R-squared       =    0.3797
        -------------+----------------------------------   Adj R-squared   =    0.3711
               Total |  2443.45946        73  33.4720474   Root MSE        =    4.5882
        
        ------------------------------------------------------------------------------
                 mpg | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
          gear_ratio |   7.812835   1.176919     6.64   0.000     5.466691    10.15898
               _cons |  -2.257346   3.588115    -0.63   0.531    -9.410123    4.895432
        ------------------------------------------------------------------------------
        
        . multiply_coefficients_by .425
        ------------------------------------------------------------------------------
                 mpg | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
          gear_ratio |   3.320455   .5001905     6.64   0.000     2.323343    4.317567
               _cons |  -.9593719   1.524949    -0.63   0.531    -3.999302    2.080559
        ------------------------------------------------------------------------------
        Note: coefficients and standard errors rescaled by .425     
        
        . collect get r(table_rescaled): multiply_coefficients_by .425
        ------------------------------------------------------------------------------
                 mpg | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
          gear_ratio |   3.320455   .5001905     6.64   0.000     2.323343    4.317567
               _cons |  -.9593719   1.524949    -0.63   0.531    -3.999302    2.080559
        ------------------------------------------------------------------------------
        Note: coefficients and standard errors rescaled by .425     
        
        . collect layout (colname) (rowname) (result)
        
        Collection: default
              Rows: colname
           Columns: rowname
            Tables: result
           Table 1: 2 x 9
        
        ---------------------------------------------------------------------------------------
                   |         b       se         t   pvalue        ll       ul df     crit eform
        -----------+---------------------------------------------------------------------------
        Gear ratio |  3.320455 .5001905  6.638381 5.10e-09  2.323343 4.317567 72 1.993464     0
        Intercept  | -.9593719 1.524949 -.6291173 .5312633 -3.999302 2.080559 72 1.993464     0
        ---------------------------------------------------------------------------------------
        I have not played around a lot with this so I cannot quickly come up with a more complete approach. I currently also lack the time to dive into community-contributed commands.

        Generally speaking, the results are there; they are just not in the place in which most of the table-generating commands expect them to be. Here is a wrapper to change that:

        Code:
        program make_the_table , eclass
            
            tempname e_results
            
            _estimates hold `e_results' , copy restore
            
            tempname b V
            
            matrix `b' = e(b_rescaled)
            matrix `V' = e(V_rescaled)
            
            ereturn repost b = `b' V = `V'
            
            `0'
            
        end
        Here is a demo

        Code:
        . sysuse auto, clear
        (1978 automobile data)
        
        . 
        . regress mpg gear_ratio
        
              Source |       SS           df       MS      Number of obs   =        74
        -------------+----------------------------------   F(1, 72)        =     44.07
               Model |  927.719285         1  927.719285   Prob > F        =    0.0000
            Residual |  1515.74017        72  21.0519469   R-squared       =    0.3797
        -------------+----------------------------------   Adj R-squared   =    0.3711
               Total |  2443.45946        73  33.4720474   Root MSE        =    4.5882
        
        ------------------------------------------------------------------------------
                 mpg | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
          gear_ratio |   7.812835   1.176919     6.64   0.000     5.466691    10.15898
               _cons |  -2.257346   3.588115    -0.63   0.531    -9.410123    4.895432
        ------------------------------------------------------------------------------
        
        . multiply_coefficients_by .425
        ------------------------------------------------------------------------------
                 mpg | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
          gear_ratio |   3.320455   .5001905     6.64   0.000     2.323343    4.317567
               _cons |  -.9593719   1.524949    -0.63   0.531    -3.999302    2.080559
        ------------------------------------------------------------------------------
        Note: coefficients and standard errors rescaled by .425     
        
        . make_the_table esttab
        
        ----------------------------
                              (1)   
                              mpg   
        ----------------------------
        gear_ratio          3.320***
                           (6.64)   
        
        _cons              -0.959   
                          (-0.63)   
        ----------------------------
        N                      74   
        ----------------------------
        t statistics in parentheses
        * p<0.05, ** p<0.01, *** p<0.001
        Results in e() remain unchanged after the wapper has finished.

        Comment

        Working...
        X