The fix here was actually a bit more involved than I thought. Runge's LocalPermutationTest is based on conditional mutual information (CMI), and requires that we estimate that CMI in a certain way (that depends on if entropy-based, mutual information-based or CMI-based estimation is used).
Using any of these estimation methods, we can simply re-write transfer entropy as CMI, construct relevant marginals and apply the LocalPermutationTest directly.
However, dedicated transfer entropy estimators such as Zhu1 or Lindner can't easily be expressed in terms of any of the above-mentioned estimation methods. Therefore, I here introduce a new conditional independence test, specifically aimed for transfer entropy. The concept is similar to what is done for the CMI-based LocalPermutationTest: shuffle one variable according to local neighbor information in the conditioning variable. The shuffled variable for transfer entropy is the first( source) variable, similar to what we do for SurrogateTest.
I don't think this transfer entropy-specific local permutation test appears in the literature anywhere, so it would be fun to explore it further at some point in a paper, but that's for future work.
Misc
Low-level estimation code for Lindner now has an additional layer that is utilized to avoid excessive StateSpaceSet allocations during repeated analysis, e.g. using LocalPermutationTest. Thus, using Lindner is now faster with LocalPermutationTest than it would otherwise be.
TODO:
[x] Add tests (analytical tests using e.g. AR-system)?
Fixes
This fixes #348.
The fix here was actually a bit more involved than I thought. Runge's
LocalPermutationTest
is based on conditional mutual information (CMI), and requires that we estimate that CMI in a certain way (that depends on if entropy-based, mutual information-based or CMI-based estimation is used).Using any of these estimation methods, we can simply re-write transfer entropy as CMI, construct relevant marginals and apply the
LocalPermutationTest
directly.However, dedicated transfer entropy estimators such as
Zhu1
orLindner
can't easily be expressed in terms of any of the above-mentioned estimation methods. Therefore, I here introduce a new conditional independence test, specifically aimed for transfer entropy. The concept is similar to what is done for the CMI-basedLocalPermutationTest
: shuffle one variable according to local neighbor information in the conditioning variable. The shuffled variable for transfer entropy is the first( source) variable, similar to what we do forSurrogateTest
.I don't think this transfer entropy-specific local permutation test appears in the literature anywhere, so it would be fun to explore it further at some point in a paper, but that's for future work.
Misc
Lindner
now has an additional layer that is utilized to avoid excessiveStateSpaceSet
allocations during repeated analysis, e.g. usingLocalPermutationTest
. Thus, usingLindner
is now faster withLocalPermutationTest
than it would otherwise be.TODO: