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):

arima(x = lh, order = c(2, 0, 1), xreg = 1:length(lh))

         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.

  • $\begingroup$ There's a good chance that the answer is no, but have you tried out package fArma? $\endgroup$ – Digio Jul 27 '17 at 12:14
  • 1
    $\begingroup$ Try the "rugarch" package in R, I think it has the functionality for fitting ARFIMA models with exogenous regressors. However, I am not sure whether it is ARFIMAX or regression with ARFIMA errors (this should become clear from the documentation and the vignette). In the latter case, it should be more efficient than fitting the regression and the ARFIMA part in two stages. $\endgroup$ – Richard Hardy Jul 27 '17 at 12:30
  • $\begingroup$ Most of R's time series libraries are wrappers of arima() so I would assume that the xreg option is always regression with ARMA errors. $\endgroup$ – Digio Jul 27 '17 at 12:34
  • $\begingroup$ @Digio, from what I know about the package, I suspect this is not the case with "rugarch", but one should check to be sure. $\endgroup$ – Richard Hardy Jul 29 '17 at 10:23

Note that feeding the xreg parameter in arima() or auto.arima() does not fit an ARIMAX model, but a regression on xreg 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 the arfima package. Alternatively, simply use the arfima() function in the package and use the xreg 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.)

  • $\begingroup$ +1. I was recently searching for an ARIMAX function for R but I couldn't find one. Regressing AR(p) terms with lm() should work (it's called ARX) but this won't work with MA(q) terms. $\endgroup$ – Digio Jul 27 '17 at 12:21
  • 1
    $\begingroup$ @Digio: you may be able to fit a Dynamic Linear Model (DLM) and constrain it appropriately. $\endgroup$ – S. Kolassa - Reinstate Monica Jul 27 '17 at 12:25
  • 1
    $\begingroup$ Regression with ARMA errors is useful when one wants interpretability but doesn't really improve prediction accuracy as much as ARIMAX theoretically should. $\endgroup$ – Digio Jul 27 '17 at 12:25
  • 1
    $\begingroup$ @Digio: the operative word here being theoretically. Given that the top-voted answer on CV to a question asking for real life MA processes is that MA helps with model misspecification, I am kind of sceptical about the practical worth of MA(q) terms. $\endgroup$ – S. Kolassa - Reinstate Monica Jul 27 '17 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.