Skip to content
All library documents

Why Granger Causality Does Not Identify a Series Lag

Article Quant Q&A · Author: Nicolas Gutierrez

Summary

The document examines a method for estimating how long one time series appears to follow another. The author runs Granger causality tests across candidate lag lengths and selects the lag with the largest F-statistic. That approach gives a plausible short lag in one example, but selects the maximum tested lag in another, despite the apparent timing relationship. The contrasting outputs illustrate why the largest F-statistic is not a reliable measure of the delay between series.

The answers explain that lag order in Granger testing is commonly selected with information criteria such as AIC or BIC, which assess whether added lags improve predictive fit. This selects a model order, not the real-world delay between two series. Granger testing asks whether past values of one series improve forecasts of another; it is not designed to measure a visual lead-lag interval. The discussion also points to autocorrelation for examining a series' own lags and notes that stationarity matters. No definitive lag-measurement procedure is supplied.

Key ideas

  • Choosing the lag with the largest F-statistic does not reliably estimate the delay between two series.
  • Information criteria can select a lag order by balancing fit against model complexity.
  • A Granger test evaluates whether past values of one series improve forecasts of another.
  • Granger causality model selection does not identify a single real-world lead-lag interval.
  • Stationarity is an important condition to consider when applying time-series tests.

Tags

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


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












I am using the Granger causality test to measure the lag between pairs of time series where it is already apparent that one is following the other. So I am not expecting this test to tell me whether causality is likely or not, but rather to help me measure what the lag is.

The question is: is my method for sorting the lag hypothesis optimal? The measurement yields a sensible result for most cases, but there are a few where the result is a counter-intuitive and very long lag.

In the following I will first describe my method and then show two examples, one where my method works and one where it does not.

The method: I am using statsmodels, which comes with a Granger-test module. In my method I run the Granger test for lags between 1 and 12 days. Then I look at the values from the F-test. The lag with the highest F-test value is the optimal lag. Here is the code in Python:

```
granger_test_result = grangercausalitytests(data[:, 1::-1], maxlag=12, verbose=False)

optimal_lag = -1
F_test = -1.0
for key in granger_test_result.keys():
    _F_test_ = granger_test_result[key][0]['params_ftest'][0]
    if _F_test_ > F_test:
        F_test = _F_test_
        optimal_lag = key
return optimal_lag
```

Example #1: This figure illustrates the kind of data I am analyzing. It is evident that green series follows the orange one. In this case, my method works pretty fine and the optimal lag is found to be 1 day.

Example #2: In this case, my method yields a counter-intuitive and very large lag of 12 days.

This is the output from statsmodels F-test for each of the tested lags. The first item in the tuple corresponds to the F-test value. The highest value is indeed for 12L.

```
Optimal lag 12. F_test: 74.84. p_value: 0.00
(32.153600306648876, 4.9523452120563632e-07, 57.0, 1L)
(51.600830587070561, 2.9531736086260536e-13, 54.0, 2L)
(46.061291459709828, 1.511140176815108e-14, 51.0, 3L)
(34.512420150659764, 1.4224612929215072e-13, 48.0, 4L)
(22.215895296628979, 3.7705907562143266e-11, 45.0, 5L)
(18.817209069293003, 1.7380007128923565e-10, 42.0, 6L)
(14.366562461309808, 4.6093266266687769e-09, 39.0, 7L)
(11.296513565933811, 7.9114754208643629e-08, 36.0, 8L)
(12.008824010113649, 3.9713072573193326e-08, 33.0, 9L)
(10.237915003417235, 3.1897816507786703e-07, 30.0, 10L)
(9.7564732369412628, 8.1924196528108249e-07, 27.0, 11L)
(74.843204319602407, 5.2948535623699612e-16, 24.0, 12L)
```

## Answer by Thomas W (score 2)

https://quant.stackexchange.com/a/55785

Lag length selection in Granger Causality tests is usually based on information criteria (AIC, BIC, etc.) instead of an F-test comparison. But Granger Causality seems not to be the adequate concept for your purpose to "measure what the lag is". Applying model selection criteria (e.g. information criteria) in Granger causality tests does not tell you what "the" lag is, but rather looks for the number of lags, such that the last added lag of one variable still improves the prediction of the other variable.

## Answer by JeeyCi (score 0)

https://quant.stackexchange.com/a/75687

to solve the problem "correlation does not necessarily imply causation" -- Granger Causality Test in Python is used & shows if X & its lags are forecasting Y, meaning X & Y to be Cause & Effect, - so the essence: fitting VAR. But not analysing lags of one timeseries (e.g. X). In order to measure what the lag is in one timeseries you should see Autocorrelation factor.

More precise (here):"We only test if X (and lags of X) is helpful in explaining Y, and thereby help forecasting it. So we are not concerned about the true causal relationship between the variables. ". And important: ts_s should be stationary, meaning mean & var not changing in time

There are 4 tests for granger non causality of 2 time series, aiming to hypothesis of causality testing (interpretation) -- & can apply either all of them or any - for approving your conclusion done

> H0 : X does not granger cause Y, H1 : X does granger cause Y, if p-value > 0.05 then H0 is accepted

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.