You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The np.histogram() function inside nb_tie() is subject to floating point errors. This can cause a mismatch, at times, with the R and/or Matlab implementations of the code (e.g. see mannkendall/Matlab#3).
To Reproduce
In the case of nb_tie_test2_in.csv, the first problematic case is bin 147 with edges [0.205, 0.215).
The data contains the number 0.215, which should belong to bin 148 with edges [0.215, 0.225) (all bins are semi-open on the right in np.histogram()). But in my case, it falls into bin 147 because, when plotted fully, the edges are:
[0.20500000000000007, 0.21500000000000008). That is, floating point errors make the bin edge slightly larger than it should be.
Expected behavior
We cannot fix floating point errors ... but can we make this function more robust against them ? Maybe through the use of Decimals (https://docs.python.org/2/library/decimal.html) ?
The text was updated successfully, but these errors were encountered:
Describe the bug
The
np.histogram()
function insidenb_tie()
is subject to floating point errors. This can cause a mismatch, at times, with the R and/or Matlab implementations of the code (e.g. see mannkendall/Matlab#3).To Reproduce
In the case of
nb_tie_test2_in.csv
, the first problematic case is bin 147 with edges [0.205, 0.215).The data contains the number 0.215, which should belong to bin 148 with edges [0.215, 0.225) (all bins are semi-open on the right in
np.histogram()
). But in my case, it falls into bin 147 because, when plotted fully, the edges are:[0.20500000000000007, 0.21500000000000008). That is, floating point errors make the bin edge slightly larger than it should be.
Expected behavior
We cannot fix floating point errors ... but can we make this function more robust against them ? Maybe through the use of
Decimals
(https://docs.python.org/2/library/decimal.html) ?The text was updated successfully, but these errors were encountered: