@Test public void testP() { System.out.println("p"); GammaDistribution instance = new GammaDistribution(3, 2.1); instance.rand(); assertEquals(0.0, instance.p(-0.1), 1E-7); assertEquals(0.0, instance.p(0.0), 1E-7); assertEquals(0.0005147916, instance.p(0.1), 1E-7); assertEquals(0.03353553, instance.p(1.0), 1E-7); assertEquals(0.08332174, instance.p(2.0), 1E-7); assertEquals(0.1164485, instance.p(3.0), 1E-7); assertEquals(0.1285892, instance.p(4.0), 1E-7); assertEquals(0.04615759, instance.p(10), 1E-7); assertEquals(0.001578462, instance.p(20), 1E-7); assertEquals(3.036321e-05, instance.p(30), 1E-7); }
@Override public double p(double x) { if (x < 0) { return 0.0; } else { return Math.pow(x / theta, k - 1) * Math.exp(-x / theta) / thetaGammaK; } }
GammaDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double p(double x) { if (x < 0) { return 0.0; } else { return Math.pow(x / theta, k - 1) * Math.exp(-x / theta) / thetaGammaK; } } }
GammaDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double p(double x) { if (x < 0) { return 0.0; } else { return Math.pow(x / theta, k - 1) * Math.exp(-x / theta) / thetaGammaK; } } GammaDistribution(double shape, double scale); }
GammaDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double p(double x) { if (x < 0) { return 0.0; } else { return Math.pow(x / theta, k - 1) * Math.exp(-x / theta) / thetaGammaK; } } GammaDistribution(double shape, double scale); static GammaDistribution fit(double[] 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(double x); @Override double logp(double x); @Override double cdf(double x); @Override double quantile(double p); @Override Mixture.Component M(double[] x, double[] posteriori); }
GammaDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double p(double x) { if (x < 0) { return 0.0; } else { return Math.pow(x / theta, k - 1) * Math.exp(-x / theta) / thetaGammaK; } } GammaDistribution(double shape, double scale); static GammaDistribution fit(double[] 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(double x); @Override double logp(double x); @Override double cdf(double x); @Override double quantile(double p); @Override Mixture.Component M(double[] x, double[] posteriori); final double theta; final double k; }