Announcement

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

  • Addstats at the bottom of the table


    Dear all,

    I want to make a table of regression output like this: .(see the pic)

    But I want to add three rows at the bottom for coefficients, std error and p value for weight instead of r2, bic and N.

    How to do that?

    Thanks!
    Attached Files
    Last edited by Lars Pete; 28 Mar 2021, 00:23.

  • #2
    estout is from the Stata Journal/ SSC, as you are asked to explain (FAQ Advice #12).

    But I want to add three rows at the bottom for coefficients, std error and p value for weight instead of r2, bic and N.
    There is a structure to these tables, where coefficients and standard errors are separated from the statistics. This therefore is as an unusual request.

    Code:
    sysuse auto, clear
    eststo m1: regress price weight c.mpg##i.foreign
    estadd local b_weight= `:di %5.3f _b[weight]'
    estadd local se_weight= `:di %5.3f _se[weight]'
    estadd local p_weight=  cond(r(table)["pvalue","weight"] < 0.001, 99999, `:di %5.3f r(table)["pvalue","weight"]')
    estout, drop(weight) stats(b_weight se_weight p_weight) substitute("99999" "<0.001") nobaselevels
    Res.:

    Code:
    . estout, drop(weight) stats(b_weight se_weight p_weight) substitute("99999" "<0.001") nobaselevels
    
    -------------------------
                           m1
                            b
    -------------------------
    mpg              263.1875
    1.foreign        11240.33
    1.foreign#~g    -307.2166
    _cons           -14449.58
    -------------------------
    b_weight            4.614
    se_weight            .725
    p_weight            <0.001
    -------------------------
    where

    Code:
    . eststo m1: regress price weight c.mpg##i.foreign
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(4, 69)        =     21.22
           Model |   350319665         4  87579916.3   Prob > F        =    0.0000
        Residual |   284745731        69  4126749.72   R-squared       =    0.5516
    -------------+----------------------------------   Adj R-squared   =    0.5256
           Total |   635065396        73  8699525.97   Root MSE        =    2031.4
    
    -------------------------------------------------------------------------------
            price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    --------------+----------------------------------------------------------------
           weight |   4.613589   .7254961     6.36   0.000     3.166263    6.060914
              mpg |   263.1875   110.7961     2.38   0.020     42.15527    484.2197
                  |
          foreign |
         Foreign  |   11240.33   2751.681     4.08   0.000     5750.878    16729.78
                  |
    foreign#c.mpg |
         Foreign  |  -307.2166   108.5307    -2.83   0.006    -523.7294   -90.70368
                  |
            _cons |  -14449.58    4425.72    -3.26   0.002    -23278.65    -5620.51
    -------------------------------------------------------------------------------

    Comment


    • #3
      Thank you Andrew!

      Comment

      Working...
      X