Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: apply predict to a different dataset

From   David Kantor <>
To   Statalist <>
Subject   st: apply predict to a different dataset
Date   Thu, 16 Aug 2012 17:17:48 -0400

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.

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index