Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: "RE: estout and test


From   "Jann Ben" <[email protected]>
To   <[email protected]>
Subject   RE: st: "RE: estout and test
Date   Wed, 7 Sep 2005 22:06:16 +0200

JP wrote:
> How can I use eret2 matrix to display the results.
> 
> I've tried the syntax below but things did not work as I expected.
> 
> sysuse auto, clear
> 
> test weight = mpg
> mat tmp = r(F) , r(p) , r(df)
> eret2 matrix tmp = tmp, replace
> 
> estout, cells("tmp")
> 
>         .
>         tmp
> weight  
> mpg     
> _cons   
> 
> estout, stats("tmp")
>         .
>         b
> weight  1.746559
> mpg     -49.51222
> _cons   1946.069
> tmp    

You cannot use matrices to add statistics to the footer 
of the table (the -stats()- section). The solution is to 
save each statistic as a scalar:

 . test weight = mpg
 . eret2 scalar F1 = r(F)
 . eret2 scalar p1 = r(p)
 . eret2 scalar df1 = r(df)
 . estout, stats(F1 p1 df1)

However, matrices can be used to add additional information
to the body of the table (the -cells()- section). In such a 
case it is important that the additional matrix has the same
column names than the e(b)-matrix. Say, for some reason you 
want 1/b in your table. Then type:

 . sysuse auto, clear
 . reg price weight mpg
 . matrix reb = e(b)
 . forv i = 1/`=colsof(reb)' {
   2.  matrix reb[1,`i'] = 1 / reb[1,`i']
   3. } 
 . eret2 matrix reb = reb
 . estout, cells("b reb") sty(fixed)
                                       
                         b         reb
 weight           1.746559     .5725543
 mpg             -49.51222     -.020197
 _cons            1946.069     .0005139

ben

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index