@Test public void testPoissonDistribution() { System.out.println("PoissonDistribution"); MathEx.setSeed(19650218); PoissonDistribution instance = new PoissonDistribution(5.5); int[] data = instance.randi(1000); PoissonDistribution est = PoissonDistribution.fit(data); assertEquals(5.52, est.lambda, 1E-2); }
public PoissonDistribution(double lambda) { if (lambda < 0.0) { throw new IllegalArgumentException("Invalid lambda: " + lambda); } this.lambda = lambda; entropy = (Math.log(2 * Math.PI * Math.E) + Math.log(lambda)) / 2 - 1 / (12 * lambda) - 1 / (24 * lambda * lambda) - 19 / (360 * lambda * lambda * lambda); }
PoissonDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { public PoissonDistribution(double lambda) { if (lambda < 0.0) { throw new IllegalArgumentException("Invalid lambda: " + lambda); } this.lambda = lambda; entropy = (Math.log(2 * Math.PI * Math.E) + Math.log(lambda)) / 2 - 1 / (12 * lambda) - 1 / (24 * lambda * lambda) - 19 / (360 * lambda * lambda * lambda); } }
PoissonDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { public PoissonDistribution(double lambda) { if (lambda < 0.0) { throw new IllegalArgumentException("Invalid lambda: " + lambda); } this.lambda = lambda; entropy = (Math.log(2 * Math.PI * Math.E) + Math.log(lambda)) / 2 - 1 / (12 * lambda) - 1 / (24 * lambda * lambda) - 19 / (360 * lambda * lambda * lambda); } PoissonDistribution(double lambda); }
PoissonDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { public PoissonDistribution(double lambda) { if (lambda < 0.0) { throw new IllegalArgumentException("Invalid lambda: " + lambda); } this.lambda = lambda; entropy = (Math.log(2 * Math.PI * Math.E) + Math.log(lambda)) / 2 - 1 / (12 * lambda) - 1 / (24 * lambda * lambda) - 19 / (360 * lambda * lambda * 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 { public PoissonDistribution(double lambda) { if (lambda < 0.0) { throw new IllegalArgumentException("Invalid lambda: " + lambda); } this.lambda = lambda; entropy = (Math.log(2 * Math.PI * Math.E) + Math.log(lambda)) / 2 - 1 / (12 * lambda) - 1 / (24 * lambda * lambda) - 19 / (360 * lambda * lambda * 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; }