I am trying to get the same results as https://otexts.com/fpp2/transformations.html, Figure 3.4: Forecasts of egg prices using a random walk with drift applied to the logged data.
The back-transformed point forecast, considered the median of the forecast density, of the forecast distribution is simply achieved exp'ing the logged transformed data exp(lrfore), i.e. Simple back transformation.
- Code: Select all
set leggs = log(eggs)
boxjenk(print,constant,ar=0,diffs=1,ma=0,define=eq) leggs 1900 1993
uforecast(equation=eq,from=1993+1,steps=50,stderrs=lstderrs) lrfore
set lL80 1993+1 1993+50 = lrfore+%invnormal(.1)*lstderrs
set lU80 1993+1 1993+50 = lrfore+%invnormal(.9)*lstderrs
set rfore 1993+1 1993+50 = exp(lrfore); * I can EXP(MEAN) i.e. considered the MEDIAN in the original scale
But, I cannot simply exp the transformed PI's: exp(lL80) and exp(lU80), to get back to the original scale - Figure 3.4 's PI's are slightly wider, than simply exp'ing the PI's.
From https://otexts.com/fpp2/prediction-intervals.html , "If a transformation has been used, then the prediction interval should be computed on the transformed scale, and the end points back-transformed to give a prediction interval on the original scale."
How do I calculate
(a) the back-transformed PI's, assuming positive bounds?
Also,
(b) the back-transformed bias-adjusted mean point forecasts - similar to this, but this is not correct?
- Code: Select all
set fvar 1993+1 1993+50 = ((%BoxCox(lU80,0) - %BoxCox(lL80,0))/1.28/2)**2
set biasadj_mean 1993+1 1993+50 = exp(lrfore) * (1 + 0.5*fvar)
thanks,
Amarjit