@Test public void testCdf() { System.out.println("cdf"); LogNormalDistribution instance = new LogNormalDistribution(1.0, 1.0); instance.rand(); assertEquals(1.040252e-08, instance.cdf(0.01), 1E-12); assertEquals(0.0004789901, instance.cdf(0.1), 1E-7); assertEquals(0.1586553, instance.cdf(1.0), 1E-7); assertEquals(0.3794777, instance.cdf(2.0), 1E-7); assertEquals(0.7288829, instance.cdf(5.0), 1E-7); assertEquals(0.9036418, instance.cdf(10.0), 1E-7); }
@Override public double cdf(double x) { if (x < 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } if (x == 0.0) { return 0.; } return 0.5 * Erf.erfc(-0.707106781186547524 * (Math.log(x) - mu) / sigma); }
LogNormalDistribution extends AbstractDistribution { @Override public double cdf(double x) { if (x < 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } if (x == 0.0) { return 0.; } return 0.5 * Erf.erfc(-0.707106781186547524 * (Math.log(x) - mu) / sigma); } }
LogNormalDistribution extends AbstractDistribution { @Override public double cdf(double x) { if (x < 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } if (x == 0.0) { return 0.; } return 0.5 * Erf.erfc(-0.707106781186547524 * (Math.log(x) - mu) / sigma); } LogNormalDistribution(double mu, double sigma); }
LogNormalDistribution extends AbstractDistribution { @Override public double cdf(double x) { if (x < 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } if (x == 0.0) { return 0.; } return 0.5 * Erf.erfc(-0.707106781186547524 * (Math.log(x) - mu) / sigma); } 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 cdf(double x) { if (x < 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } if (x == 0.0) { return 0.; } return 0.5 * Erf.erfc(-0.707106781186547524 * (Math.log(x) - mu) / sigma); } 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; }