In R's arima()
function, one can specify a list of covariates while estimating the AR and MA coefficients using the xreg
argument. For instance:
arima(lh, c(2,0,1), xreg= 1:length(lh))
returns a model with ARMA(2,0) disturbance and the linear effect of time series 1:length(lh)
:
Call:
arima(x = lh, order = c(2, 0, 1), xreg = 1:length(lh))
Coefficients:
ar1 ar2 ma1 intercept 1:length(lh)
1.3957 -0.6453 -1.0000 2.1072 0.0105
s.e. 0.1065 0.1082 0.0589 0.0585 0.0023
sigma^2 estimated as 0.1411: log likelihood = -22.85, aic = 57.7
Is there any equivalent method in R when fitting an ARFIMA (Autoregressive fractionally integrated moving average) model? I know it is possible to run a multiple regression on the residuals of an ARFIMA model, but this is different from estimating them together and would like to learn if anyone has a better suggestion.
Best Answer
Note that feeding the
xreg
parameter inarima()
orauto.arima()
does not fit an ARIMAX model, but a regression onxreg
with ARIMA errors. See Rob Hyndman's "The ARIMAX model muddle" blog post.This of course suggests how one could do a similar thing with ARFIMA: regress your observations on your covariates using
lm()
or similar, then fit an ARFIMA model to the residuals, e.g., using thearfima
package. Alternatively, simply use thearfima()
function in the package and use thexreg
parameter.However, if you really want to fit an ARFIMAX model, then I don't know of any R package that will help. (Same for ARIMAX, though I have never explicitly searched for this, since regression with ARIMA errors makes a lot more sense to me.)