# Re: st: -predict- in a system of equations

 From "R.E. De Hoyos" To Subject Re: st: -predict- in a system of equations Date Sat, 22 May 2004 16:06:29 +0100

Michael,

-predict- wont work because several equations are being estimated. Suppose I
estimate -heckman- using data1.dta, then a vector e(b) is created in
which -predict- is based on. Once a second equation is estimated,
e.g. -mlogit- a new vector is created, let's say to e(b') and the old one is
being lost. When I change to data2.dta I want to be able to predict (or
score) using both e(b) and e(b'), therefore I needed a way to save these
vectors, which your suggestion is doing very well.

It would be quite useful to have an option to save all the -predict-
properties (at least temporary) to use them in an alternative dataset.
With -matrix score- I can only form linear combinations of the previously
saved vectors e(b)s and the new Xs, while I might be more interested in the
fitted probabilities (as in the case of limited dependant variables eq.)

Thanks again,

Rafa

----- Original Message -----
From: "Michael Blasnik" <michael.blasnik@verizon.net>
To: <statalist@hsphsun2.harvard.edu>
Sent: Saturday, May 22, 2004 12:14 AM
Subject: Re: st: -predict- in a system of equations

> I'm not exactly sure what you are doing or why -predict- won't work in you
> situation, but if you want to "save" e(b) just use a matrix function:
>
> mat mybeta=e(b)
>
> if you want to save lots of them and have them disappear when your done,
you
> could use tempnames:
>
> tempname beta
> mat `beta'=e(b)
>
> (the assignment could be stuffed in a loop)
>
> You can use these matrices on a new set of data to generate predictions
(at
> least, xb) using matrix score:
>
> matrix score newpredict=`beta'
>
> which will create newpredict equal to xb  using the e(b) matrix from
> efore.  -matrix score- even allows an equation() option to specify which
> equation's beta to use in multi-equation models (which it seems you have).
> I hope this can get you started in the right direction if simpler
approaches
> can't be found...
>
> Michael Blasnik
> michael.blasnik@verizon.net
>
>
>
> ----- Original Message -----
> From: "R.E. De Hoyos" <redeho2@hotmail.com>
> To: <statalist@hsphsun2.harvard.edu>
> Sent: Friday, May 21, 2004 4:18 PM
> Subject: Re: st: -predict- in a system of equations
>
>
> >
> > Thanks for your answer. Perhaps I didn't explain myself clear.
> >
> > What I am looking for is a way of saving the vector e(b) for future
> > estimations using an alternative dataset. What I am running is a system
of
> > labour market equations for time "t":
> >
> > heckman(t) \\wages
> > mlogit(t)  \\labour_supply
> >
> > With these system I am able to -predict- earnings for time "t" for the
> > different occupations in the mlogit.
> >
> > What I want to do is to -predict- hypothetical earnings for time "t+1"
> using
> > real data for "t+1" combined with estimated betas from time "t".
> >
> > As you suggest, I can use -foreach- loop where instead of creating
> > variables--as in your loop--I create local macros containing the values
of
> > the different betas after each estimation. However it becomes
complicated
> > when you have several equations in the system, and I cannot save vector
> e(b)
> > in a macro.
> >
> > Prof. Stephen Jenkins suggested -estsave-, thanks for that. The
> > command -estsave- will save all the estimation results into a new
> variable,
> > however it is not helpful when you change to another dataset (the
> estimation
> > results get lost when a new dataset is used).
> >
> > Any suggestions?
> >
> > I appreciate your help,
> >
> > Rafa
> > ______________________________
>
>
> *
> *   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/