Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java api for calculating Interquartile range [closed]

Tags:

java

Is there any java api for calculating interquartile range? I was wondering apache commons math library contains all the stats function like mean, median, mode but i could not find any thing for IQR.

like image 578
Rishikesh Dhokare Avatar asked Oct 31 '13 07:10

Rishikesh Dhokare


People also ask

What method can be used to find the interquartile range?

The two most common methods for calculating interquartile range are the exclusive and inclusive methods. The exclusive method excludes the median when identifying Q1 and Q3, while the inclusive method includes the median as a value in the data set in identifying the quartiles.

How do you find the Iqr in mathly?

To find the interquartile range (IQR), ​first find the median (middle value) of the lower and upper half of the data. These values are quartile 1 (Q1) and quartile 3 (Q3). The IQR is the difference between Q3 and Q1.

How do you find the upper and lower interquartile range?

Outliers are values below Q1-1.5(Q3-Q1) or above Q3+1.5(Q3-Q1) or equivalently, values below Q1-1.5 IQR or above Q3+1.5 IQR. These are referred to as Tukey fences. For the diastolic blood pressures, the lower limit is 64 - 1.5(77-64) = 44.5 and the upper limit is 77 + 1.5(77-64) = 96.5.


1 Answers

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

double[] data = // obtain data here
DescriptiveStatistics da = new DescriptiveStatistics(data);
double iqr = da.getPercentile(75) - da.getPercentile(25);
like image 135
mkrakhin Avatar answered Sep 22 '22 19:09

mkrakhin