/** * Create a new Poisson distribution with the given mean and convergence criterion. * * @param p the Poisson mean * @param epsilon the convergence criteria for cumulative probabilites * @since 2.1 */ public PoissonDistributionImpl(double p, double epsilon) { setMean(p); this.epsilon = epsilon; }
/** * Returns the variance of the distribution. * * For mean parameter <code>p</code>, the variance is <code>p</code> * * @return the variance * @since 2.2 */ public double getNumericalVariance() { return getMean(); }
/** * Create a new Poisson distribution with poisson parameter lambda. * <p> * lambda must be postive; otherwise an * <code>IllegalArgumentException</code> is thrown. * * @param lambda poisson parameter * @return a new Poisson distribution * @throws IllegalArgumentException if lambda ≤ 0 */ public PoissonDistribution createPoissonDistribution(double lambda) { return new PoissonDistributionImpl(lambda); } }
/** * Create a new Poisson distribution with the given the mean. * The mean value must be positive; otherwise an * <code>IllegalArgument</code> is thrown. * * @param p the Poisson mean * @param z a normal distribution used to compute normal approximations. * @throws IllegalArgumentException if p ≤ 0 * @since 1.2 */ public PoissonDistributionImpl(double p, NormalDistribution z) { super(); setNormal(z); setMean(p); }
/** * Set the Poisson mean for the distribution. The mean value must be * positive; otherwise an <code>IllegalArgument</code> is thrown. * * @param p the Poisson mean value * @throws IllegalArgumentException if p ≤ 0 * @deprecated as of 2.1 (class will become immutable in 3.0) */ @Deprecated public void setMean(double p) { setNormalAndMeanInternal(normal, p); } /**
/** * Modify the normal distribution used to compute normal approximations. The * caller is responsible for insuring the normal distribution has the proper * parameter settings. * * @param value the new distribution * @since 1.2 * @deprecated as of 2.1 (class will become immutable in 3.0) */ @Deprecated public void setNormal(NormalDistribution value) { setNormalAndMeanInternal(value, mean); }
/** * Create a new Poisson distribution with the given mean and convergence criterion. * * @param p the Poisson mean * @param epsilon the convergence criteria for cumulative probabilites * @since 2.1 */ public PoissonDistributionImpl(double p, double epsilon) { setMean(p); this.epsilon = epsilon; }
/** * Set the Poisson mean for the distribution. The mean value must be * positive; otherwise an <code>IllegalArgument</code> is thrown. * * @param p the Poisson mean value * @throws IllegalArgumentException if p ≤ 0 * @deprecated as of 2.1 (class will become immutable in 3.0) */ @Deprecated public void setMean(double p) { setNormalAndMeanInternal(normal, p); } /**
/** * The probability mass function P(X = x) for a Poisson distribution. * * @param x the value at which the probability density function is evaluated. * @return the value of the probability mass function at x */ public double probability(int x) { if (x < 0 || x == Integer.MAX_VALUE) { return 0; } return Math.pow(getMean(), x) / MathUtils.factorialDouble(x) * Math.exp(-mean); }
/** * Create a new Poisson distribution with the given mean and maximum number of iterations. * * @param p the Poisson mean * @param maxIterations the maximum number of iterations for cumulative probabilites * @since 2.1 */ public PoissonDistributionImpl(double p, int maxIterations) { setMean(p); this.maxIterations = maxIterations; }
/** * Create a new Poisson distribution with the given the mean. The mean value * must be positive; otherwise an <code>IllegalArgument</code> is thrown. * * @param p the Poisson mean * @param z a normal distribution used to compute normal approximations. * @throws IllegalArgumentException if p ≤ 0 * @since 1.2 * @deprecated as of 2.1 (to avoid possibly inconsistent state, the * "NormalDistribution" will be instantiated internally) */ @Deprecated public PoissonDistributionImpl(double p, NormalDistribution z) { super(); setNormalAndMeanInternal(z, p); }
/** * Create a new Poisson distribution with the given mean and maximum number of iterations. * * @param p the Poisson mean * @param maxIterations the maximum number of iterations for cumulative probabilites * @since 2.1 */ public PoissonDistributionImpl(double p, int maxIterations) { setMean(p); this.maxIterations = maxIterations; }
/** * Modify the normal distribution used to compute normal approximations. The * caller is responsible for insuring the normal distribution has the proper * parameter settings. * * @param value the new distribution * @since 1.2 * @deprecated as of 2.1 (class will become immutable in 3.0) */ @Deprecated public void setNormal(NormalDistribution value) { setNormalAndMeanInternal(value, mean); } }
/** * Create a new Poisson distribution with the given mean, convergence criterion * and maximum number of iterations. * * @param p the Poisson mean * @param epsilon the convergence criteria for cumulative probabilites * @param maxIterations the maximum number of iterations for cumulative probabilites * @since 2.1 */ public PoissonDistributionImpl(double p, double epsilon, int maxIterations) { setMean(p); this.epsilon = epsilon; this.maxIterations = maxIterations; }
/** * Create a new Poisson distribution with the given the mean. The mean value * must be positive; otherwise an <code>IllegalArgument</code> is thrown. * * @param p the Poisson mean * @param z a normal distribution used to compute normal approximations. * @throws IllegalArgumentException if p ≤ 0 * @since 1.2 * @deprecated as of 2.1 (to avoid possibly inconsistent state, the * "NormalDistribution" will be instantiated internally) */ @Deprecated public PoissonDistributionImpl(double p, NormalDistribution z) { super(); setNormalAndMeanInternal(z, p); }
/** * Create a new Poisson distribution with the given mean, convergence criterion * and maximum number of iterations. * * @param p the Poisson mean * @param epsilon the convergence criteria for cumulative probabilites * @param maxIterations the maximum number of iterations for cumulative probabilites * @since 2.1 */ public PoissonDistributionImpl(double p, double epsilon, int maxIterations) { setMean(p); this.epsilon = epsilon; this.maxIterations = maxIterations; }