@Test public void testQuantile() { System.out.println("quantile"); ChiSquareDistribution instance = new ChiSquareDistribution(20); instance.rand(); assertEquals(0.0, instance.quantile(0), 1E-7); assertEquals(12.44261, instance.quantile(0.1), 1E-5); assertEquals(14.57844, instance.quantile(0.2), 1E-5); assertEquals(16.26586, instance.quantile(0.3), 1E-5); assertEquals(19.33743, instance.quantile(0.5), 1E-5); assertEquals(28.41198, instance.quantile(0.9), 1E-5); }
@Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } return 2 * Gamma.inverseRegularizedIncompleteGamma(0.5 * nu, p); }
ChiSquareDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } return 2 * Gamma.inverseRegularizedIncompleteGamma(0.5 * nu, p); } }
ChiSquareDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } return 2 * Gamma.inverseRegularizedIncompleteGamma(0.5 * nu, p); } ChiSquareDistribution(int nu); }
ChiSquareDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } return 2 * Gamma.inverseRegularizedIncompleteGamma(0.5 * nu, p); } 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 quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } return 2 * Gamma.inverseRegularizedIncompleteGamma(0.5 * nu, p); } 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; }