@Test public void testLogP() { System.out.println("logP"); FDistribution instance = new FDistribution(10, 20); instance.rand(); assertEquals(-12.74989, instance.logp(0.01), 1E-5); assertEquals(-4.196589, instance.logp(0.1), 1E-6); assertEquals(-2.121800, instance.logp(0.2), 1E-6); assertEquals(-0.374138, instance.logp(0.5), 1E-6); assertEquals(-0.3363727, instance.logp(1), 1E-7); assertEquals(-11.92045, instance.logp(10), 1E-5); }
@Override public double logp(double x) { if (x <= 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } return (0.5 * nu1 - 1.0) * Math.log(x) - 0.5 * (nu1 + nu2) * Math.log(nu2 + nu1 * x) + fac; }
FDistribution extends AbstractDistribution { @Override public double logp(double x) { if (x <= 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } return (0.5 * nu1 - 1.0) * Math.log(x) - 0.5 * (nu1 + nu2) * Math.log(nu2 + nu1 * x) + fac; } }
FDistribution extends AbstractDistribution { @Override public double logp(double x) { if (x <= 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } return (0.5 * nu1 - 1.0) * Math.log(x) - 0.5 * (nu1 + nu2) * Math.log(nu2 + nu1 * x) + fac; } FDistribution(int nu1, int nu2); }
FDistribution extends AbstractDistribution { @Override public double logp(double x) { if (x <= 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } return (0.5 * nu1 - 1.0) * Math.log(x) - 0.5 * (nu1 + nu2) * Math.log(nu2 + nu1 * x) + fac; } FDistribution(int nu1, int nu2); @Override int length(); @Override double mean(); @Override double variance(); @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); }
FDistribution extends AbstractDistribution { @Override public double logp(double x) { if (x <= 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } return (0.5 * nu1 - 1.0) * Math.log(x) - 0.5 * (nu1 + nu2) * Math.log(nu2 + nu1 * x) + fac; } FDistribution(int nu1, int nu2); @Override int length(); @Override double mean(); @Override double variance(); @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); final int nu1; final int nu2; }