Transfer Function Models :: Arimax in TSA
ARIMAX models can be a bit difficult to implement/interpret in R. In this case there are a few things that tripped you up. Here they are in no particular order:
"mean-delete" is another way of saying "remove the mean". In this case, it refers to the covariate lead_140
. So, start with
lead_140_Z <- lead_140 - mean(lead_140).
The order of the ARIMAX model you are trying to fit is (0,1,1), which is the same as ARMAX(0,1) on the first-differenced data. So, rather than work with the differencing inside of the model, just do so beforehand:
sales_140_D <- diff(sales_140)lead_140_D <- diff(lead_140_Z)
In this case, the order of the transfer function is actually (1,3), but the first, second and third MA parameters (MA0, MA1 and MA2) are fixed at 0 (ie, only B^3 appears in the numerator). To address this, you need to use the fixed
argument in ARIMAX()
and specify NA
for those params to estimate and 0
for those to omit.
You don't need anything for xreg
as the covariate occurs in the transfer.
mod <- arimax(sales_140_D, order=c(0,0,1), include.mean=TRUE, fixed=c(NA,NA,NA,0,0,0,NA), xtransf=lead_140_D, transfer=list(c(1,3)), method="ML")mod# Coefficients: ma1 intercept T1-AR1 T1-MA0 T1-MA1 T1-MA2 T1-MA3 -0.5791 0.0286 0.7255 0 0 0 4.7092s.e. 0.0756 0.0090 0.0040 0 0 0 0.0551
The results aren't exact, but they are quite close.