@Test public void testQuantile() { System.out.println("quantile"); BernoulliDistribution instance = new BernoulliDistribution(0.3); instance.rand(); assertEquals(0, instance.quantile(0), 1E-7); assertEquals(0, instance.quantile(0.7), 1E-7); assertEquals(1, instance.quantile(1), 1E-7); }
@Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } if (p <= 1 - this.p) { return 0; } else { return 1; } }
BernoulliDistribution extends DiscreteDistribution { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } if (p <= 1 - this.p) { return 0; } else { return 1; } } }
BernoulliDistribution extends DiscreteDistribution { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } if (p <= 1 - this.p) { return 0; } else { return 1; } } BernoulliDistribution(double p);  BernoulliDistribution(boolean[] data); }
BernoulliDistribution extends DiscreteDistribution { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } if (p <= 1 - this.p) { return 0; } else { return 1; } } BernoulliDistribution(double p);  BernoulliDistribution(boolean[] data); static BernoulliDistribution fit(int[] data); @Override int length(); @Override double mean(); @Override double variance(); @Override double entropy(); @Override String toString(); @Override double rand(); @Override double p(int k); @Override double logp(int k); @Override double cdf(double k); @Override double quantile(double p); }
BernoulliDistribution extends DiscreteDistribution { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } if (p <= 1 - this.p) { return 0; } else { return 1; } } BernoulliDistribution(double p);  BernoulliDistribution(boolean[] data); static BernoulliDistribution fit(int[] data); @Override int length(); @Override double mean(); @Override double variance(); @Override double entropy(); @Override String toString(); @Override double rand(); @Override double p(int k); @Override double logp(int k); @Override double cdf(double k); @Override double quantile(double p); final double p; final double q; }