List of utility methods to do List Median
double | calcMedian(List calc Median double result = Double.NaN; final int count = end - start + 1; if (count > 0) { if (count % 2 == 1) { if (count > 1) { result = values.get(start + ((count - 1) / 2)).doubleValue(); } else { result = values.get(start).doubleValue(); ... |
double | calculateMAD(List extends Number> values, Number median) calculate MAD double result = Double.NaN; if (values != null && median != null) { final List<Double> diffs = new ArrayList<Double>(values.size()); for (int i = 0; i < values.size(); i++) { diffs.add(Math.abs(values.get(i).doubleValue() - median.doubleValue())); Collections.sort(diffs); final int count = diffs.size(); ... |
double | calculateMedian(List Utility method to calculate the median of a given list of values. if (values == null || values.isEmpty()) { throw new IllegalStateException("Can not calculate median on empty list or null!"); if (values.size() == 1) { return values.get(0); double[] valueArray = toArray(values); return calculateMedian(valueArray); ... |
double | calculateMedian(List Calculates the median for a list of values ( Number objects).
double result = Double.NaN; if (values != null) { if (copyAndSort) { final List<Double> copy = new ArrayList<Double>(values); Collections.sort(copy); values = copy; result = calcMedian(values, 0, values.size() - 1); ... |
double | getGeneMedian(final List get Gene Median Collections.sort(doubleArray); Double median; if (doubleArray.size() == 1) return doubleArray.get(0); int center = doubleArray.size() / 2; if (doubleArray.size() % 2 == 0) { final double a, b; a = doubleArray.get(center); ... |
double | getMedian(Collection Find the median of a Collection of Doubles. ArrayList<Double> sortList = new ArrayList<Double>(list); Collections.sort(sortList); int size = list.size(); double v1 = ((Double) sortList.get((size - 1) / 2)).doubleValue(); double v2 = ((Double) sortList.get(size / 2)).doubleValue(); return (v1 + v2) / 2; |
Object | getMedian(List get Median return orderStatisticSearch((int) Math.ceil(list.size() / 2), list); |
Double | getMedian(List Given a list of numbers returns the median of the of the list double median; Collections.sort(numbers); int size = numbers.size(); if (size % 2 != 0) { median = numbers.get(size / 2); } else { if (size != 1) { median = (numbers.get(size / 2) + numbers.get((size / 2) - 1)) / 2.0; ... |
double | getMedian(List get Median Collections.sort(results); if (results.size() % 2 == 0) return ((double) results.get(results.size() / 2) + (double) results.get(results.size() / 2 - 1)) / 2; else return (double) results.get(results.size() / 2); |
int | getMedianValue(List Gets the median value from a list of numbers. List<Integer> copy = new ArrayList<Integer>(nums); Collections.sort(copy); int numberOfValues = copy.size(); if (numberOfValues % 2 == 0) { int val1 = copy.get(numberOfValues / 2); int val2 = copy.get((numberOfValues - 2) / 2); return (val1 + val2) / 2; } else { ... |