본문 바로가기
카테고리 없음

[stata] 회귀분석 결과 보기 좋게 출력하기 (보고서용) : estout

2017. 5. 3.

먼저 아래 유저 written 프로그램을 설치해야 한다.


ssc install estout

를 입력하면 estout 패밀리들이 설치된다.

estout, esttab, eststo, estadd 와 같은 명령어가 새로 생기는데

주로 쓰는건 회귀분석 결과를 저장하는 eststo와

저장된 결과를 출력하는 esttab이다.

별표도 붙여준다. 워드파일로 예쁘게 저장도 되기 때문에 보고서용으로 좋다.



사용예

eststo clear  /*이전꺼 지우기*/
eststo: quietly regress rate price if rate>0 & price>10000   /*모델1*/
eststo: quietly regress rate lnprice if rate>0 & price>10000
eststo: quietly regress rate lnprice prate if rate>0 & prate>-.5 & price>10000
eststo: quietly regress rate lnprice prate metro if rate>0 & prate>-.5 & price>10000
eststo: quietly regress rate prate metro  P2_ P3_ P4_ P5_ P7_5_  if rate>0 & prate>-.5 & price>10000  /*모델 5*/
esttab                    , ar2(%6.5f) sca(F) p r         /*화면에 출력,  ar2는 adjsted R-squared, sca(F)는 F값 출력, p는 p값 출력
esttab using example.rtf , ar2(%6.5f) sca(F) p r     /* 워드파일로 저장하기. r은 replace(overwrite existing file)


워드로는 이런식으로 나옴(형태는 커스터마이즈 가능)



사용방법으로는 회귀분석을 일단 하나씩 하면서 저장하는 방법도 있다.




. eststo clear

. reg kids edu

      Source |       SS       df       MS              Number of obs =    1129
-------------+------------------------------           F(  1,  1127) =   59.00
       Model |  153.504333     1  153.504333           Prob > F      =  0.0000
    Residual |  2932.00497  1127  2.60160157           R-squared     =  0.0498
-------------+------------------------------           Adj R-squared =  0.0489
       Total |   3085.5093  1128  2.73538059           Root MSE      =  1.6129

------------------------------------------------------------------------------
        kids |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        educ |  -.1397214   .0181896    -7.68   0.000    -.1754107   -.1040321
       _cons |   4.516323   .2357803    19.15   0.000     4.053705     4.97894
------------------------------------------------------------------------------

. eststo
(est1 stored)

. reg kids edu meduc

      Source |       SS       df       MS              Number of obs =    1129
-------------+------------------------------           F(  2,  1126) =   30.25
       Model |  157.317967     2  78.6589833           Prob > F      =  0.0000
    Residual |  2928.19133  1126  2.60052516           R-squared     =  0.0510
-------------+------------------------------           Adj R-squared =  0.0493
       Total |   3085.5093  1128  2.73538059           Root MSE      =  1.6126

------------------------------------------------------------------------------
        kids |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        educ |  -.1280873   .0205675    -6.23   0.000    -.1684422   -.0877324
       meduc |  -.0163706   .0135184    -1.21   0.226    -.0428948    .0101535
       _cons |   4.518172   .2357364    19.17   0.000      4.05564    4.980705
------------------------------------------------------------------------------

. eststo
(est2 stored)

. esttab

--------------------------------------------
                      (1)             (2)  
                     kids            kids  
--------------------------------------------
educ               -0.140***       -0.128***
                  (-7.68)         (-6.23)  

meduc                             -0.0164  
                                  (-1.21)  

_cons               4.516***        4.518***
                  (19.15)         (19.17)  
--------------------------------------------
N                    1129            1129  
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

. esttab , not

--------------------------------------------
                      (1)             (2)  
                     kids            kids  
--------------------------------------------
educ               -0.140***       -0.128***
meduc                             -0.0164  
_cons               4.516***        4.518***
--------------------------------------------
N                    1129            1129  
--------------------------------------------
* p<0.05, ** p<0.01, *** p<0.001

.






댓글