@Test public void testLogP() { System.out.println("logP"); ExponentialDistribution instance = new ExponentialDistribution(2.0); instance.rand(); assertTrue(Double.isInfinite(instance.logp(-0.1))); assertEquals(0.6931472, instance.logp(0.0), 1E-6); assertEquals(-1.306853, instance.logp(1.0), 1E-6); assertEquals(-3.306853, instance.logp(2.0), 1E-6); assertEquals(-5.306853, instance.logp(3.0), 1E-6); assertEquals(-7.306853, instance.logp(4.0), 1E-6); }
@Override public double logp(double x) { if (x < 0) { return Double.NEGATIVE_INFINITY; } else { return Math.log(lambda) - lambda * x; } }
ExponentialDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double logp(double x) { if (x < 0) { return Double.NEGATIVE_INFINITY; } else { return Math.log(lambda) - lambda * x; } } }
ExponentialDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double logp(double x) { if (x < 0) { return Double.NEGATIVE_INFINITY; } else { return Math.log(lambda) - lambda * x; } } ExponentialDistribution(double lambda); }
ExponentialDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double logp(double x) { if (x < 0) { return Double.NEGATIVE_INFINITY; } else { return Math.log(lambda) - lambda * x; } } ExponentialDistribution(double lambda); static ExponentialDistribution 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); }
ExponentialDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double logp(double x) { if (x < 0) { return Double.NEGATIVE_INFINITY; } else { return Math.log(lambda) - lambda * x; } } ExponentialDistribution(double lambda); static ExponentialDistribution 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 lambda; }