@Test public void testLogP() { System.out.println("logP"); ChiSquareDistribution instance = new ChiSquareDistribution(20); instance.rand(); assertEquals(Math.log(2.559896e-18), instance.logp(0.1), 1E-5); assertEquals(Math.log(1.632262e-09), instance.logp(1), 1E-5); assertEquals(Math.log(0.01813279), instance.logp(10), 1E-5); assertEquals(Math.log(0.0625550), instance.logp(20), 1E-5); assertEquals(Math.log(7.2997e-05), instance.logp(50), 1E-5); assertEquals(Math.log(5.190544e-13), instance.logp(100), 1E-5); }
@Override public double logp(double x) { if (x <= 0) { return Double.NEGATIVE_INFINITY; } else { return -0.5 * (x - (nu - 2.0) * Math.log(x)) - fac; } }
ChiSquareDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double logp(double x) { if (x <= 0) { return Double.NEGATIVE_INFINITY; } else { return -0.5 * (x - (nu - 2.0) * Math.log(x)) - fac; } } }
ChiSquareDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double logp(double x) { if (x <= 0) { return Double.NEGATIVE_INFINITY; } else { return -0.5 * (x - (nu - 2.0) * Math.log(x)) - fac; } } ChiSquareDistribution(int nu); }
ChiSquareDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double logp(double x) { if (x <= 0) { return Double.NEGATIVE_INFINITY; } else { return -0.5 * (x - (nu - 2.0) * Math.log(x)) - fac; } } ChiSquareDistribution(int nu); @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); }
ChiSquareDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double logp(double x) { if (x <= 0) { return Double.NEGATIVE_INFINITY; } else { return -0.5 * (x - (nu - 2.0) * Math.log(x)) - fac; } } ChiSquareDistribution(int nu); @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 int nu; }