@Test public void testP() { System.out.println("p"); GeometricDistribution instance = new GeometricDistribution(0.3); instance.rand(); assertEquals(0.3, instance.p(0), 1E-6); assertEquals(0.21, instance.p(1), 1E-6); assertEquals(0.147, instance.p(2), 1E-6); assertEquals(0.1029, instance.p(3), 1E-6); assertEquals(0.07203, instance.p(4), 1E-6); assertEquals(0.008474257, instance.p(10), 1E-6); assertEquals(0.0002393768, instance.p(20), 1E-6); }
@Override public double p(int k) { if (k < 0) { return 0.0; } else { return Math.pow(1 - p, k) * p; } }
GeometricDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { @Override public double p(int k) { if (k < 0) { return 0.0; } else { return Math.pow(1 - p, k) * p; } } }
GeometricDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { @Override public double p(int k) { if (k < 0) { return 0.0; } else { return Math.pow(1 - p, k) * p; } } GeometricDistribution(double p); }
GeometricDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { @Override public double p(int k) { if (k < 0) { return 0.0; } else { return Math.pow(1 - p, k) * p; } } 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 p(int k) { if (k < 0) { return 0.0; } else { return Math.pow(1 - p, k) * p; } } 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; }