@Test public void testCdf() { System.out.println("cdf"); GeometricDistribution instance = new GeometricDistribution(0.3); instance.rand(); assertEquals(0.3, instance.cdf(0), 1E-6); assertEquals(0.51, instance.cdf(1), 1E-6); assertEquals(0.657, instance.cdf(2), 1E-6); assertEquals(0.7599, instance.cdf(3), 1E-6); assertEquals(0.83193, instance.cdf(4), 1E-6); assertEquals(0.9802267, instance.cdf(10), 1E-6); assertEquals(0.9994415, instance.cdf(20), 1E-6); }
@Override public double cdf(double k) { if (k < 0) { return 0.0; } else { return 1 - Math.pow(1 - p, k + 1); } }
GeometricDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { @Override public double cdf(double k) { if (k < 0) { return 0.0; } else { return 1 - Math.pow(1 - p, k + 1); } } }
GeometricDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { @Override public double cdf(double k) { if (k < 0) { return 0.0; } else { return 1 - Math.pow(1 - p, k + 1); } } GeometricDistribution(double p); }
GeometricDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { @Override public double cdf(double k) { if (k < 0) { return 0.0; } else { return 1 - Math.pow(1 - p, k + 1); } } GeometricDistribution(double p); static GeometricDistribution fit(int[] data); @Override int length(); @Override double mean(); @Override double variance(); @Override double sd(); @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); @Override DiscreteMixture.Component M(int[] x, double[] posteriori); }
GeometricDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { @Override public double cdf(double k) { if (k < 0) { return 0.0; } else { return 1 - Math.pow(1 - p, k + 1); } } GeometricDistribution(double p); static GeometricDistribution fit(int[] data); @Override int length(); @Override double mean(); @Override double variance(); @Override double sd(); @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); @Override DiscreteMixture.Component M(int[] x, double[] posteriori); final double p; }