@Override public Double apply(Double level) { return QUANTILE_SAMPLE1_INTERPOLATION.quantileWithExtrapolationFromUnsorted(level, UNSORTED_100); } };
@Override public Double apply(Double level) { return QUANTILE_SAMPLE1_INTERPOLATION.quantileWithExtrapolationFromUnsorted(level, UNSORTED_123); } };
public void regression_test4() { assertEquals( QUANTILE_SAMPLE1_INTERPOLATION.quantileWithExtrapolationFromUnsorted(LEVEL1, UNSORTED_100), 0.947663, TOL); assertEquals( QUANTILE_SAMPLE1_INTERPOLATION.quantileWithExtrapolationFromUnsorted(LEVEL2, UNSORTED_100), 0.791238, TOL); assertEquals( QUANTILE_SAMPLE1_INTERPOLATION.quantileWithExtrapolationFromUnsorted(LEVEL3, UNSORTED_100), 0.953485, TOL); assertEquals( QUANTILE_SAMPLE1_INTERPOLATION.quantileWithExtrapolationFromUnsorted(LEVEL4, UNSORTED_100), 0.0174, TOL); assertEquals( QUANTILE_SAMPLE1_INTERPOLATION.quantileWithExtrapolationFromUnsorted(LEVEL5, UNSORTED_100), 0.9948, TOL); }
public void interpolation_samplePlusOne_0001_100() { double quantileExpected = SORTED_100.get(0); // Java index start at 0. double quantileComputed = QUANTILE_SAMPLE1_INTERPOLATION.quantileWithExtrapolationFromUnsorted( LEVEL4, UNSORTED_100); assertEquals(quantileComputed, quantileExpected, TOL); }
public void interpolation_samplePlusOne_9999_100() { double quantileExpected = SORTED_100.get(SAMPLE_SIZE_100 - 1); // Java index start at 0. double quantileComputed = QUANTILE_SAMPLE1_INTERPOLATION.quantileWithExtrapolationFromUnsorted( LEVEL5, UNSORTED_100); assertEquals(quantileComputed, quantileExpected, TOL); }
public void interpolation_samplePlusOne_095_123() { double indexDouble = LEVEL3 * (SAMPLE_SIZE_123 + 1); 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 = (double) indexFloor / (double) (SAMPLE_SIZE_123 + 1); double pi1 = (double) indexCeil / (double) (SAMPLE_SIZE_123 + 1); double quantileExpected = quantileFloor + (LEVEL3 - pi) / (pi1 - pi) * (quantileCeil - quantileFloor); double quantileComputed = QUANTILE_SAMPLE1_INTERPOLATION.quantileFromUnsorted(LEVEL3, UNSORTED_123); assertEquals(quantileComputed, quantileExpected, TOL); double quantileExtrapComputed = QUANTILE_SAMPLE1_INTERPOLATION.quantileWithExtrapolationFromUnsorted( LEVEL3, UNSORTED_123); assertEquals(quantileExtrapComputed, quantileComputed); }