Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: apply predict to a different dataset


From   "Sarah Edgington" <[email protected]>
To   <[email protected]>
Subject   st: RE: apply predict to a different dataset
Date   Fri, 17 Aug 2012 10:45:22 -0700

David,
Look at -help estimates-
You can either store estimates in memory for later use in the same session,
or save them so they can be loaded for use later.
-Sarah

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of David Kantor
Sent: Thursday, August 16, 2012 2:18 PM
To: Statalist
Subject: st: apply predict to a different dataset

Hi.
This may be a routing matter, but I am attempting this for the first time.
I use Stata 10.

I have two datasets with some of the same variables.
I want to -regress- on the first dataset, then apply the coefficients to run
-predict- on the second dataset.

I am thinking that the thing to do is...

use set1
regress v1 v2 v3 v4
_return hold somename

use set2
_return restore somename, hold
predict newvar

----

Is this the right approach?
I also wonder whether the -_return- operations are necessary. I note that
when I -use- a dataset, the coefficients from the earlier
-regress- are still around.
But I also wonder if the regress coefficients can be stored in a file that I
can reload at a later time -- and then I could proceed to do a -predict-.
Note that my actual task is to apply the -predict- to a multitude of
additional datasets.

Thanks if anyone can help with this.
--David

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index