@Override public Double apply(Double level) { return QUANTILE_MIDWAY_INTERPOLATION.quantileWithExtrapolationFromUnsorted(level, UNSORTED_123); } };
@Override public Double apply(Double level) { return QUANTILE_MIDWAY_INTERPOLATION.quantileWithExtrapolationFromUnsorted(level, UNSORTED_100); } };
@Override public Double apply(Double level) { return QUANTILE_MIDWAY_INTERPOLATION.quantileWithExtrapolationFromUnsorted(level, UNSORTED_100); } };
public void regression_test3() { assertEquals( QUANTILE_MIDWAY_INTERPOLATION.quantileWithExtrapolationFromUnsorted(LEVEL1, UNSORTED_100), 0.9434, TOL); assertEquals( QUANTILE_MIDWAY_INTERPOLATION.quantileWithExtrapolationFromUnsorted(LEVEL2, UNSORTED_100), 0.78487, TOL); assertEquals( QUANTILE_MIDWAY_INTERPOLATION.quantileWithExtrapolationFromUnsorted(LEVEL3, UNSORTED_100), 0.95335, TOL); assertEquals( QUANTILE_MIDWAY_INTERPOLATION.quantileWithExtrapolationFromUnsorted(LEVEL4, UNSORTED_100), 0.0174, TOL); assertEquals( QUANTILE_MIDWAY_INTERPOLATION.quantileWithExtrapolationFromUnsorted(LEVEL5, UNSORTED_100), 0.9948, TOL); }
public void interpolation_midway_9999_100() { double quantileExpected = SORTED_100.get(SAMPLE_SIZE_100 - 1); // Java index start at 0. double quantileComputed = QUANTILE_MIDWAY_INTERPOLATION.quantileWithExtrapolationFromUnsorted( LEVEL5, UNSORTED_100); assertEquals(quantileComputed, quantileExpected, TOL); }
public void interpolation_midway_0001_100() { double quantileExpected = SORTED_100.get(0); // Java index start at 0. double quantileComputed = QUANTILE_MIDWAY_INTERPOLATION.quantileWithExtrapolationFromUnsorted( LEVEL4, UNSORTED_100); assertEquals(quantileComputed, quantileExpected, TOL); }
public void interpolation_midway_095_123() { double correction = 0.5; double indexDouble = LEVEL3 * SAMPLE_SIZE_123 + correction; int indexCeil = (int) Math.ceil(indexDouble); int indexFloor = (int) Math.floor(indexDouble); double quantileCeil = SORTED_123.get(indexCeil - 1); // Java index start at 0. double quantileFloor = SORTED_123.get(indexFloor - 1); double pi = (indexFloor - correction) / (double) SAMPLE_SIZE_123; double pi1 = (indexCeil - correction) / (double) SAMPLE_SIZE_123; double quantileExpected = quantileFloor + (LEVEL3 - pi) / (pi1 - pi) * (quantileCeil - quantileFloor); double quantileComputed = QUANTILE_MIDWAY_INTERPOLATION.quantileFromUnsorted(LEVEL3, UNSORTED_123); assertEquals(quantileComputed, quantileExpected, TOL); double quantileExtrapComputed = QUANTILE_MIDWAY_INTERPOLATION.quantileWithExtrapolationFromUnsorted( LEVEL3, UNSORTED_123); assertEquals(quantileExtrapComputed, quantileComputed); }