Logo

scikits.statsmodels.tsa.stattools.grangercausalitytests

scikits.statsmodels.tsa.stattools.grangercausalitytests(x, maxlag, addconst=True, verbose=True)[source]

four tests for granger causality of 2 timeseries

all four tests give similar results params_ftest and ssr_ftest are equivalent based of F test which is identical to lmtest:grangertest in R

Parameters :

x : array, 2d, (nobs,2)

data for test whether the time series in the second column Granger causes the time series in the first column

maxlag : integer

the Granger causality test results are calculated for all lags up to maxlag

verbose : bool

print results if true

Returns :

results : dictionary

all test results, dictionary keys are the number of lags. For each lag the values are a tuple, with the first element a dictionary with teststatistic, pvalues, degrees of freedom, the second element are the OLS estimation results for the restricted model, the unrestricted model and the restriction (contrast) matrix for the parameter f_test.

Notes

TODO: convert to class and attach results properly

The Null hypothesis for grangercausalitytests is that the time series in the second column, x2, Granger causes the time series in the first column, x1. This means that past values of x2 have a statistically significant effect on the current value of x1, taking also past values of x1 into account, as regressors. We reject the null hypothesis of x2 Granger causing x1 if the pvalues are below a desired size of the test.

‘params_ftest’, ‘ssr_ftest’ are based on F test

‘ssr_chi2test’, ‘lrtest’ are based on chi-square test

Previous topic

sm.tsa.stattools.q_stat

Next topic

sm.tsa.stattools.levinson_durbin

This Page