# ARIMA model with multiple covariates, XREG

Cross Validated Asked by Bromideh on December 3, 2020

I have shared the main data d2015.txt, includes 5 columns. The first column is the $$y_t$$ the time series observation. The 2nd to the 4th column is the covariates/regressors and the fifth column is the mean of the three covariates. The main file shared in my google drive.

I used this code to fit an ARIMA model in which "ur" is univariate time series of observation and the "gt" is a multivariate covariates dataset with 3 columns:

> fit2 = auto.arima(ur,xreg=gt)


the output is:

Series: ur
Regression with ARIMA(1,1,0) errors

Coefficients:
ar1    drift   Apply  office  resume
0.5109  -0.1562  0.0098  0.0001  -5e-04
s.e.  0.1141   0.0277  0.0013  0.0017   9e-04

sigma^2 estimated as 0.01239:  log likelihood=50.62
AIC=-89.24   AICc=-87.71   BIC=-76.48

Training set error measures:
ME    RMSE        MAE        MPE      MAPE     MASE        ACF1
Training set 0.002114705 0.10588 0.08902272 0.04035552 0.5226742 0.497244 -0.06112877


My first question is: how to formulate this ARIMA into mathematical writing?

$$Y_t$$= ???

I used pred2 = forecast(fit2,h=1, xreg=gt)to forecast the next month, but it predicts for more months!!! Why? Can you correct me, pls?

1. Note that auto.arima() fits a regression with ARIMA errors, not an ARIMAX model. There is a difference. Thus, your model is

$$y_t=X_tbeta+epsilon_t,$$

where $$X_t$$ contains your regressors at time $$t$$, and

$$epsilon_tsimtext{ARIMA(1,1,0) with drift,}$$

or

$$(epsilon_t-epsilon_{t-1}) = gamma t+phi(epsilon_{t-1}-epsilon_{t-2})+eta_t.$$

$$gamma$$ is estimated by your drift parameter and $$phi$$ by the ar1 one.

2. You can find what is happening in ?forecast.Arima (note the capital A), under the entry for h in the Arguments section:

If ‘xreg’ is used, ‘h’ is ignored and the number of forecast periods is set to the number of rows of ‘xreg’.

Of course, you need to supply the new regressors when forecasting, and then the number of rows in this new regressor matrix is used to determine the forecasting horizon. However, you are using the regressors gt you used in fitting for forecasting. You probably don't want to do this.

Answered by Stephan Kolassa on December 3, 2020