[
https://issues.apache.org/jira/browse/MATH-1129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14033980#comment-14033980
]
Gilles edited comment on MATH-1129 at 6/17/14 4:25 PM:
-------------------------------------------------------
Actually, the standard {{java.util.Arrays}} class has the needed functionality
(a method for sorting part of an array in place).
The Javadoc indicates that it is a tuned quicksort, while the function in CM is
called "insertionSort".
I'd rather use the JDK one, and remove the "local" sort. Any objection?
was (Author: erans):
Actually, the standard {{java.util.Arrays}} class has the needed functionality
(a method for sorting part of an array in place).
I'll rather use it and remove the "local" sort.
> Percentile Computation errs
> ---------------------------
>
> Key: MATH-1129
> URL: https://issues.apache.org/jira/browse/MATH-1129
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.2
> Environment: Java 1.8.0
> Reporter: Carl Witt
>
> In the following test, the 75th percentile is _smaller_ than the 25th
> percentile, leaving me with a negative interquartile range.
> {code:title=Bar.java|borderStyle=solid}
> @Test public void negativePercentiles(){
> double[] data = new double[]{
> -0.012086732064244697,
> -0.24975668704012527,
> 0.5706168483164684,
> -0.322111769955327,
> 0.24166759508327315,
> Double.NaN,
> 0.16698443218942854,
> -0.10427763937565114,
> -0.15595963093172435,
> -0.028075857595882995,
> -0.24137994506058857,
> 0.47543170476574426,
> -0.07495595384947631,
> 0.37445697625436497,
> -0.09944199541668033
> };
> DescriptiveStatistics descriptiveStatistics = new
> DescriptiveStatistics(data);
> double threeQuarters = descriptiveStatistics.getPercentile(75);
> double oneQuarter = descriptiveStatistics.getPercentile(25);
> double IQR = threeQuarters - oneQuarter;
>
> System.out.println(String.format("25th percentile %s 75th percentile
> %s", oneQuarter, threeQuarters ));
>
> assert IQR >= 0;
>
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)