본문 바로가기

방법론 공부/계량통계 방법론

[STATA] 데이터를 쉽게 표로 만들기 - esttab, estout, eststo, estadd, estpost

esttab - Display formatted regression table

        . estpost tabstat price mpg rep78, by(foreign) statistics(mean sd) columns(statistics) listwise


             foreign |   e(mean)      e(sd)
        -------------+----------------------
        Domestic   |                      
                price |   6179.25   3188.969
                mpg |  19.54167   4.753312
               rep78 |  3.020833    .837666
        -------------+----------------------
        Foreign     |                      
               price |  6070.143   2220.984
               mpg |  25.28571   6.309856
              rep78 |  4.285714   .7171372
        -------------+----------------------
        Total        |                      
               price |  6146.043    2912.44
               mpg |  21.28986   5.866408
              rep78 |  3.405797   .9899323

        . esttab ., main(mean) aux(sd) nostar unstack noobs nonote label

        -----------------------------------------------------------

                                 Domestic      Foreign        Total

        -----------------------------------------------------------

        Price                     6179.3       6070.1       6146.0

                                 (3189.0)     (2221.0)     (2912.4)


        Mileage (mpg)           19.54        25.29        21.29

                                  (4.753)      (6.310)      (5.866)


        Repair Record 1978     3.021        4.286        3.406

                                  (0.838)      (0.717)      (0.990)

        -----------------------------------------------------------



estout - Making regression tables from stored estimates

        . quietly regress price weight mpg

        . estimates store m1, title(Model 1)

        . generate forXmpg = foreign * mpg

        . quietly regress price weight mpg forXmpg foreign

        . estimates store m2, title(Model 2)

        . estout m1 m2


. estout *, cells(b se)


. estout m2, cells("b se t p")



eststo - Store estimates

        . eststo: quietly regress price weight mpg

        (est1 stored) 

        . eststo: quietly regress price weight mpg foreign

        (est2 stored)

        . esttab, ar2



estadd - Add results to (stored) estimates

        . quietly logit foreign price mpg     

        . estadd summ, mean sd

        . estout, cells("mean sd") drop(_cons)



estpost - Post results from various commands in e()

        . estpost summarize price mpg rep78 foreign


                     |  e(count)   e(sum_w)    e(mean)     e(Var)      e(sd)

        -------------+-------------------------------------------

               price |        74         74   6165.257    8699526   2949.496

               mpg |        74         74    21.2973   33.47205   5.785503

              rep78 |        69         69   3.405797   .9799659   .9899323

             foreign |        74         74   .2972973   .2117734   .4601885


        . esttab ., cells("mean sd count") noob    

        ---------------------------------------------------     

                             mean           sd        count

        ---------------------------------------------------

        price            6165.257     2949.496           74

        mpg               21.2973     5.785503           74

        rep78            3.405797     .9899323           69

        foreign          .2972973     .4601885           74

        ---------------------------------------------------


        . estpost tabstat price mpg rep78, listwise statistics(mean sd)

                     |  e(price)     e(mpg)   e(rep78)

        -------------+---------------------------------

              mean |  6146.043   21.28986   3.405797

                  sd |   2912.44   5.866408   .9899323