Page 1 of 1

Replicate Forecasts from ARIMA with Higher Order of (p,d,q)

Posted: Thu Mar 05, 2020 3:19 pm
by AllanL
Hi Everyone,

I am using Eviews 10 and trying to replicate Eviews dynamic forecast from some ARIMA models with (p,d,q) of higher orders.
I already read through this illustration: http://forums.eviews.com/viewtopic.php?f=7&t=465 (Let's call it "The Illustration") and this thread http://forums.eviews.com/viewtopic.php? ... 465#p45134. (Let's call it "The Thread")

But, I still have problems when I try to replicate the forecast "manually".
More specifically, I need a generalized formula or example for replicating forecasts from ARIMA models selected by EViews "autoarma" with possibly log transformation and the order up to ARIMA(4,2,4).

Here are some problems I have encountered. I start from a simple ARIMA(0,1,1), the same one used in "The Thread".

1. How to replicate the forecast when ML, instead of CLS, method is used?
I found the forecasts are not well replicated in the first forecast period (or first two periods if d=2) when the equation is estimated by ML method as it is in the "autoarma". However, imposing CLS method make the estimates totally different from what is chosen from "autoarma".

Here are the codes revised from the static forecast example in "The Thread".

Code: Select all

'Model: ARIMA(0,1,1). Estimation sample: 1~ 20. Dynamic Forecast period: 21 ~ 100 rndseed 1 create u 100 series x=nrnd series y=nrnd smpl 1 20 equation e1_ml.ls(Z) d(y) c d(x) ma(1) 'ML method smpl 21 100 'Dynamic Forecast from period 21 to 100 e1_ml.forecast(d) yhatd1_ml smpl 1 20 equation e1_cls.ls(ARMA=CLS, Z) d(y) c d(x) ma(1) 'CLS method smpl 21 100 e1_cls.forecast(d) yhatd1_cls smpl 1 2 series e=d(y)-c(1)-c(2)*d(x) smpl 3 20 series e=d(y)-c(1)-c(2)*d(x)-c(3)*e(-1) smpl 1 20 series yhatd2_cls = d(y) ' fill pre-forecast period yhatd2 by "observed" data 'Manual forecast: the loop is used for a generalized procedure even when ar term exists (p>0). 'Using CLS estimates to replicate the forecast for !N = 21 to 100 smpl !N !N yhatd2_cls=c(1)+c(2)*d(x)+c(3)*e(-1) e = yhatd2_cls -c(1)-c(2)*d(x)-c(3)*e(-1) next e1_ml.updatecoefs 'Using ML estimates to replicate the forecast for !N = 21 to 100 smpl !N !N series yhatd2_ml=c(1)+c(2)*d(x)+c(3)*e(-1) e = yhatd2_ml-c(1)-c(2)*d(x)-c(3)*e(-1) next smpl @all show yhatd1_cls yhatd1_ml yhatd2_cls yhatd2_ml
As we can find, the yhatd2_ml of period 21 is different but the CLS forecast, yhatd2_cls, is well replicated.
So, how should I replicate the forecast with estimates obtained from ML method?

2. What is the formula for "e" in the first "d+q" period?
Now, we consider a model with both AR and MA.
Even if I impose CLS method, I find the formula from "The Illustration" and "The Thread" seems no longer applicable for higher orders ARMA(p>=2,q>=2).

I guess I may misunderstand the rule to obtain "e" for the first few periods.
Below are the codes for the dynamic forecast with an ARIMA(2,0,2) model and y is not transformed.

Code: Select all

' ** Model: ARMA(2,0,2). Sample period: 1~20. Forecast period: 21~100. rndseed 1 create u 100 series x=nrnd series y=nrnd smpl 1 20 equation e1.ls(arma=cls, z) y c x ar(1 to 2) ma(1 to 2) smpl 21 100 e1.forecast yhatd1 'Dynamic forecast 'Manual Dynamic Forecast smpl 1 1 series u = y - c(1)-c(2)*X series e=0 smpl 2 2 u= y - c(1)-c(2)*X e= u - c(3)*u(-1) - c(5)*e(-1) smpl 3 20 u= y - c(1)-c(2)*X e= u - c(3)*u(-1) - c(4)*u(-2) - c(5)*e(-1) - c(6)*e(-2) series yhatd2 = y for !N = 21 to 100 smpl !N !N series yhatd2 = c(1)+c(2)*x + c(3)*u(-1) + c(4)*u(-2) + c(5)*e(-1) + c(6)*e(-2) u = yhatd2 -c(1)-c(2)*X e = yhatd2 -c(1)-c(2)*X - c(3)*u(-1) - c(4)*u(-2) - c(5)*e(-1) - c(6)*e(-2) next smpl 1 100 show yhatd1 yhatd2 u e
So, the "manual forecast" yhatd2 is totally not right since the period 21.
However, by the same "rule", I can replicate the forecast for simpler models such as ARIMA(2,0,1) or ARIMA(1,0,3).

Code: Select all

' ** ARIMA(1,0,3) rndseed 1 create u 100 series x=nrnd series y=nrnd smpl 1 20 equation e1.ls(arma=cls, z) y c x ar(1) ma(1 to 3) smpl 21 100 e1.forecast yhatd1 'Dynamic forecast 'Manual Dynamic Forecast smpl 1 1 series u = y - c(1)-c(2)*X series e=0 smpl 2 2 u= y - c(1)-c(2)*X e= u - c(3)*u(-1) - c(4)*e(-1) 'omit e(-2) and e(-3) smpl 3 3 u= y - c(1)-c(2)*X e= u - c(3)*u(-1) - c(4)*e(-1) - c(5)*e(-2) 'omit e(-3) smpl 4 20 u= y - c(1)-c(2)*X e= u - c(3)*u(-1) - c(4)*e(-1) - c(5)*e(-2) - c(6)*e(-3) series yhatd2 = y for !N = 21 to 100 smpl !N !N series yhatd2 = c(1)+c(2)*x + c(3)*u(-1) + c(4)*e(-1) + c(5)*e(-2) + c(6)*e(-3) u = yhatd2 -c(1)-c(2)*X e = yhatd2 -c(1)-c(2)*X - c(3)*u(-1) - c(4)*e(-1) - c(5)*e(-2) - c(6)*e(-3) next smpl 1 100 show yhatd1 yhatd2 u e


In short, I am unable to find the formula to let us replicate the forecast after a model is selected by Eviews "autoarma".

Could someone please provide the formula or sample codes to manually replicate dynamic forecast (without imposing CLS method) using models such as ARIMA(4,2,4) and dlog(y,2) as an example? I appreciate it very much!