1
$\begingroup$

I was reading about Transfer Entropy and came across this package: https://cran.r-project.org/web/packages/TransferEntropy/TransferEntropy.pdf

The code in the package:

## Intitialize two vectors of length 10001
X <- rep(0,10000+1)
Y <- rep(0,10000+1)
## Create two linked random processes. Y is independent of X,
## while X is determined in part by the previous values of Y.
for(i in 1:10000){
 Y[i+1] <- 0.6*Y[i] + rnorm(1)
 X[i+1] <- 0.4*X[i] + 0.6*Y[i] + rnorm(1)
}
X <- X[101:10000]
Y <- Y[101:10000]
## Compute the TE from Y to X
computeTE(X,Y,3,1,"MI_diff") ## should be circa 0.16 
## and from X to Y
computeTE(Y,X,3,1,"MI_diff") ## should be circa zero
computeTE(X,Y,3,1,"Correlation",0.4)
computeTE(Y,X,3,1,"Correlation",0.4)

I tried the example at the end of the package and got similar results as stated in the example. Then I created my own example to see the results, this is what I did

## Intitialize two vectors of length 10001
X <- c(1.5, rep(0,10000+1))
Y <- c(1.2, rep(0,10000+1))

for(i in 1:10000){
 Y[i+1] <- 0.6*Y[i]
 X[i+1] <- 0.4*X[i] + 0.6*Y[i]
}

X <- X[101:10000]
Y <- Y[101:10000]

plot(X,Y)
## Compute the TE from Y to X
computeTE(X,Y,3,1,"MI_diff")  ## should be circa 0.16
## and from X to Y
computeTE(Y,X,3,1,"MI_diff") 

But I get this error : Points with same coordinates in the X tree (add noise).

Now my question is that, how does noise affect the result i.e the value of TE? Is it necessary that every value in the random variable should be unique?

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.