Announcement

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

  • How to store the beta/standardized coefficients after a regression

    Is there a way to store the beta/standardized coefficients after a regression?

    For example, how can I store the standardized coefficient of mpg to a local macro, which is -.1702392, for further use?

    Code:
    cls
    clear all
    webuse "auto.dta", clear
    
    regress price mpg weight length, beta
    
    
    // the results
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(3, 70)        =     12.98
           Model |   226957412         3  75652470.6   Prob > F        =    0.0000
        Residual |   408107984        70  5830114.06   R-squared       =    0.3574
    -------------+----------------------------------   Adj R-squared   =    0.3298
           Total |   635065396        73  8699525.97   Root MSE        =    2414.6
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      t    P>|t|                     Beta
    -------------+----------------------------------------------------------------
             mpg |  -86.78928   83.94335    -1.03   0.305                -.1702392
          weight |   4.364798   1.167455     3.74   0.000                 1.150126
          length |  -104.8682   39.72154    -2.64   0.010                 -.791671
           _cons |   14542.43   5890.632     2.47   0.016                        .
    ------------------------------------------------------------------------------

  • #2
    Code:
    ssc install esttab
    Code:
    sysuse auto, clear
    regress price mpg weight length, beta
    qui esttab, beta
    mat l e(beta)
    Res.:

    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . regress price mpg weight length, beta
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(3, 70)        =     12.98
           Model |   226957412         3  75652470.6   Prob > F        =    0.0000
        Residual |   408107984        70  5830114.06   R-squared       =    0.3574
    -------------+----------------------------------   Adj R-squared   =    0.3298
           Total |   635065396        73  8699525.97   Root MSE        =    2414.6
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      t    P>|t|                     Beta
    -------------+----------------------------------------------------------------
             mpg |  -86.78928   83.94335    -1.03   0.305                -.1702392
          weight |   4.364798   1.167455     3.74   0.000                 1.150126
          length |  -104.8682   39.72154    -2.64   0.010                 -.791671
           _cons |   14542.43   5890.632     2.47   0.016                        .
    ------------------------------------------------------------------------------
    
    . qui esttab, beta
    
    . mat l e(beta)
    
    e(beta)[1,4]
               mpg      weight      length       _cons
    y1  -.17023915   1.1501263    -.791671          .z

    Comment


    • #3
      Problem solved, thanks Andrew!

      Comment

      Working...
      X