I have 1000 financial time series (closing prices), I am using Toda-Yamamoto test. It is impossible to calculate the causality manually as there are $C_{1000}^{2-1000}$ cases.

Is there a way in which I could calculate the causality mutually?

  • $\begingroup$ The original question is (with a minor tweak) okay, the update places it more clearly off topic. I have edited to remove that addition. The updated question would belong elsewhere but the original question was asked-and-answered and should not have been changed after it was answered.. $\endgroup$ – Glen_b May 6 '17 at 7:49

If you want to test for Granger causality of each pair, both ways ($x \rightarrow y$ and $y \rightarrow x$), you can do it in a nested loop. Let a pair of series be indexed $(i,j)$. The outer loop would be over $i$ from 1 to 1000; the inner loop would be over $j$ from 1 to 1000; and you would skip cases where $i=j$. That would exhaust all pairs $(i,j)$ and would test the causality both ways.

However, is that what you want? If all the pairs of the 1000 series were actually Granger-causal both ways (as is under the null hypothesis), you would on average reject Granger causality in 5% of the tested cases for a significance level of 5% (or 1% for 1%, or similar). There would be a lot of false positives.

| cite | improve this answer | |
  • $\begingroup$ thank you @Richard but in looping it's taking too much time. I want some quick way to calculate the result means the computation time should be less then 30 sec. $\endgroup$ – john Dec 29 '15 at 9:37
  • 1
    $\begingroup$ Since the question seems to concern programming and computational efficiency rather than statistics, it could better suit Stack Overflow than Cross Validated. $\endgroup$ – Richard Hardy Dec 29 '15 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.