@Test public void testCdf() { System.out.println("cdf"); GaussianDistribution instance = new GaussianDistribution(4.0, 3.0); instance.rand(); assertEquals(1.530627e-06, instance.cdf(-10), 1E-12); assertEquals(0.02275013, instance.cdf(-2), 1E-7); assertEquals(0.2524925, instance.cdf(2), 1E-7); assertEquals(0.3694413, instance.cdf(3), 1E-7); assertEquals(0.5000000, instance.cdf(4), 1E-7); assertEquals(0.6305587, instance.cdf(5), 1E-7); assertEquals(0.7475075, instance.cdf(6), 1E-7); assertEquals(0.8413447, instance.cdf(7), 1E-7); assertEquals(0.9772499, instance.cdf(10), 1E-7); assertEquals(0.9998771, instance.cdf(15), 1E-7); assertEquals(1.0000000, instance.cdf(20), 1E-7); }
@Override public double cdf(double x) { if (sigma == 0) { if (x < mu) { return 0.0; } else { return 1.0; } } return 0.5 * Erf.erfc(-0.707106781186547524 * (x - mu) / sigma); }
GaussianDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double cdf(double x) { if (sigma == 0) { if (x < mu) { return 0.0; } else { return 1.0; } } return 0.5 * Erf.erfc(-0.707106781186547524 * (x - mu) / sigma); } }
GaussianDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double cdf(double x) { if (sigma == 0) { if (x < mu) { return 0.0; } else { return 1.0; } } return 0.5 * Erf.erfc(-0.707106781186547524 * (x - mu) / sigma); } GaussianDistribution(double mu, double sigma); }
GaussianDistribution extends AbstractDistribution implements ExponentialFamily { @Override public double cdf(double x) { if (sigma == 0) { if (x < mu) { return 0.0; } else { return 1.0; } } return 0.5 * Erf.erfc(-0.707106781186547524 * (x - mu) / sigma); } 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 cdf(double x) { if (sigma == 0) { if (x < mu) { return 0.0; } else { return 1.0; } } return 0.5 * Erf.erfc(-0.707106781186547524 * (x - mu) / sigma); } 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; }