@Test public void estimateMass(){ ContinuousDistribution distribution = new PoissonDistribution(5d); assertEquals(0.03368973d, DistributionUtil.probability(distribution, 1), 1e-8); assertEquals(0.14037390d, DistributionUtil.probability(distribution, 3), 1e-8); assertEquals(0.17546737d, DistributionUtil.probability(distribution, 5), 1e-8); assertEquals(0.10444486d, DistributionUtil.probability(distribution, 7), 1e-8); assertEquals(0.03626558d, DistributionUtil.probability(distribution, 9), 1e-8); }
static public double probability(ContinuousDistribution distribution, Number x){ if(distribution instanceof GaussianDistribution){ return probability((GaussianDistribution)distribution, x); } else if(distribution instanceof PoissonDistribution){ return probability((PoissonDistribution)distribution, x); } throw new UnsupportedElementException(distribution); }
DistributionUtil { static public double probability(ContinuousDistribution distribution, Number x){ if(distribution instanceof GaussianDistribution){ return probability((GaussianDistribution)distribution, x); } else if(distribution instanceof PoissonDistribution){ return probability((PoissonDistribution)distribution, x); } throw new UnsupportedElementException(distribution); } }
DistributionUtil { static public double probability(ContinuousDistribution distribution, Number x){ if(distribution instanceof GaussianDistribution){ return probability((GaussianDistribution)distribution, x); } else if(distribution instanceof PoissonDistribution){ return probability((PoissonDistribution)distribution, x); } throw new UnsupportedElementException(distribution); } private  DistributionUtil(); }
DistributionUtil { static public double probability(ContinuousDistribution distribution, Number x){ if(distribution instanceof GaussianDistribution){ return probability((GaussianDistribution)distribution, x); } else if(distribution instanceof PoissonDistribution){ return probability((PoissonDistribution)distribution, x); } throw new UnsupportedElementException(distribution); } private  DistributionUtil(); static double probability(ContinuousDistribution distribution, Number x); static double probability(GaussianDistribution gaussianDistribution, Number x); static double probability(PoissonDistribution poissonDistribution, Number x); }
DistributionUtil { static public double probability(ContinuousDistribution distribution, Number x){ if(distribution instanceof GaussianDistribution){ return probability((GaussianDistribution)distribution, x); } else if(distribution instanceof PoissonDistribution){ return probability((PoissonDistribution)distribution, x); } throw new UnsupportedElementException(distribution); } private  DistributionUtil(); static double probability(ContinuousDistribution distribution, Number x); static double probability(GaussianDistribution gaussianDistribution, Number x); static double probability(PoissonDistribution poissonDistribution, Number x);  }