I am fitting both an arima model (with xreg variables) and a gls model to my data in R software. They both have the same ARMA structure and variables. The ARIMA model fits to the data better. Does anyone know what the difference between these two are? I have seen that the equation for an ARIMA model in R with xreg is a linear regression with ARMA errors. Is that the same as a linear regression with ARMA error correlation (as used by the GLS)?


EDIT: The following code was used to create the GLS and ARIMA models:

arima3a <- arima(train.all$sv,xreg = train.all[,c(5,6)],order=c(2,0,1))

gls3 <- gls(sv~sin+cos,data=train.all,correlation = corARMA(p=2,q=1))

Note: the sin and cos variables are equivalent to the variables 5 and 6 in the train.all matrix.

  • $\begingroup$ I'm a bit unclear on just how you fit a regression with ARIMA errors using gls() (I assume you are using R, right?). Are you modeling the error correlation using corARMA? That would of course be something very different than regression with ARIMA errors, or ARIMAX (which are different things). Could you please edit your question to include your actual code, edited for brevity? $\endgroup$ – Stephan Kolassa Jul 9 '15 at 6:32
  • $\begingroup$ Hello, thank-you for your response! I edited my entry, and I hope that helps (my apologies for not being more clear). I think you already pointed out in your response where I went wrong. If I understand you correctly, are you saying that a GLS allows for correlated error whereas the ARIMA with exogenous variables directly models the errors using an ARIMA equation? $\endgroup$ – Hannah Jul 9 '15 at 15:50

The two models model somewhat different things.

  • arima(... , xreg = ...) calculates a regression on xreg, modeling its errors as an ARIMA process. Note that this is not the same as an ARIMAX model, and that this also applies to Arima() and auto.arima().
  • gls(..., correlation=corARMA(p,q)) calculates a generalized linear model, where the correlation structure of your errors follows an ARMA(p,q) process.

The ideas are of course similar, but the actual models are somewhat different. I find the arima() model easier to understand. It would be interesting to compare the coefficients on both the fixed regressors and the ARIMA models for the errors resp. their correlation.

Given that both models have the same complexity (as in number of parameters, as long as ARMA orders are the same), I'd go with the better fitting one. (But remember that you can't compare AICs calculated by functions in different packages, as AIC is only defined up to a constant, which can definitely differ between packages.)

  • $\begingroup$ Okay great, that really helped clear things up for me. Thank-you! $\endgroup$ – Hannah Jul 9 '15 at 16:12

Not 100% sure, but my understanding is that the difference could be the way the two models are estimated. That is;

I think that ARIMA (assuming you are using R) simultaneously estimates the ARIMA parameters and the xreg parameters, whilst alternatively the gls model will fit the ARMA parameters to the residuals after the regression.


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.