Forecast from a NLLS regression

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
timduy
Posts: 50
Joined: Sun Jan 15, 2012 12:24 am

Forecast from a NLLS regression

Unread post by timduy »

I run this code:

Code: Select all

nonlin b0 b1
frml etrend = b0*exp(b1*trend)
nlls(frml=etrend) ces7072200001 startdate enddate resids3
and I would like to forecast ces7072200001. How do I convert the results of NLLS to an equation that I can use with FORECAST?

I know I can redefine the regression as:

Code: Select all

linreg log(ces7072200001) startdate enddate resids3
#constant trend
and then convert back to the level, but I am trying to illustrate the forecast bias created by that conversion as in:

https://davegiles.blogspot.com/2013/08/ ... sions.html
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Forecast from a NLLS regression

Unread post by TomDoan »

Actually, the NLLS FRML would (theoretically) give the correct minimum mean square forecasts for the level IF (and that's a big if) the errors were assumed to be homoscedastic in that model. The bias discussed in the blog comes about because if you assume instead that the residuals are homoscedastic in

(*) log(y) = a+bx+u

then forecasting y by exp(a+bx) does not give the minimum mean square error forecasts for y as a positive u will have a larger effect on y then an equally negative u. The bias correction can be done by scaling up by exp(%seesq/2):

set logy = log(ces7072200001)
linreg(frml=logfrml) y startdate enddate resids3
#constant trend
set yhat = exp(logfrml)*exp(%seesq/2)

Note, by the way, that if (*) with homoscedastic u is the correct model, you would expect that if you estimate it in the exponential form y=exp(a+bx), the a in that would be roughly a in the log-linear regression + log(%seesq/2)---it should give a consistent, but not efficient estimate of the same function.
timduy
Posts: 50
Joined: Sun Jan 15, 2012 12:24 am

Re: Forecast from a NLLS regression

Unread post by timduy »

Yes, that is easier way to illustrate. Thank you.
Post Reply