# [R] Forecasting using ARIMAX

siang.li.chua at acceval-intl.com siang.li.chua at acceval-intl.com
Wed Oct 15 09:25:01 CEST 2008

```Dear R-helpers,

I would appreicate if someone can help me on the transfer parameter in ARIMAX and also see what I am doing is correct.

I am using ARIMAX with 2 Exogeneous Variables and 10 years data are as follows:

DepVar Period, depVar, IndepVar1 Period, indepVar1, IndepVar2 Period, indepVar2
Jan 1998,708,Jan 1998,495,Jan 1998,245.490
Feb 1998,670,Feb 1998,421.25,Feb 1998,288.170
Mar 1998,642.5,Mar 1998,395,Mar 1998,254.950
Apr 1998,610,Apr 1998,377.5,Apr 1998,230.640
:

> (nrowDepVar <- nrow(depVar))
[1] 545
> (nTest <- nInstance + nHorizon - 1) #number of latest points reserved for testing
[1] 13
> (nTrain <- nrowDepVar - nTest)
[1] 532

First I use auot.arima to find the best (p,d,q).

> modArima <- auto.arima(depVar[1:nTrain,], trace=TRUE)

ARIMA(2,1,2) with drift         : 4402.637
ARIMA(0,1,0) with drift         : 4523.553
ARIMA(1,1,0) with drift         : 4410.036
ARIMA(0,1,1) with drift         : 4442.558
ARIMA(1,1,2) with drift         : 4401.178
ARIMA(1,1,1) with drift         : 4399.421
ARIMA(1,1,1)                    : 4398.502
ARIMA(0,1,1)                    : 4443.709
ARIMA(2,1,1)                    : 4400.818
ARIMA(1,1,0)                    : 4409.569
ARIMA(1,1,2)                    : 4400.196
ARIMA(0,1,0)                    : 4526.782
ARIMA(2,1,2)                    : 4401.824

Best model: ARIMA(1,1,1)

>   (bestOrder <- cbind(modArima\$arma[1],modArima\$arma[5],modArima\$arma[2]))
[,1] [,2] [,3]
[1,]    1    1    1
>   (bestSessionOrder <- cbind(modArima\$arma[3],modArima\$arma[6],modArima\$arma[4]))
[,1] [,2] [,3]
[1,]    0    1    0
> modArimax <- arimax(depVar[1:nTrain,], order=bestOrder,
xtransf=data.frame(indepVar[1:nTrain,]))

After testing and validation, I think the model is robust enough go for real forecasting.

Q1. Since my model is trained until Jul 2007, I shall 'update' the model to to include values up to Sep 2007, how can I 'update' it?

Q2. Now, say I am forecasting for next month Nov 2008.  But I yet to have Nov 08 data for the 2 independent variables In fact currently, I only have Sep 2008 values.  I think the parameter transfer is the solution? Would appreciate someone can shed some light on how I can proceed.

Many Thanks.

siangli

```