public void interpolation_sample_9999_100_expected_shortfall() { Function<Double, Double> func = new Function<Double, Double>() { @Override public Double apply(Double level) { return QUANTILE_SAMPLE_INTERPOLATION.quantileWithExtrapolationFromUnsorted(level, UNSORTED_100); } }; double expectedShortfallExpected = INTEG.integrate(func, TOL_INTEGRAL, LEVEL5) / LEVEL5; double expectedShortfallComputed = QUANTILE_SAMPLE_INTERPOLATION.expectedShortfallFromUnsorted(LEVEL5, UNSORTED_100); assertEquals(expectedShortfallComputed, expectedShortfallExpected, TOL_INTEGRAL); }
public void interpolation_sample_0001_100_expected_shortfall() { double expectedShortfallExpected = SORTED_100.get(0); double expectedShortfallComputed = QUANTILE_SAMPLE_INTERPOLATION.expectedShortfallFromUnsorted(LEVEL4, UNSORTED_100); assertEquals(expectedShortfallComputed, expectedShortfallExpected, TOL); }
public void interpolation_sample_095_100_expected_shortfall() { Function<Double, Double> func = new Function<Double, Double>() { @Override public Double apply(Double level) { return QUANTILE_SAMPLE_INTERPOLATION.quantileWithExtrapolationFromUnsorted(level, UNSORTED_100); } }; double expectedShortfallExpected = INTEG.integrate(func, TOL_INTEGRAL, LEVEL3) / LEVEL3; double expectedShortfallComputed = QUANTILE_SAMPLE_INTERPOLATION.expectedShortfallFromUnsorted( LEVEL3, UNSORTED_100); assertEquals(expectedShortfallComputed, expectedShortfallExpected, TOL_INTEGRAL); }
public void interpolation_sample_095_123_expected_shortfall() { Function<Double, Double> func = new Function<Double, Double>() { @Override public Double apply(Double level) { return QUANTILE_SAMPLE_INTERPOLATION.quantileWithExtrapolationFromUnsorted(level, UNSORTED_123); } }; double expectedShortfallExpected = INTEG.integrate(func, TOL_INTEGRAL, LEVEL3) / LEVEL3; double expectedShortfallComputed = QUANTILE_SAMPLE_INTERPOLATION.expectedShortfallFromUnsorted( LEVEL3, UNSORTED_123); assertEquals(expectedShortfallComputed, expectedShortfallExpected, TOL_INTEGRAL); }
public void interpolation_wrong_expectedShortfall_1() { assertThrowsIllegalArg(() -> QUANTILE_SAMPLE_INTERPOLATION.expectedShortfallFromUnsorted(1.01, UNSORTED_100)); }
public void interpolation_wrong_expectedShortfall_0() { assertThrowsIllegalArg(() -> QUANTILE_SAMPLE_INTERPOLATION.expectedShortfallFromUnsorted(0.0, UNSORTED_100)); }