public static double computeKSThreshold(final DoublesSketch sketch1,
                                           final DoublesSketch sketch2,
                                           final double tgtPvalue) {
    final double r1 = sketch1.getRetainedItems();
    final double r2 = sketch2.getRetainedItems();
    final double alpha = tgtPvalue;
    final double alphaFactor = Math.sqrt(-0.5 * Math.log(0.5 * alpha));
    final double deltaAreaThreshold = alphaFactor * Math.sqrt((r1 + r2) / (r1 * r2));
    final double eps1 = Util.getNormalizedRankError(sketch1.getK(), false);
    final double eps2 = Util.getNormalizedRankError(sketch2.getK(), false);

    final double adjDeltaAreaThreshold = deltaAreaThreshold + eps1 + eps2;
    return adjDeltaAreaThreshold;
  }
public static double computeKSThreshold ( final DoublesSketch sketch1 , final DoublesSketch sketch2 , final double tgtPvalue ) { final double r1 = sketch1 . getRetainedItems ( ) ; final double r2 = sketch2 . getRetainedItems ( ) ; final double alpha = tgtPvalue ; final double alphaFactor = Math . sqrt ( - 0.5 * Math . log ( 0.5 * alpha ) ) ; final double deltaAreaThreshold = alphaFactor * Math . sqrt ( ( r1 + r2 ) / ( r1 * r2 ) ) ; final double eps1 = Util . getNormalizedRankError ( sketch1 . getK ( ) , false ) ; final double eps2 = Util . getNormalizedRankError ( sketch2 . getK ( ) , false ) ; final double adjDeltaAreaThreshold = deltaAreaThreshold + eps1 + eps2 ; return adjDeltaAreaThreshold ; }
Computes the adjusted delta area threshold for the
{@link #kolmogorovSmirnovTest(DoubleSketch, DoubleSketch, double) Kolmogorov-Smirnov Test}
method.
This adjusts the computed threshold by the error epsilons of the two given sketches.
See <a href="https://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test">Kolmogorov–Smirnov Test</a>
@param sketch1 Input DoubleSketch 1
@param sketch2 Input DoubleSketch 2
@param tgtPvalue Target p-value. Typically .001 to .1, e.g., .05.
@return the adjusted threshold to be compared with the raw delta area.