@Test public void testShiftedGeometricDistribution() { System.out.println("ShiftedGeometricDistribution"); MathEx.setSeed(19650218); ShiftedGeometricDistribution instance = new ShiftedGeometricDistribution(0.4); int[] data = instance.randi(1000); ShiftedGeometricDistribution est = ShiftedGeometricDistribution.fit(data); assertEquals(0.4, est.p, 1E-2); }
public ShiftedGeometricDistribution(double p) { if (p <= 0 || p > 1) { throw new IllegalArgumentException("Invalid p: " + p); } this.p = p; entropy = (-p * MathEx.log2(p) - (1 - p) * MathEx.log2(1 - p)) / p; }
ShiftedGeometricDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { public ShiftedGeometricDistribution(double p) { if (p <= 0 || p > 1) { throw new IllegalArgumentException("Invalid p: " + p); } this.p = p; entropy = (-p * MathEx.log2(p) - (1 - p) * MathEx.log2(1 - p)) / p; } }
ShiftedGeometricDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { public ShiftedGeometricDistribution(double p) { if (p <= 0 || p > 1) { throw new IllegalArgumentException("Invalid p: " + p); } this.p = p; entropy = (-p * MathEx.log2(p) - (1 - p) * MathEx.log2(1 - p)) / p; } ShiftedGeometricDistribution(double p); }
ShiftedGeometricDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { public ShiftedGeometricDistribution(double p) { if (p <= 0 || p > 1) { throw new IllegalArgumentException("Invalid p: " + p); } this.p = p; entropy = (-p * MathEx.log2(p) - (1 - p) * MathEx.log2(1 - p)) / p; } ShiftedGeometricDistribution(double p); static ShiftedGeometricDistribution fit(int[] data); @Override int length(); @Override double mean(); @Override double variance(); @Override double sd(); @Override double entropy(); @Override String toString(); @Override double rand(); @Override double p(int k); @Override double logp(int k); @Override double cdf(double k); @Override double quantile(double p); @Override DiscreteMixture.Component M(int[] x, double[] posteriori); }
ShiftedGeometricDistribution extends DiscreteDistribution implements DiscreteExponentialFamily { public ShiftedGeometricDistribution(double p) { if (p <= 0 || p > 1) { throw new IllegalArgumentException("Invalid p: " + p); } this.p = p; entropy = (-p * MathEx.log2(p) - (1 - p) * MathEx.log2(1 - p)) / p; } ShiftedGeometricDistribution(double p); static ShiftedGeometricDistribution fit(int[] data); @Override int length(); @Override double mean(); @Override double variance(); @Override double sd(); @Override double entropy(); @Override String toString(); @Override double rand(); @Override double p(int k); @Override double logp(int k); @Override double cdf(double k); @Override double quantile(double p); @Override DiscreteMixture.Component M(int[] x, double[] posteriori); final double p; }