Solved – ARIMA (with xreg) vs GLS

arimageneralized-least-squarestime series

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

Thanks!

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.

Best Answer

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