@Test public void testCdf() { System.out.println("cdf"); BernoulliDistribution instance = new BernoulliDistribution(0.3); instance.rand(); assertEquals(0.7, instance.cdf(0), 1E-7); assertEquals(1.0, instance.cdf(1), 1E-7); }
@Override public double cdf(double k) { if (k < 0) { return 0.0; } else if (k == 0) { return q; } else { return 1.0; } }
BernoulliDistribution extends DiscreteDistribution { @Override public double cdf(double k) { if (k < 0) { return 0.0; } else if (k == 0) { return q; } else { return 1.0; } } }
BernoulliDistribution extends DiscreteDistribution { @Override public double cdf(double k) { if (k < 0) { return 0.0; } else if (k == 0) { return q; } else { return 1.0; } } BernoulliDistribution(double p);  BernoulliDistribution(boolean[] data); }
BernoulliDistribution extends DiscreteDistribution { @Override public double cdf(double k) { if (k < 0) { return 0.0; } else if (k == 0) { return q; } else { return 1.0; } } 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 cdf(double k) { if (k < 0) { return 0.0; } else if (k == 0) { return q; } else { return 1.0; } } 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; }