Page 1 of 1

bug in fnn.m ?

Posted: Wed Apr 23, 2014 07:50
by funnyfractals
Dear Marwan

There seems to be a bug in fnn when computing the distance in dimension m+1(Line 536)

When computing FNN ratio, the code given is

if is(2) < NX & idx(i) < NX & distance(2) < x_s
FNN(m,1) = FNN(m,1) + double((abs(x(idx(i)+m) - x(is(2)+m))/distance(2) > r));
cnt = cnt + 1;
end

My question, when moving to m+1 dimension, should you not add m*t and not just m, so i guess that above code should read

if is(2) < NX & idx(i) < NX & distance(2) < x_s
FNN(m,1) = FNN(m,1) + double((abs(x(idx(i)+m*t) - x(is(2)+m*t))/distance(2) > r));
cnt = cnt + 1;
end

Kindly confirm if I am missing something on this.

Re: bug in fnn.m ?

Posted: Thu May 1, 2014 22:19
by Norbert
Thanks for your careful checking of the code. You are probably right! In the original version, the embedding used a fixed delay of tau = 1. Therefore, the considered line is a relict of these days. But as you said, it should be corrected to consider the delay. I will check the code and improve it with the next release of the toolbox.

Best
Norbert