On Mon, Jun 11, 2012 at 11:47 AM, Jieyun Fu <
jiey...@gmail.com> wrote:
> Thanks for your reply.
>
> More question: what's the difference between this
> statsmodels.tsa.stattools.grangercausalitytests()
> and statsmodels.tsa.vector_ar.var_model.VARResults.test_causality() ?
The main difference in the results comes from the degrees of freedom.
statsmodels.tsa.stattools.grangercausalitytests uses the degrees of
freedom definition for a single OLS estimate.
works only for bivariate case
VARResults.test_causality() uses the definition from the entire
system of equations.
There is a different definition of the test if more than two variables
are involved. I don't remember the details, but, IIRC, I once posted
an example and discussion of the difference to the mailing list.
(in R lmtest:grangertest is the same as
tsa.stattools.grangercausalitytests (SSR )
in R package VAR there is a similar version as the VAR causality test,
but with different definition if there are several variables involved)
>
> Also, what's the difference between SSR based F test and parameter F test? I
> can't find a document that explains this two.
The first one compares SSR between restricted and unrestricted model,
see the first definition of S1 in the SAS reference I gave.
The second builds a restriction matrix and uses the f_test of the
unrestricted results instance.
In the linear model these are either the same or close, in general
it's the difference between Wald, Likelihood Ratio and Lagrange
Multiplier tests.
(IIRC, the initial version of this was written as an example to check
that the different ways of calculating a test work.)
Asymptotically the are equivalent, but I never looked for a reference
whether there is a difference in power for granger causality tests in
finite samples.
Thanks for feedback and showing interest.
(There are functions that have accumulated over time and need a
review, mainly for usability and documentation. Knowing what users
want to use unearths at least some of them.)
Josef