New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes release #316

Merged
merged 5 commits into from Jun 18, 2012
Prev

DOC: fix docstring of grangercausalitytests

  • Loading branch information...
josef-pkt committed Jun 18, 2012
commit 1c8348dd0d97c4f0a25ff668ee68aee32240e88f
@@ -693,10 +693,10 @@ def levinson_durbin(s, nlags=10, isacov=False):
def grangercausalitytests(x, maxlag, addconst=True, verbose=True):
'''four tests for granger causality of 2 timeseries
'''four tests for granger non causality of 2 timeseries
all four tests give similar results
`params_ftest` and `ssr_ftest` are equivalent based of F test which is
`params_ftest` and `ssr_ftest` are equivalent based on F test which is
identical to lmtest:grangertest in R
Parameters
@@ -724,15 +724,24 @@ def grangercausalitytests(x, maxlag, addconst=True, verbose=True):
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.
the second column, x2, does NOT Granger cause the time series in the first
column, x1. Grange causality means that past values of x2 have a
statistically significant effect on the current value of x1, taking past
values of x1 into account as regressors. We reject the null hypothesis
that x2 does not Granger cause x1 if the pvalues are below a desired size
of the test.
'params_ftest', 'ssr_ftest' are based on F test
The null hypothesis for all four test is that the coefficients
corresponding to past values of the second time series are zero.
'ssr_chi2test', 'lrtest' are based on chi-square test
'params_ftest', 'ssr_ftest' are based on F distribution
'ssr_chi2test', 'lrtest' are based on chi-square distribution
References
----------
http://en.wikipedia.org/wiki/Granger_causality
Greene: Econometric Analysis
'''
from scipy import stats # lazy import
ProTip! Use n and p to navigate between commits in a pull request.