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   "Michael Blasnik" <>
To   <>
Subject   Re: st: -predict- in a system of equations
Date   Fri, 21 May 2004 19:14:22 -0400

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

----- Original Message ----- 
From: "R.E. De Hoyos" <>
To: <>
Sent: Friday, May 21, 2004 4:18 PM
Subject: Re: st: -predict- in a system of equations

> 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"
> 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
> in a macro.
> Prof. Stephen Jenkins suggested -estsave-, thanks for that. The
> command -estsave- will save all the estimation results into a new
> however it is not helpful when you change to another dataset (the
> results get lost when a new dataset is used).
> Any suggestions?
> I appreciate your help,
> Rafa
> ______________________________

*   For searches and help try:

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