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   Ada Ma <[email protected]>
To   [email protected]
Subject   Re: st: -predict- in a system of equations
Date   Fri, 21 May 2004 20:08:36 +0100

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/



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