Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

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


From   "R.E. De Hoyos" <[email protected]>
To   <[email protected]>
Subject   Re: st: -predict- in a system of equations
Date   Fri, 21 May 2004 21:18:26 +0100

Ada,

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
______________________________
R.E. De Hoyos
Department of Applied Economics
University of Cambridge
Cambridge, CB3 9DE, UK
Tel: +44 1223 335269




----- Original Message -----
From: "Ada Ma" <[email protected]>
To: <[email protected]>
Sent: Friday, May 21, 2004 8:08 PM
Subject: Re: st: -predict- in a system of equations


> Here's a clumsy way of doing it.  It might not be overly useful for you if
> you're NOT dealing with dummy variables.  I was estimating equations with
98
> dummy variables for Counties, which are the only coefficients I wanted to
save.
>
> So I did a little loop:
> (the varnames generated are _ICounty_2 to _ICounty_99)
>
> forvalues i = 2/99 {
> gen coeff`i'=_b[ _ICounty_`i']*_ICounty_`i' if _ICounty_`i'==1
> replace coeff`i'=. if _ICounty_`i'==0
> }
>
> egen coeff=rmean(coeff2-coeff99)
> drop coeff2-coeff99
>
> collapse coeff, by(County)
>
> save coeff.dta, replace
>
>
> I really hope that someone will jump out and tell me that there's a
smarter way
> of doing it.  That would make my week!
>
> Ada
>
>
>
> R.E. De Hoyos wrote:
>
> > Hi,
> >
> > As Richard Williams mentioned in the post called "Ten top tricks"
> > the -predict- command allows one to "export" the coefficients of the
last
> > estimation into an alternative dataset and get fitted values for the
> > hypothetical data.
> >
> > However in a system of equations, several vectors with the estimated
> > coefficients [e(b)] are being created and the -predict- command only
access
> > those ones deriving from the latest extimation. Is there a way to get
fitted
> > values in an alternative (or hypothetical) dataset using "imported"
> > coefficients e(b) that were estimated by a system of equations?
> >
> > How can I save the estimated coefficients e(b) of a system of equations
to
> > use them with an alternative dataset?
> >
> > Thanks,
> >
> > Rafa
> >
> > ps. Sorry if you got this twice, but I was having problems sending it.
> > ______________________________
> > R.E. De Hoyos
> > Department of Applied Economics
> > University of Cambridge
> > Cambridge, CB3 9DE, UK
> > Tel: +44 1223 335269
> > *
> > *   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/
> >
>
> --
> Ada Ma
> Research Assistant
> Department of Economics
> University of Aberdeen Business School
> Edward Wright Building F55
> http://www.abdn.ac.uk/economics/
> http://www.abdn.ac.uk/~pec187/firstpage.htm
> Tel:   +44 1224 273417
> Fax:   +44 1224 272181
> Email: [email protected]
>
> *
> *   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index