@Test public void testCdf() { System.out.println("cdf"); BetaDistribution instance = new BetaDistribution(2, 5); instance.rand(); assertEquals(0, instance.cdf(-0.1), 1E-5); assertEquals(0, instance.cdf(0.0), 1E-5); assertEquals(0.114265, instance.cdf(0.1), 1E-5); assertEquals(0.34464, instance.cdf(0.2), 1E-5); assertEquals(0.579825, instance.cdf(0.3), 1E-5); assertEquals(0.76672, instance.cdf(0.4), 1E-5); assertEquals(0.890625, instance.cdf(0.5), 1E-5); assertEquals(1.0, instance.cdf(1.0), 1E-5); assertEquals(1.0, instance.cdf(1.5), 1E-5); }
@Override public double cdf(double x) { if (x <= 0) { return 0.0; } else if (x >= 1) { return 1.0; } else { return Beta.regularizedIncompleteBetaFunction(alpha, beta, x); } }
BetaDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double cdf(double x) { if (x <= 0) { return 0.0; } else if (x >= 1) { return 1.0; } else { return Beta.regularizedIncompleteBetaFunction(alpha, beta, x); } } }
BetaDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double cdf(double x) { if (x <= 0) { return 0.0; } else if (x >= 1) { return 1.0; } else { return Beta.regularizedIncompleteBetaFunction(alpha, beta, x); } } BetaDistribution(double alpha, double beta); }
BetaDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double cdf(double x) { if (x <= 0) { return 0.0; } else if (x >= 1) { return 1.0; } else { return Beta.regularizedIncompleteBetaFunction(alpha, beta, x); } } 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 cdf(double x) { if (x <= 0) { return 0.0; } else if (x >= 1) { return 1.0; } else { return Beta.regularizedIncompleteBetaFunction(alpha, beta, x); } } 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; }