@Test public void testCdf() { System.out.println("cdf"); PoissonDistribution instance = new PoissonDistribution(3.5); instance.rand(); assertEquals(0, instance.cdf(-1), 1E-7); assertEquals(0.03019738, instance.cdf(0), 1E-7); assertEquals(0.1358882, instance.cdf(1), 1E-7); assertEquals(0.3208472, instance.cdf(2), 1E-7); assertEquals(0.5366327, instance.cdf(3), 1E-7); assertEquals(0.725445, instance.cdf(4), 1E-6); assertEquals(0.9989806, instance.cdf(10), 1E-6); assertEquals(0.999999, instance.cdf(15), 1E-6); assertEquals(1.000000, instance.cdf(20), 1E-6); }
@Override public double cdf(double k) { if (lambda == 0) { if (k >= 0) { return 1.0; } else { return 0.0; } } if (k < 0) { return 0.0; } else { return Gamma.regularizedUpperIncompleteGamma(Math.floor(k + 1), lambda); } }
PoissonDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { @Override public double cdf(double k) { if (lambda == 0) { if (k >= 0) { return 1.0; } else { return 0.0; } } if (k < 0) { return 0.0; } else { return Gamma.regularizedUpperIncompleteGamma(Math.floor(k + 1), lambda); } } }
PoissonDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { @Override public double cdf(double k) { if (lambda == 0) { if (k >= 0) { return 1.0; } else { return 0.0; } } if (k < 0) { return 0.0; } else { return Gamma.regularizedUpperIncompleteGamma(Math.floor(k + 1), lambda); } } PoissonDistribution(double lambda); }
PoissonDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { @Override public double cdf(double k) { if (lambda == 0) { if (k >= 0) { return 1.0; } else { return 0.0; } } if (k < 0) { return 0.0; } else { return Gamma.regularizedUpperIncompleteGamma(Math.floor(k + 1), lambda); } } PoissonDistribution(double lambda); static PoissonDistribution fit(int[] data); @Override int length(); @Override double mean(); @Override double variance(); @Override double sd(); @Override double entropy(); @Override String toString(); @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); @Override double rand(); }
PoissonDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { @Override public double cdf(double k) { if (lambda == 0) { if (k >= 0) { return 1.0; } else { return 0.0; } } if (k < 0) { return 0.0; } else { return Gamma.regularizedUpperIncompleteGamma(Math.floor(k + 1), lambda); } } PoissonDistribution(double lambda); static PoissonDistribution fit(int[] data); @Override int length(); @Override double mean(); @Override double variance(); @Override double sd(); @Override double entropy(); @Override String toString(); @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); @Override double rand(); final double lambda; }