I've been recently trying to reproduce the results of the following article with JIDT:
But unfortunately I'm receiving very different results as I'm feeding the time series to the JIDT to calculate TE. I would really be thankful if anyone lets me know what I am doing wrong.
On page 24 you can see some graphs which are plotted using the author's code. I used the time series and the default settings of "k_HISTORY" , "k_TAU" , "I_HISTORY" , "I_TAU" and noise "NOISE_LEVEL_TO_ADD" and this was the result.
def javCalcPTE (dataRaw , src , dest):
# Add JIDT jar library to the path
jarLocation = "D:\AmirHossein\jlizier-jidt-64a7a80\infodynamics.jar"
# Start the JVM (add the "-Xmx" option with say 1024M if you get crashes due to not enough memory space)
if(not isJVMStarted()):
startJVM(getDefaultJVMPath(), "-ea", "-Djava.class.path=" + jarLocation)
# As numpy array:
data = np.array(dataRaw)
# 1. Construct the calculator:
calcClass = JPackage("infodynamics.measures.continuous.kraskov").TransferEntropyCalculatorKraskov
calc = calcClass()
# 2. Set any properties to non-default values:
# No properties were set to non-default values
source = data[:,src]
destination = data[:,dest]
# 3. Initialise the calculator for (re-)use:
calc.initialise()
# 4. Supply the sample data:
calc.setObservations(source, destination)
# 5. Compute the estimate:
result = calc.computeAverageLocalOfObservations()
return result
Also as someone recommended I used the matrix for of TE and the difference of the target time series as target, i.e.
# Compute for all pairs:
for s in range(3):
for d in range(3):
# For each source-dest pair:
if (s == d):
continue
source = data[:-1 , s]
destination = np.diff(data[: , d])
# 3. Initialise the calculator for (re-)use:
calc.initialise()
# 4. Supply the sample data:
calc.setObservations(source, destination)
# 5. Compute the estimate:
PTE[s][d] = calc.computeAverageLocalOfObservations()
#print (PTE[s][d])
#print (PTE)
return PTE
These were the results I was comparing with the TE plot (4th plot on the left).
P.S: Using the code on the thesis, I gained the same results as shown in page 24 of the thesis.