-- ANN FITZMAURICE wrote
> i know that i can use the following
>
> Use data1 , clear
> Poisson y x
> Predict file1_m, ir
> Use data 2, clear
> Predict file2_m , ir
>
> My question relates to the use of the command
> xi, in the regression the command is
> xi:poisson var1 i.var2 i.var3 var4 etc.
>
> but when i try to apply the results from file 1
> to file 2 , i get an error message
The reason you get an error is that -xi- creates
new variables, and these variables are used in
your estimation command, but they are not created
in you second file. So what you need to do is to
make the same variables in data2, like in the
example below.
*------------- begin example -------------
sysuse auto, clear
recode rep78 1/2=3
/* create two files */
gen select = uniform() < .5
tempfile data1 data2
preserve
keep if select == 0
save `data1'
restore
keep if select == 1
save `data2'
/* Estimation */
use `data1', clear
xi i.rep78 /*create dummies*/
reg mpg length _I*
/* Prediction */
use `data2', clear
xi i.rep78 /*create dummies*/
predict xb, xb
*-------------- end example --------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )
Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* 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/