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

st: "RE: estout and test


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

JP writes:
> I'm trying to use estout to format the coefficients of 
> several regressions
> as well as the result of an F test that I'm implementing on 
> each of of these
> models. I've been trying to use eret2 to store the pvalues of 
> my F test, ...
...
> it does not produce the desired effects when I'm trying to store the
> results of multiple models through the command estimates store
> (Example 2).
...
> ********************* Example 2 *********************
> 
> sysuse auto, clear
> 
> regress price weight mpg
> estimates store m1
> test weight = mpg
> eret2 scalar p_wtmpg = r(p)
> 
> regress price weight mpg length turn
> estimates store m2
> test weight = mpg = length = turn
> eret2 scalar p_wtmpg = r(p)
> 
> estout m*, stats(N r2 r2_a p_wtmpg) style(fixed)

-eret2- adds stuff to the "active" estimates. However, the
"active" estimates have nothing to do with the "stored" 
estimates. Active and stored estimates are two distinct
sets of e()-returns in Stata.

Thus, if you are working with stored estimates and you want 
to use -eret2-, always store the estimates AFTER applying
-eret2-. Otherwise, the added statistics will not be part 
of the stored estimates and cannot be tabulated by -estout-.

That is, JP's code should be as follows:

 . regress price weight mpg
 . test weight = mpg
 . eret2 scalar p_wtmpg = r(p)
 . estimates store m1
 
 . regress price weight mpg length turn
 . test weight = mpg = length = turn
 . eret2 scalar p_wtmpg = r(p)
 . estimates store m2
 
 . estout m*, stats(N r2 r2_a p_wtmpg) style(fixed)

An alternative is to write a routine for -estadd-, that 
conducts the F test. Other than -eret2-, -estadd- can
deal with estimates that have already been stored. See

 . ssc describe estadd 

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