@Test public void fractionOfData() throws Exception { Double output = testStats95.fractionOfData(5, 2, 4, 3, -0.5); assertThat("lower bound: need more data", output, IsCloseTo.closeTo(0.585715, precision)); output = testStats95.fractionOfData(5, 2, 4, 3, -0.7); assertThat("lower bound: have enough data", output, IsCloseTo.closeTo(1.148001, precision)); output = testStats95.fractionOfData(5, 2, 4, 3, 0.2); assertThat("upper bound: need more data", output, IsCloseTo.closeTo(0.0937144, precision)); output = testStats95.fractionOfData(5, 2, 4, 3, 0.8); assertThat("upper bound: have enough data", output, IsCloseTo.closeTo(1.49943, precision)); DistinguishableEffectSize output2 = testStats95.distinguishableEffectSizes(5, 2, 4, 3); output = testStats95.fractionOfData(5, 2, 4, 3, output2.getNegativeEffectSize()); assertThat("lower bound: boundary", output, IsCloseTo.closeTo(1.0, precision)); output = testStats95.fractionOfData(5, 2, 4, 3, output2.getPositiveEffectSize()); assertThat("upper bound: boundary", output, IsCloseTo.closeTo(1.0, precision)); output = testStats95.fractionOfData(0, 0, 2, 1, 0.1); assertThat("0 impressions returns 0", output, IsCloseTo.closeTo(0.0, precision)); output = testStats95.fractionOfData(2, 1, 0, 0, 0.1); assertThat("0 impressions returns 0", output, IsCloseTo.closeTo(0.0, precision)); output = testStats95.fractionOfData(0, 0, 0, 0, 0.1); assertThat("0 impressions returns NaN", output, is(NaN)); }
@Override public Double fractionOfData(final long number_impressions_1, final long number_actions_1, final long number_impressions_2, final long number_actions_2, final double effect_size) { SymmetricInputValidation(number_impressions_1, number_actions_1, number_impressions_2, number_actions_2); if (effect_size < -1.0 || effect_size > 1.0) { throw new IllegalArgumentException("Effect size must be in the interval [-1, 1]."); } double zval = DecisionAdjuster.scaledZ(confidenceLevel, maxDecisions); double pooled_rate = 1.0 * (number_actions_1 + number_actions_2) / (number_impressions_1 + number_impressions_2); return 1 / (pooled_rate * (1 - pooled_rate) * (1.0 / number_impressions_1 + 1.0 / number_impressions_2) * zval * zval / effect_size / effect_size); }
NormalApproxSymMetric extends com.intuit.wasabi.analyticsobjects.metrics.NormalApproxMetric { @Override public Double fractionOfData(final long number_impressions_1, final long number_actions_1, final long number_impressions_2, final long number_actions_2, final double effect_size) { SymmetricInputValidation(number_impressions_1, number_actions_1, number_impressions_2, number_actions_2); if (effect_size < -1.0 || effect_size > 1.0) { throw new IllegalArgumentException("Effect size must be in the interval [-1, 1]."); } double zval = DecisionAdjuster.scaledZ(confidenceLevel, maxDecisions); double pooled_rate = 1.0 * (number_actions_1 + number_actions_2) / (number_impressions_1 + number_impressions_2); return 1 / (pooled_rate * (1 - pooled_rate) * (1.0 / number_impressions_1 + 1.0 / number_impressions_2) * zval * zval / effect_size / effect_size); } }
NormalApproxSymMetric extends com.intuit.wasabi.analyticsobjects.metrics.NormalApproxMetric { @Override public Double fractionOfData(final long number_impressions_1, final long number_actions_1, final long number_impressions_2, final long number_actions_2, final double effect_size) { SymmetricInputValidation(number_impressions_1, number_actions_1, number_impressions_2, number_actions_2); if (effect_size < -1.0 || effect_size > 1.0) { throw new IllegalArgumentException("Effect size must be in the interval [-1, 1]."); } double zval = DecisionAdjuster.scaledZ(confidenceLevel, maxDecisions); double pooled_rate = 1.0 * (number_actions_1 + number_actions_2) / (number_impressions_1 + number_impressions_2); return 1 / (pooled_rate * (1 - pooled_rate) * (1.0 / number_impressions_1 + 1.0 / number_impressions_2) * zval * zval / effect_size / effect_size); } NormalApproxSymMetric(final double conf_level);  NormalApproxSymMetric(final double conf_level, final double max_decisions); }
NormalApproxSymMetric extends com.intuit.wasabi.analyticsobjects.metrics.NormalApproxMetric { @Override public Double fractionOfData(final long number_impressions_1, final long number_actions_1, final long number_impressions_2, final long number_actions_2, final double effect_size) { SymmetricInputValidation(number_impressions_1, number_actions_1, number_impressions_2, number_actions_2); if (effect_size < -1.0 || effect_size > 1.0) { throw new IllegalArgumentException("Effect size must be in the interval [-1, 1]."); } double zval = DecisionAdjuster.scaledZ(confidenceLevel, maxDecisions); double pooled_rate = 1.0 * (number_actions_1 + number_actions_2) / (number_impressions_1 + number_impressions_2); return 1 / (pooled_rate * (1 - pooled_rate) * (1.0 / number_impressions_1 + 1.0 / number_impressions_2) * zval * zval / effect_size / effect_size); } NormalApproxSymMetric(final double conf_level);  NormalApproxSymMetric(final double conf_level, final double max_decisions); @Override DistinguishableEffectSize distinguishableEffectSizes(final long number_impressions_1,
                                                                final long number_actions_1,
                                                                final long number_impressions_2,
                                                                final long number_actions_2); @Override Double fractionOfData(final long number_impressions_1, final long number_actions_1,
                                 final long number_impressions_2, final long number_actions_2,
                                 final double effect_size); }
NormalApproxSymMetric extends com.intuit.wasabi.analyticsobjects.metrics.NormalApproxMetric { @Override public Double fractionOfData(final long number_impressions_1, final long number_actions_1, final long number_impressions_2, final long number_actions_2, final double effect_size) { SymmetricInputValidation(number_impressions_1, number_actions_1, number_impressions_2, number_actions_2); if (effect_size < -1.0 || effect_size > 1.0) { throw new IllegalArgumentException("Effect size must be in the interval [-1, 1]."); } double zval = DecisionAdjuster.scaledZ(confidenceLevel, maxDecisions); double pooled_rate = 1.0 * (number_actions_1 + number_actions_2) / (number_impressions_1 + number_impressions_2); return 1 / (pooled_rate * (1 - pooled_rate) * (1.0 / number_impressions_1 + 1.0 / number_impressions_2) * zval * zval / effect_size / effect_size); } NormalApproxSymMetric(final double conf_level);  NormalApproxSymMetric(final double conf_level, final double max_decisions); @Override DistinguishableEffectSize distinguishableEffectSizes(final long number_impressions_1,
                                                                final long number_actions_1,
                                                                final long number_impressions_2,
                                                                final long number_actions_2); @Override Double fractionOfData(final long number_impressions_1, final long number_actions_1,
                                 final long number_impressions_2, final long number_actions_2,
                                 final double effect_size);  }