I am having some issues computing Transfer Entropy.
I have no problem following the example in the vignette.
Here is my problem. I create the following vectors subsetted from actual data.
x <- c(79652133, 88786612, 95234422, 99336996, 100764257, 105189366, 121472911,
119542332, 119862125, 120657508, 124405340, 125345113, 132920670)
y <- c(211363, 217291, 226623, 230039, 239212, 247339, 255805, 264450, 282990,
304316, 314135, 313509, 331670)
te_result <- transfer_entropy(x, y, nboot = 100)
te_result
Shannon's entropy on 1 core with 100 shuffles.
x and y have length 14 (0 NAs removed)
[calculate] X->Y transfer entropy
[calculate] Y->X transfer entropy
[bootstrap] 100 times
Error in sample.int(length(x), size, replace, prob) :
invalid first argument
> te_result
Shannon Transfer Entropy Results:
-----------------------------------------------------------
Direction TE Eff. TE Std.Err. p-value sig
-----------------------------------------------------------
X->Y 0.0000 0.0000 0.0000 0.0000 ***
Y->X 0.0000 0.0000 0.0000 0.0000 ***
-----------------------------------------------------------
Bootstrapped TE Quantiles (100 replications):
-----------------------------------------------------------
Direction 0% 25% 50% 75% 100%
-----------------------------------------------------------
X->Y 0.0000 0.0000 0.0000 0.0000 0.0000
Y->X 0.0000 0.0000 0.0000 0.0000 0.0000
-----------------------------------------------------------
Number of Observations: 13
-----------------------------------------------------------
p-values: < 0.001 '***', < 0.01 '**', < 0.05 '*', < 0.1 '.'
The algorithm works fine. However, if I add an additional element to both vectors x and y, I get an error:
x <- c(79652133, 88786612, 95234422, 99336996, 100764257, 105189366, 121472911,
119542332, 119862125, 120657508, 124405340, 125345113, 132920670, 137487222)
y <- c(211363, 217291, 226623, 230039, 239212, 247339, 255805, 264450, 282990,
304316, 314135, 313509, 331670, 348884)
te_result <- transfer_entropy(x, y, nboot = 100)
te_result
Shannon's entropy on 1 core with 100 shuffles.
x and y have length 14 (0 NAs removed)
[calculate] X->Y transfer entropy
[calculate] Y->X transfer entropy
[bootstrap] 100 times
Error in sample.int(length(x), size, replace, prob) :
invalid first argument
Any idea? Is that a bug, or am I missing something?