Discussion:
[pystatsmodels] Granger causality sign of direction
Remco de Bruijn
2018-11-21 16:46:47 UTC
Permalink
Hello,

I have a question about the granger causality test (
https://www.statsmodels.org/dev/generated/statsmodels.tsa.stattools.grangercausalitytests.html
).
Is it possible to retrieve the (average) sign of the effect of the Granger
causality test function? To clarify, can it return the estimated values of
the coefficients in the VAR model? The summary information only contains
the F-test results.

With kind regards,

Remco

Statsmodels version:
0.10.0.dev0+2c76850
j***@gmail.com
2018-11-22 17:31:36 UTC
Permalink
Post by Remco de Bruijn
Hello,
I have a question about the granger causality test (https://www.statsmodels.org/dev/generated/statsmodels.tsa.stattools.grangercausalitytests.html).
Is it possible to retrieve the (average) sign of the effect of the Granger causality test function? To clarify, can it return the estimated values of the coefficients in the VAR model? The summary information only contains the F-test results.
If you estimate a VAR model, then the estimated coefficients are
available as results.params as in all models. VAR params are
2-dimensional.

The standalone function tsa.stattools.grangercausalitytests includes
the auxiliary OLS models in the return. Those should have the relevant
parameters and estimation results.
The return is a bit messy, because it returns everything (*)

(*) AFAIR, I wasn't sure exactly what and which version of the test we
want, so I included everything. And it never got simplified.

e.g. AFAICS in a quick example
maxlag 3
r1 is the full model
c is the contrast matrix for the restrictions
so c.dot(r1.params) selects the params that were tested to be zero
Post by Remco de Bruijn
xx = np.random.randn(500, 2)
res = tsa.grangercausalitytests(xx, 3)
r0, r1, c = res[3][-1]
c.dot(r1.params)
array([ 0.04761355, 0.05999941, 0.0020846 ])
Post by Remco de Bruijn
print(r1.summary())
Josef
Post by Remco de Bruijn
With kind regards,
Remco
0.10.0.dev0+2c76850
Loading...