Dear Raifu,
I am enclosing some code that shows how Clarify can be used to generate
out-of-sample predictions. The example involves linear regression, but
you could modify the code to obtain out-of-sample quantities of interest
for any model that Clarify supports. The first half of the code below
creates some datasets. After that, there are four key steps:
(1) run estsimp, (2) drop the dependent and independent variables, but
keep the simulated parameter values; (3) merge-in the new dataset; (4)
run setx and simqi as you would normally run them in Clarify.
Hope this is helpful. Thanks for your interest in Clarify.
Michael Tomz
Stanford Univ.
------------------ sample code -----------------
version 9
tempfile ds1 ds2
* create first dataset, to be used
* to estimate parameter values
clear
set obs 1000
gen x = uniform()
gen y = 1 + 2*x + invnorm(uniform())
save `ds1'
* create second dataset, to be used
* for out-of-sample analysis
clear
set obs 1000
gen x = uniform()
gen y = 1 + 2*x + invnorm(uniform())
save `ds2'
* load and analyze first dataset
use `ds1', clear
estsimp regress y x
* drop variables from first dataset,
* load variables from second dataset
drop y x
merge using `ds2'
* get expected values, conditional on
* parameter estimates from the first
* dataset and x's from the second dataset
setx mean
simqi
Durodoye, Raifu wrote on 4/29/2009 2:37 PM:
How do you use a regression equation generated from
one independent set
of data to create predicted probabilities for another independent set of
data with the same variables? Essentially I would like to “save” the
regression equation from my first dataset to predict for another dataset
from a different year. Is this possible? Please excuse me if this
information is on the website but I have been having difficulty while
attempting to execute this particular task.
Thank you for your help
Raifu Durodoye Jr.
--
Clarify mailing list served by Harvard-MIT Data Center
[Un]Subscribe/View Archive:
http://lists.gking.harvard.edu/?info=clarify