How to use statsmodels' Granger causality test to measure the lag between two time series?

295 views
Skip to first unread message

Nicolas Gutierrez

unread,
Dec 8, 2017, 3:38:51 PM12/8/17
to pystatsmodels
Hi all,

I have posted a question regarding statsmodels' Granger causality test in Cross Validated:
https://stats.stackexchange.com/questions/317786/how-to-use-statsmodels-granger-causality-test-to-measure-the-lag-between-two-ti

I would much appreciate your input!

Kind Regards,
Nicolas

josef...@gmail.com

unread,
Dec 10, 2017, 10:33:53 PM12/10/17
to pystatsmodels
Sorry, slow reply, but I'm not sure what the answer should be.

grangercausalitytests looks at the regression on lagged values only in terms of whether all cross lag coefficients are jointly significant.
It doesn't say anything directly about what the dominant lag would be or how many lags are relevant. So, I'm not sure what minimizing the p-value would imply about the lag structure.

We don't have univariate distributed lag models, or transfer models directly. AFAIK, even in the statespace models there is no out of the box support.
To check the importance of specific lags of x2 on predicting x1, based on what's available:

One possibility is to look just at raw correlation, `ccf` should show a peak at the delay lag. (AFAICS, we don't have a partial ccf as analogue to pacf)

Another is to use VAR for the full two variable system, but only look at the lag coefficients for the relevant cross-effect. The coefficient should be large at the delay lag.

grangercausalitytests implements an OLS regression of one variable on the lags of the own and cross variable similar to a single equation of VAR. This could be used to test other hypothesis about the lag coefficients, e.g. that all coefficients beyond a specific lag are zero, this is just a f_test or a wald_test.
The OLS results also have the tvalues and pvalues for individual coefficients in the full model.

All these provide more directly information about specific lag coefficients, and the impact of different lags on the prediction/fit of the first variable, i.e. they are more indicative of which part or lag contributes to granger causality.

Josef

 

Kind Regards,
Nicolas

Reply all
Reply to author
Forward
0 new messages