Java api for calculating interquartile range

Is there a java api for calculating the interquartile range? I was curious that the apache commons math library contains all the statistics functions, such as medium, median, mode, but I could not find anything for IQR.

+4
source share
1 answer

I'm not sure, but maybe you can use getPercentile from the DescriptiveStatistics of the Apache Commons Math class, as in the following code example.

double[] data = // obtain data here
DescriptiveStatistics da = new DescriptiveStatistics(data);
double iqr = da.getPercentile(75) - da.getPercentile(25);
+13
source

All Articles