# Lag order for Granger causality test

Suppose I'm considering several independent variables for possible inclusion in an ARIMAX model I'm developing. Before fitting different variables, I'd like to screen out variables that exhibit reverse causality by using a Granger test (I'm using the granger.test function from the MSBVAR package in R, although, I believe other implimentations work similarly). How do I determine how many lags should be tested?

The R function is: granger.test(y, p), where y is a data frame or matrix, and p is the lags.

The null hypothesis is that the past $p$ values of $X$ do not help in predicting the value of $Y$.

Is there any reason not to select a very high lag here (other than the loss of observations)?

Note that I have already differenced every time series in my data frame, based on the order of integration of my dependent time series. (E.g., differencing my dependent time series once made it stationary. Therefore, I also differenced all "independent" time series once.)

• Note that your strategy of differencing to get stationarity is subject to absence of cointegration. See the excellent blog post "Testing for Granger Causality" by Dave Giles for details. – Richard Hardy Apr 30 '16 at 16:50

The trade-off is between bias and power. Too few lags, you have a biased test because of the residual auto-correlation. Too many, you allow for potentially spurious rejections of the null - some random correlation might make it look like $X$ helps predict $Y$. Whether or not that's a practical concern depends on your data, my guess would be to lean higher, but lag length can always be determined as follows:

Granger causality always has to be tested in the context of some model. In the specific case of the granger.test function in R, the model has p past values of each of the two variables in the bivariate test. So the model it uses is:

$$y_{i,t}=\alpha+\sum_{l=1}^p \beta_ly_{i,t-l} + \gamma_lx_{i,t-l}+\epsilon_{i,t}$$

A conventional way to choose $p$ for this model would be to try this regression with various values of $p$ and use keep track of the AIC or BIC for each lag length. Then run the test again using the value of $p$ which had the lowest IC in your regressions.

In general the number of lag in the model can be different for $x$ and $y$ and a Granger test will still be appropriate. It's in the specific case of the implementation of granger.test that your constrained to the same number of lags for both. This is a matter of convenience not a theoretical necessity. With different lag lengths for the two variables, you can still use the AIC or BIC to select your model, you'll just have to compare many combinations $n$ lags of $x$ and $m$ lags of $y$. See this.

Just an extra word - because the Granger test is model dependent, omitted variables bias may be a problem for Granger causality. You may want to include all the variables in your model, and then use Granger causality to exclude blocks of them instead of using the granger.test function which only does pair-wise tests.

• Let me see if I understand this correctly... So, if I'm checking whether y causes changes in x1, then I perform several fits: x1 ~ L(y,1), x1 ~ L(y,1) + L(y,2), x1 ~ L(y,1) + L(y,2) + L(y,3)... Then, the one with the best IC is the lag I choose use for the Granger test? – ch-pub Jul 15 '14 at 15:26
• Yes, although lagged values of x should be included as well. – jayk Jul 15 '14 at 15:46
• I'm not sure I understand that part. You mean something like this? x1 ~ L(y,1) + L(x1,1) versus x1 ~ L(y,1) + L(x1,1) + L(y,2) + L(x1,2) versus... – ch-pub Jul 15 '14 at 15:50
• Yes. In general you don't have to do it this way because the lag lengths don't have to be the same for x and y. See: en.wikipedia.org/wiki/Granger_causality#Mathematical_statement However the R command granger.test uses p past values of x AND y. With this specification underlying the test you need try using IC with n past values of x AND y versus IC with n+1 past values of x AND y. – jayk Jul 15 '14 at 15:58
• No problem! I've just edited my original response to make it a bit less opaque. – jayk Jul 15 '14 at 16:19