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

RE: st: help log linear


From   Stephen Schmidt <[email protected]>
To   [email protected]
Subject   RE: st: help log linear
Date   Sun, 22 Feb 2004 22:18:02 -0500 (EST)

On Sun, 22 Feb 2004, Vincenzo Verardi wrote:
> 1) run the regression lny=xb
> the I would type the command
> predict lnyhat, xb
> 2) I would then exponentiate my result generating a new variable
> gen ypred=exp(lnyhat)
> I would then have the predicted y.

This is not correct, because the desired quantity is E(y), not
exp(E(logyhat)). Because

  logy = logyhat + err

one can exponentiate both sides to get:

  exp(logy) = exp(logyhat + err)

and can then take expectations:

  E(y) = exp(Elogy)) = E(exp(logyhat + err))

It is not, however, valid to break up the right side as

  E(y) = E(exp(logyhat)) + E(exp(err))

because exp is not a linear function. One needs to integrate
the expected value explicitly. I have a memory, probably
incorrect, that E(y) = exp(logyhat) + 1/2*sigma-squared,
where sigma-squared is the variance of the error term, so
that E(y) is a little higher than exp(logyhat). But that
memory dates back to graduate school and isn't relaible
at this time....

Steve Schmidt


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