@Test(expected = IllegalArgumentException.class) public void predictedDataNeededInputs3() throws Exception { testStats95.predictedDataNeeded(0.5, 0.0, 0.5, 0.05); }
@Override public Long predictedDataNeeded(final double rate, final double allocation_percent_1, final double allocation_percent_2, final double effect_size) { if (rate < 0.0 || rate > 1.0) { throw new IllegalArgumentException("Action rate must be in the interval [0, 1]."); } if (allocation_percent_1 <= 0.0 || allocation_percent_1 >= 1.0) { throw new IllegalArgumentException("Allocation percent must be in the interval (0, 1)."); } if (allocation_percent_2 <= 0.0 || allocation_percent_2 >= 1.0) { throw new IllegalArgumentException("Allocation percent must be in the interval (0, 1)."); } if (effect_size < -1.0 || effect_size > 1.0) { throw new IllegalArgumentException("Effect size must be in the interval [-1, 1]."); } if (Double.doubleToRawLongBits(effect_size) == 0L) { throw new IllegalArgumentException("Effect size must not equal 0"); } double zval = DecisionAdjuster.scaledZ(confidenceLevel, maxDecisions); return Math.round(rate * (1 - rate) * (1.0 / allocation_percent_1 + 1.0 / allocation_percent_2) * zval * zval / effect_size / effect_size); }
NormalApproxMetric extends BinomialMetric { @Override public Long predictedDataNeeded(final double rate, final double allocation_percent_1, final double allocation_percent_2, final double effect_size) { if (rate < 0.0 || rate > 1.0) { throw new IllegalArgumentException("Action rate must be in the interval [0, 1]."); } if (allocation_percent_1 <= 0.0 || allocation_percent_1 >= 1.0) { throw new IllegalArgumentException("Allocation percent must be in the interval (0, 1)."); } if (allocation_percent_2 <= 0.0 || allocation_percent_2 >= 1.0) { throw new IllegalArgumentException("Allocation percent must be in the interval (0, 1)."); } if (effect_size < -1.0 || effect_size > 1.0) { throw new IllegalArgumentException("Effect size must be in the interval [-1, 1]."); } if (Double.doubleToRawLongBits(effect_size) == 0L) { throw new IllegalArgumentException("Effect size must not equal 0"); } double zval = DecisionAdjuster.scaledZ(confidenceLevel, maxDecisions); return Math.round(rate * (1 - rate) * (1.0 / allocation_percent_1 + 1.0 / allocation_percent_2) * zval * zval / effect_size / effect_size); } }
NormalApproxMetric extends BinomialMetric { @Override public Long predictedDataNeeded(final double rate, final double allocation_percent_1, final double allocation_percent_2, final double effect_size) { if (rate < 0.0 || rate > 1.0) { throw new IllegalArgumentException("Action rate must be in the interval [0, 1]."); } if (allocation_percent_1 <= 0.0 || allocation_percent_1 >= 1.0) { throw new IllegalArgumentException("Allocation percent must be in the interval (0, 1)."); } if (allocation_percent_2 <= 0.0 || allocation_percent_2 >= 1.0) { throw new IllegalArgumentException("Allocation percent must be in the interval (0, 1)."); } if (effect_size < -1.0 || effect_size > 1.0) { throw new IllegalArgumentException("Effect size must be in the interval [-1, 1]."); } if (Double.doubleToRawLongBits(effect_size) == 0L) { throw new IllegalArgumentException("Effect size must not equal 0"); } double zval = DecisionAdjuster.scaledZ(confidenceLevel, maxDecisions); return Math.round(rate * (1 - rate) * (1.0 / allocation_percent_1 + 1.0 / allocation_percent_2) * zval * zval / effect_size / effect_size); } NormalApproxMetric(final double conf_level);  NormalApproxMetric(final double conf_level, final double max_decisions); }
NormalApproxMetric extends BinomialMetric { @Override public Long predictedDataNeeded(final double rate, final double allocation_percent_1, final double allocation_percent_2, final double effect_size) { if (rate < 0.0 || rate > 1.0) { throw new IllegalArgumentException("Action rate must be in the interval [0, 1]."); } if (allocation_percent_1 <= 0.0 || allocation_percent_1 >= 1.0) { throw new IllegalArgumentException("Allocation percent must be in the interval (0, 1)."); } if (allocation_percent_2 <= 0.0 || allocation_percent_2 >= 1.0) { throw new IllegalArgumentException("Allocation percent must be in the interval (0, 1)."); } if (effect_size < -1.0 || effect_size > 1.0) { throw new IllegalArgumentException("Effect size must be in the interval [-1, 1]."); } if (Double.doubleToRawLongBits(effect_size) == 0L) { throw new IllegalArgumentException("Effect size must not equal 0"); } double zval = DecisionAdjuster.scaledZ(confidenceLevel, maxDecisions); return Math.round(rate * (1 - rate) * (1.0 / allocation_percent_1 + 1.0 / allocation_percent_2) * zval * zval / effect_size / effect_size); } NormalApproxMetric(final double conf_level);  NormalApproxMetric(final double conf_level, final double max_decisions); @Override Estimate estimateRate(final long number_impressions, final long number_actions); @Override Estimate estimateRateDifference(final long number_impressions_1, final long number_actions_1,
                                           final long number_impressions_2, final long number_actions_2); @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); @Override Long predictedDataNeeded(final double rate, final double allocation_percent_1,
                                    final double allocation_percent_2, final double effect_size); }
NormalApproxMetric extends BinomialMetric { @Override public Long predictedDataNeeded(final double rate, final double allocation_percent_1, final double allocation_percent_2, final double effect_size) { if (rate < 0.0 || rate > 1.0) { throw new IllegalArgumentException("Action rate must be in the interval [0, 1]."); } if (allocation_percent_1 <= 0.0 || allocation_percent_1 >= 1.0) { throw new IllegalArgumentException("Allocation percent must be in the interval (0, 1)."); } if (allocation_percent_2 <= 0.0 || allocation_percent_2 >= 1.0) { throw new IllegalArgumentException("Allocation percent must be in the interval (0, 1)."); } if (effect_size < -1.0 || effect_size > 1.0) { throw new IllegalArgumentException("Effect size must be in the interval [-1, 1]."); } if (Double.doubleToRawLongBits(effect_size) == 0L) { throw new IllegalArgumentException("Effect size must not equal 0"); } double zval = DecisionAdjuster.scaledZ(confidenceLevel, maxDecisions); return Math.round(rate * (1 - rate) * (1.0 / allocation_percent_1 + 1.0 / allocation_percent_2) * zval * zval / effect_size / effect_size); } NormalApproxMetric(final double conf_level);  NormalApproxMetric(final double conf_level, final double max_decisions); @Override Estimate estimateRate(final long number_impressions, final long number_actions); @Override Estimate estimateRateDifference(final long number_impressions_1, final long number_actions_1,
                                           final long number_impressions_2, final long number_actions_2); @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); @Override Long predictedDataNeeded(final double rate, final double allocation_percent_1,
                                    final double allocation_percent_2, final double effect_size);  }