@Test public void testQuantile() { System.out.println("quantile"); GaussianDistribution instance = new GaussianDistribution(4.0, 3.0); instance.rand(); assertEquals(1.475136, instance.quantile(0.2), 1E-6); assertEquals(2.426798, instance.quantile(0.3), 1E-6); assertEquals(3.239959, instance.quantile(0.4), 1E-6); assertEquals(4.000000, instance.quantile(0.5), 1E-6); assertEquals(4.760041, instance.quantile(0.6), 1E-6); assertEquals(5.573202, instance.quantile(0.7), 1E-6); }
@Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } if (sigma == 0.0) { if (p < 1.0) { return mu - 1E-10; } else { return mu; } } return -1.41421356237309505 * sigma * Erf.inverfc(2.0 * p) + mu; }
GaussianDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } if (sigma == 0.0) { if (p < 1.0) { return mu - 1E-10; } else { return mu; } } return -1.41421356237309505 * sigma * Erf.inverfc(2.0 * p) + mu; } }
GaussianDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } if (sigma == 0.0) { if (p < 1.0) { return mu - 1E-10; } else { return mu; } } return -1.41421356237309505 * sigma * Erf.inverfc(2.0 * p) + mu; } GaussianDistribution(double mu, double sigma); }
GaussianDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } if (sigma == 0.0) { if (p < 1.0) { return mu - 1E-10; } else { return mu; } } return -1.41421356237309505 * sigma * Erf.inverfc(2.0 * p) + mu; } GaussianDistribution(double mu, double sigma); static GaussianDistribution fit(double[] data); static GaussianDistribution getInstance(); @Override int length(); @Override double mean(); @Override double variance(); @Override double sd(); @Override double entropy(); @Override String toString(); @Override double rand(); double randInverseCDF(); @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); }
GaussianDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } if (sigma == 0.0) { if (p < 1.0) { return mu - 1E-10; } else { return mu; } } return -1.41421356237309505 * sigma * Erf.inverfc(2.0 * p) + mu; } GaussianDistribution(double mu, double sigma); static GaussianDistribution fit(double[] data); static GaussianDistribution getInstance(); @Override int length(); @Override double mean(); @Override double variance(); @Override double sd(); @Override double entropy(); @Override String toString(); @Override double rand(); double randInverseCDF(); @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 double mu; final double sigma; }