I'm trying to test for Granger causality of two data sets A and B. The time series length is 106.
First I used Matlab function granger_cause
and the results are as follow:
[F,c_v]=granger_cause(a,b,0.05,7)
F =
6.2566
c_v =
2.1955
Then I used R function granger.test
in the package MSBVAR to do the same thing:
granger.test(c,7)
F-statistic p-value
b -> a 0.9553480 0.4691375
a -> b 0.9224725 0.4934965
Here c
is the combination of column vectors a
and b
.
Clearly, the first function specifies the $\alpha$ level and outputs the critical value of the $F$-test, while the second gives the $p$-value and lets user determine the $\alpha$ level.
What I don't understand is why these two functions give me different $F$-values? Is there anything I need to be aware of? Thanks!
Best Answer
In the Matlab function
granger_cause
, the lag length is selected using BIC and the last argument to the function is the maximum lag to be considered.In the R function
granger.test
, the exact lag length is supplied by the second argument.It may be the case that in your application you actually ended up having different lag lenghts (since in Matlab some other lag than 7 was selected by BIC), and therefore you got different results.