@Test public void testQuantile() { System.out.println("quantile"); LogNormalDistribution instance = new LogNormalDistribution(1.0, 1.0); instance.rand(); assertEquals(0.2654449, instance.quantile(0.01), 1E-7); assertEquals(0.754612, instance.quantile(0.1), 1E-6); assertEquals(1.171610, instance.quantile(0.2), 1E-6); assertEquals(1.608978, instance.quantile(0.3), 1E-6); assertEquals(9.791861, instance.quantile(0.9), 1E-6); assertEquals(27.83649, 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 Math.exp(-1.41421356237309505 * sigma * Erf.inverfc(2.0 * p) + mu); }
LogNormalDistribution extends AbstractDistribution { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } return Math.exp(-1.41421356237309505 * sigma * Erf.inverfc(2.0 * p) + mu); } }
LogNormalDistribution extends AbstractDistribution { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } return Math.exp(-1.41421356237309505 * sigma * Erf.inverfc(2.0 * p) + mu); } LogNormalDistribution(double mu, double sigma); }
LogNormalDistribution extends AbstractDistribution { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } return Math.exp(-1.41421356237309505 * sigma * Erf.inverfc(2.0 * p) + mu); } LogNormalDistribution(double mu, double sigma); static LogNormalDistribution fit(double[] data); @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); }
LogNormalDistribution extends AbstractDistribution { @Override public double quantile(double p) { if (p < 0.0 || p > 1.0) { throw new IllegalArgumentException("Invalid p: " + p); } return Math.exp(-1.41421356237309505 * sigma * Erf.inverfc(2.0 * p) + mu); } LogNormalDistribution(double mu, double sigma); static LogNormalDistribution fit(double[] data); @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 double mu; final double sigma; }