Search code examples
pythonstatisticsstatsmodels

How to estimate the optimal model, following from the granger causality test?


Suppose I run the GC-test:

grangercausalitytests(np.vstack((df['target'], df['feature'])).T, maxlag=5)

I can pick the lag of the "feature" variable, which most likely Granger-causes the "target" variable.

  1. But what number of lags does the "target" variable have in this model?
  2. Further, how do I estimate this ADL model (some autoregressive lags + some lags of the independent variable)? I've seen somewhere, that ADL should be substituted with OLS/FGLS in Python, since there is no package for ADL. Yet I do not understand how to do that

Solution

    1. I found out that the model, corresponding to each particular number of lags in the GC-test has already been fit and is contained in the test return. The output looks messy, but it's there.
    2. Unfortunately, there seems to be no capacity to estimate ADL models in Python yet :(