Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: -eststo- and -estget-: I can't perform tests after clearing memory and reloading data


From   "Ben Jann" <[email protected]>
To   [email protected], [email protected]
Subject   Re: st: -eststo- and -estget-: I can't perform tests after clearing memory and reloading data
Date   Mon, 12 Feb 2007 14:01:07 +0100

First note that -eststo- is designed to store one ore more sets of
estimation results to a file on disk, independently of the current
dataset in memory. That is, -eststo- only stores the estimation
results and, optionally, an id variable, but not the dataset itself.
If you want to  store the estimates and the data together, then use
Michael Blasnik's -estsave- followed by official -save-.

The reason for -test- not working in your example is that the stored
estimates are not made "active" by -estget-. Either use -estimates
restore- to make them active again (see A below) or do not -estimates
store- them in the first place (B).

ben

A:
==

. sysuse auto
. qui regress mpg weight
. estimates store model1
. eststo * using eststodata, id(make) replace
Saving estimates from regress, generating _ests_model1
file eststodata.dta saved
. clear
. sysuse auto
. sort make
. estget using eststodata, id(make)

-------------------------------------------------------
model        | command      depvar       npar  title
-------------+-----------------------------------------
     model1 | regress      mpg             2
-------------------------------------------------------

. estimates restore model1
(results model1 are active now)

. test _b[weight]=.002

( 1)  weight = .002

      F(  1,    72) =  239.15
           Prob > F =    0.0000


B:
==

. sysuse auto
. qui regress mpg weight
. eststo . using eststodata, id(make) replace
Saving estimates from regress, generating _ests__active
file eststodata.dta saved
. clear
. sysuse auto
. sort make
. estget using eststodata, id(make)

-------------------------------------------------------
model        | command      depvar       npar  title
-------------+-----------------------------------------
          . | regress      mpg             2
-------------------------------------------------------

. test _b[weight]=.002

( 1)  weight = .002

      F(  1,    72) =  239.15
           Prob > F =    0.0000



On 2/5/07, John Fulton <[email protected]> wrote:
Hi Statalist.  -eststo- and -estget- are not working the way I
expected.  I expected to be able to -eststo * using eststodata-, then
-clear- (actually, stop running stata altogether until a later time, but
this is the same thing, from the point of view of the saved data), then
-estget using eststodata- using my stored data and the original data set
to run tests.
But a simple post-estimation command (-test-) won't run.
This does work using -estsave-, so clearly I'm not getting something
about -eststo- and -estget- syntax.

Here's the output:
. clear
. sysuse auto
. qui regress mpg weight
. estimates store model1
. eststo * using eststodata, id(make) replace
 Saving estimates from regress, generating _ests_model1
file eststodata.dta saved
.
. clear
. sysuse auto
. sort make
. estget using eststodata, id(make)
-------------------------------------------------------
model        | command      depvar       npar  title
-------------+-----------------------------------------
      model1 | regress      mpg             2
-------------------------------------------------------

. test _b[weight]=.002
last estimates not found
r(301);

end of do-file
r(301);

Thank you, John.

*
*   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/

*
*   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