# Endogenous extra regressors in ARIMA, transfer function and/or ARIMAX

Following the post here, it has been an intense couple of weeks trying to understand ARIMA and how to apply exogenous regressors to the model. To summarize, I have attempted to forecast monthly unemployment data (in percentage) during several years using ARIMA and using viewership data of some Wikipedia articles as my exogenous regressors. Both, the time series and the regressors, have the same length. In many occasions, the addition of exogenous regressors improves the prediction of unemployment (in this case, 5 months of unemployment) obtained only using ARIMA without regressors. We have tried to test the robustness of this model by shifting back in time one month at a time. Taking care to keep at least 3 years of training and always forecasting 5 months. We noticed that the accuracy changes considerably.

We now have thought that perhaps the use of regressors is not appropriate because the "viewership time series" may not be completely independent. So we have considered using ARIMAX and transfer functions. The idea is to use both unemployment and viewership data to forecast unemployment. It is in this part that I am confused ...
Do you know any example of how to implement transfer functions using ARIMAX in R?
Do you think this is the right approach or should I stick with ARIMA and exogenous regressors?

• I have edited the title to better reflect the main problem of interest. If I failed, feel free to reverse. – Richard Hardy Sep 20 '16 at 16:25
• I was going through my old answers and noticed this one was not accepted. Do you perhaps need further clarification? – Richard Hardy Feb 24 '17 at 13:57

Neither (univariate) ARIMAX nor (univariate) regression with ARMA errors will remedy the problem of endogeneity. These models assume the exogenous variable is, hmm, exogenous.

A simple extension of ARIMAX to systems of more than one endogenous variable is vector autoregression (VAR). A more complicated one is vector ARMA (VARMA). Both can also include exogenous regressors, turning them into VARX and VARMAX, respectively. VAR and VARX will likely suffice for starters (personally, I find VARMA and VARMAX quite tedious and computationally tricky).

• Thanks Richard, I have come across several posts about auto.arima and the parameter "xreg" in R to use exogenous regressors. Can you please elaborate a bit more why VARX and VARX can be a better solution. Also, can you "predict" values (in my case unemployment of 5 months) using VAR and VARX R? – ruthy_gg Sep 20 '16 at 16:30
• Also if you have a paper or document that can help me understand the logic of these exogenous regressors ...in my case I would like to use the "viewership data" to help improve the prediction of ARIMA. – ruthy_gg Sep 20 '16 at 16:31
• VAR explicitly models the effect of $y$ on $x$ (through their lags) extra to the effect of $x$ on $y$ as in univariate ARIMA-type models. You can predict both $y$ and $x$ using VAR. But if $x$ is truly exogenous ($y$ does not have an effect on $x$), then stick to (univariate) ARIMA-type models. – Richard Hardy Sep 20 '16 at 16:32
• Do you happen, maybe, to have an example of how this works? – ruthy_gg Sep 20 '16 at 16:34
• Basic econometric textbooks often include VAR models. You can also check Wikipedia or some online lecture notes. VAR models are not a rarity, so you will easily find material on them. – Richard Hardy Sep 20 '16 at 16:35

I know this is late but it seems to be a commonly occurring question. From my point of view, the main questions are:

(1) Are there any lagged effects of the exogenous variable? Or is it having only a simultaneous impact?

(2) Are there any potential mutual dependencies between the endogenous and exogenous variables? (e.g. a "chicken-and-egg" relationship)

(S)ARIMAX is suitable only if the answers to both questions is NO as there the exogenous variables have simultaneous impact only and it is not including any mutual dependencies.

For more details I'd recommend reading this post of R. Hyndman: https://robjhyndman.com/hyndsight/arimax/

EDIT

And even if you answer NO to both questions you should ask yourself:

(3) Do I need to predict (rather than just study the impact of a factor on the dependent variable?

(4) Would I have the values of the exogenous variables for the future period?

If your answer to (3) is YES but your answer to (4) is NO than (s)ARIMAX is not suitable either. You would need a VAR-type model to predict the exogenous variable(s), too.

• autobox.com/cms/index.php/blog/tags/tag/… presents the classic box-jenkins example of delays and lag effects using predictor series in a SARIMAX model and for more discussion od transfer functions see stats.stackexchange.com/… – IrishStat Dec 25 '19 at 19:22
• A chicken and egg type of relationship probably means both variables are endogenous. An exogenous variable would not be determined by any other variable in the system. – Richard Hardy Dec 25 '19 at 19:22
• the lag structure i.e. the appropriate form of each X variable ( the exogenous variable ) can be found by examining the pre-whitened cross-correlation function of the original Y and the candidate X series OR the the cross-correlation between the pre-whitened X and the current model's residuals possibly suggesting the need for additional lags of the candidate X. This is standard model diagnostics suggesting possible enhancement. – IrishStat Dec 25 '19 at 20:43