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 <>
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!


R.E. De Hoyos wrote:


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?



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:

Ada Ma
Research Assistant
Department of Economics
University of Aberdeen Business School
Edward Wright Building F55
Tel:   +44 1224 273417
Fax:   +44 1224 272181

*   For searches and help try:

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