Closed lmoneta closed 5 days ago
Dear All. I tried to recreate the issue with Python
import numpy as np
import matplotlib.pyplot as plt
bins=np.linspace(0, 10, num=11)
a=np.array([2, 8])
a1=np.percentile(a, 50) #Median
plt.xticks([*range(0, 11, 1)], [*range(0, 11, 1)])
plt.axvline(a1)
plt.tight_layout()
plt.xlim([0, 10])
print(a1)
plt.hist(a, bins=bins)
plt.show()
According to the code above, the median is 5, not 5.5.
Calculating median with Octave/Matlab also gives the same result
median([2 8])
Which one is correct (the example from JIRA or my examples)?
The function
TH1::GetQuantile
is not returning in some case the correct result.There is already this JIRA issue open: https://sft.its.cern.ch/jira/browse/ROOT-8085
and not it is reported that gives wrong values for 0 and 100 percentiles, see:
https://root-forum.cern.ch/t/th1-getquantiles-gives-wrong-value-for-100-percentile/53284/3
See this example from JIRA:
and the one from the forum:
or all-together: