@Test public void testQuantile() { System.out.println("quantile"); BetaDistribution instance = new BetaDistribution(2, 5); instance.rand(); assertEquals(0.008255493, instance.quantile(0.001), 1E-5); assertEquals(0.09259526, instance.quantile(0.1), 1E-5); assertEquals(0.1398807, instance.quantile(0.2), 1E-5); assertEquals(0.1818035, instance.quantile(0.3), 1E-5); assertEquals(0.2225835, instance.quantile(0.4), 1E-5); assertEquals(0.26445, instance.quantile(0.5), 1E-5); assertEquals(0.5103163, instance.quantile(0.9), 1E-5); assertEquals(0.7056863, instance.quantile(0.99), 1E-5); }
@Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } return Beta.inverseRegularizedIncompleteBetaFunction(alpha, beta, p); }
BetaDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } return Beta.inverseRegularizedIncompleteBetaFunction(alpha, beta, p); } }
BetaDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } return Beta.inverseRegularizedIncompleteBetaFunction(alpha, beta, p); } BetaDistribution(double alpha, double beta); }
BetaDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } return Beta.inverseRegularizedIncompleteBetaFunction(alpha, beta, p); } BetaDistribution(double alpha, double beta); static BetaDistribution fit(double[] data); double getAlpha(); double getBeta(); @Override int length(); @Override double mean(); @Override double variance(); @Override double entropy(); @Override String toString(); @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); @Override double rand(); }
BetaDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } return Beta.inverseRegularizedIncompleteBetaFunction(alpha, beta, p); } BetaDistribution(double alpha, double beta); static BetaDistribution fit(double[] data); double getAlpha(); double getBeta(); @Override int length(); @Override double mean(); @Override double variance(); @Override double entropy(); @Override String toString(); @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); @Override double rand(); final double alpha; final double beta; }