@Test public void testQuantile() { System.out.println("quantile"); FDistribution instance = new FDistribution(10, 20); instance.rand(); assertEquals(0.2269944, instance.quantile(0.01), 1E-7); assertEquals(0.4543918, instance.quantile(0.1), 1E-7); assertEquals(0.5944412, instance.quantile(0.2), 1E-7); assertEquals(0.9662639, instance.quantile(0.5), 1E-7); assertEquals(3.368186, instance.quantile(0.99), 1E-6); assertEquals(7.180539, instance.quantile(0.9999), 1E-6); }
@Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } double x = Beta.inverseRegularizedIncompleteBetaFunction(0.5 * nu1, 0.5 * nu2, p); return nu2 * x / (nu1 * (1.0 - x)); }
FDistribution extends AbstractDistribution { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } double x = Beta.inverseRegularizedIncompleteBetaFunction(0.5 * nu1, 0.5 * nu2, p); return nu2 * x / (nu1 * (1.0 - x)); } }
FDistribution extends AbstractDistribution { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } double x = Beta.inverseRegularizedIncompleteBetaFunction(0.5 * nu1, 0.5 * nu2, p); return nu2 * x / (nu1 * (1.0 - x)); } FDistribution(int nu1, int nu2); }
FDistribution extends AbstractDistribution { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } double x = Beta.inverseRegularizedIncompleteBetaFunction(0.5 * nu1, 0.5 * nu2, p); return nu2 * x / (nu1 * (1.0 - x)); } 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 quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } double x = Beta.inverseRegularizedIncompleteBetaFunction(0.5 * nu1, 0.5 * nu2, p); return nu2 * x / (nu1 * (1.0 - x)); } 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; }