I'm puzzled. Attached is an example, g10xrate.xls with 3 graphs:
(1) LOG-RETURNS: forecasts and Prediction Intervals - the forecasts are correct, the prediction intervals are calculated using the formula from mwh3p366.rpf.
(2) LEVELS: forecasts - forecasts are correct and calculated from LOG-RETURNS.
(3) LEVELS: forecasts and Prediction Intervals - I am unclear as to the formula for the prediction intervals.
- Code: Select all
*===============================
* read in data
OPEN DATA "/Users/Shared/RATS/Examples/g10xrate.xls"
DATA(FORMAT=XLS,NOLABELS,ORG=COLUMNS,TOP=2) 1 6237 USXJPN USXFRA USXSUI USXNLD USXUK $
USXBEL USXGER USXSWE USXCAN USXITA
*
* transform data into log form
log USXJPN / lUSXJPN
*
* compute diff-log, approx. % percentage change
set dlUSXJPN = 100.0*( lUSXJPN - lUSXJPN{1} )
*
*
*===============================
linreg(define=fxeq) dlUSXJPN 6000 6237
# constant dlUSXJPN{1 to 10}
uforecast(equation=fxeq,stderrs=stderrs) dl_fxfore 6238 6248
*
*
* (1) graph LOG-RETURNS: forecasts and Prediction Intervals
*
set lower95 6238 6248 = dl_fxfore+%invnormal(.025)*stderrs
set upper95 6238 6248 = dl_fxfore+%invnormal(.975)*stderrs
prin 6200 6248 dlUSXJPN dl_fxfore stderrs lower95 upper95
*
graph(footer="LOG-RETURNS: forecasts and Prediction Intervals",ovcount=2,overlay=fan,ovsame) 4
# dlUSXJPN 6200 6237
# dl_fxfore 6238 6248
# lower95 6238 6248
# upper95 6238 6248
*
*
* (2) graph LEVELS: forecasts
*
set level_fxfore 6238 6248 = exp(dl_fxfore)*USXJPN(6237)
prin 6200 6248 USXJPN dl_fxfore level_fxfore
*
graph(footer="LEVELS: forecasts") 2
# USXJPN 6000 6237
# level_fxfore 6238 6248
*
*
* (3) graph LEVELS: forecasts and Prediction Intervals
*
set level_lower95 6238 6259 = exp(level_fxfore+%invnormal(.025)*(stderrs))*USXJPN(6237)
set level_upper95 6238 6259 = exp(level_fxfore+%invnormal(.975)*(stderrs))*USXJPN(6237)
prin 6200 6248 USXJPN dl_fxfore level_fxfore level_lower95 level_upper95
*
graph(footer="LEVELS: forecasts and Prediction Intervals",ovcount=2,overlay=fan,ovsame) 4
# USXJPN 6200 6237
# level_fxfore 6238 6248
# level_lower95 6238 6248
# level_upper95 6238 6248