|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.distribution.AbstractDistribution
org.apache.commons.math.distribution.AbstractIntegerDistribution
org.apache.commons.math.distribution.PoissonDistributionImpl
public class PoissonDistributionImpl
Implementation for the PoissonDistribution
.
Field Summary | |
---|---|
static double |
DEFAULT_EPSILON
Default convergence criterion. |
static int |
DEFAULT_MAX_ITERATIONS
Default maximum number of iterations for cumulative probability calculations. |
Fields inherited from class org.apache.commons.math.distribution.AbstractIntegerDistribution |
---|
randomData |
Constructor Summary | |
---|---|
PoissonDistributionImpl(double p)
Create a new Poisson distribution with the given the mean. |
|
PoissonDistributionImpl(double p,
double epsilon)
Create a new Poisson distribution with the given mean and convergence criterion. |
|
PoissonDistributionImpl(double p,
double epsilon,
int maxIterations)
Create a new Poisson distribution with the given mean, convergence criterion and maximum number of iterations. |
|
PoissonDistributionImpl(double p,
int maxIterations)
Create a new Poisson distribution with the given mean and maximum number of iterations. |
|
PoissonDistributionImpl(double p,
NormalDistribution z)
Deprecated. as of 2.1 (to avoid possibly inconsistent state, the "NormalDistribution" will be instantiated internally) |
Method Summary | |
---|---|
double |
cumulativeProbability(int x)
The probability distribution function P(X <= x) for a Poisson distribution. |
protected int |
getDomainLowerBound(double p)
Access the domain value lower bound, based on p , used to
bracket a CDF root. |
protected int |
getDomainUpperBound(double p)
Access the domain value upper bound, based on p , used to
bracket a CDF root. |
double |
getMean()
Get the Poisson mean for the distribution. |
double |
getNumericalVariance()
Returns the variance of the distribution. |
int |
getSupportLowerBound()
Returns the lower bound of the support for the distribution. |
int |
getSupportUpperBound()
Returns the upper bound of the support for the distribution. |
double |
normalApproximateProbability(int x)
Calculates the Poisson distribution function using a normal approximation. |
double |
probability(int x)
The probability mass function P(X = x) for a Poisson distribution. |
int |
sample()
Generates a random value sampled from this distribution. |
void |
setMean(double p)
Deprecated. as of 2.1 (class will become immutable in 3.0) |
void |
setNormal(NormalDistribution value)
Deprecated. as of 2.1 (class will become immutable in 3.0) |
Methods inherited from class org.apache.commons.math.distribution.AbstractIntegerDistribution |
---|
cumulativeProbability, cumulativeProbability, cumulativeProbability, inverseCumulativeProbability, isSupportLowerBoundInclusive, isSupportUpperBoundInclusive, probability, reseedRandomGenerator, sample |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.commons.math.distribution.IntegerDistribution |
---|
cumulativeProbability, inverseCumulativeProbability |
Methods inherited from interface org.apache.commons.math.distribution.DiscreteDistribution |
---|
probability |
Methods inherited from interface org.apache.commons.math.distribution.Distribution |
---|
cumulativeProbability, cumulativeProbability |
Field Detail |
---|
public static final int DEFAULT_MAX_ITERATIONS
public static final double DEFAULT_EPSILON
Constructor Detail |
---|
public PoissonDistributionImpl(double p)
IllegalArgument
is thrown.
p
- the Poisson mean
IllegalArgumentException
- if p ≤ 0public PoissonDistributionImpl(double p, double epsilon, int maxIterations)
p
- the Poisson meanepsilon
- the convergence criteria for cumulative probabilitesmaxIterations
- the maximum number of iterations for cumulative probabilitespublic PoissonDistributionImpl(double p, double epsilon)
p
- the Poisson meanepsilon
- the convergence criteria for cumulative probabilitespublic PoissonDistributionImpl(double p, int maxIterations)
p
- the Poisson meanmaxIterations
- the maximum number of iterations for cumulative probabilites@Deprecated public PoissonDistributionImpl(double p, NormalDistribution z)
IllegalArgument
is thrown.
p
- the Poisson meanz
- a normal distribution used to compute normal approximations.
IllegalArgumentException
- if p ≤ 0Method Detail |
---|
public double getMean()
getMean
in interface PoissonDistribution
@Deprecated public void setMean(double p)
IllegalArgument
is thrown.
setMean
in interface PoissonDistribution
p
- the Poisson mean value
IllegalArgumentException
- if p ≤ 0public double probability(int x)
probability
in interface IntegerDistribution
x
- the value at which the probability density function is
evaluated.
public double cumulativeProbability(int x) throws MathException
cumulativeProbability
in interface IntegerDistribution
cumulativeProbability
in class AbstractIntegerDistribution
x
- the value at which the PDF is evaluated.
MathException
- if the cumulative probability can not be computed
due to convergence or other numerical errors.public double normalApproximateProbability(int x) throws MathException
N(mean, sqrt(mean))
distribution is used
to approximate the Poisson distribution.
The computation uses "half-correction" -- evaluating the normal
distribution function at x + 0.5
normalApproximateProbability
in interface PoissonDistribution
x
- the upper bound, inclusive
MathException
- if an error occurs computing the normal
approximationpublic int sample() throws MathException
Algorithm Description:
sample
in class AbstractIntegerDistribution
MathException
- if an error occurs generating the random valueprotected int getDomainLowerBound(double p)
p
, used to
bracket a CDF root. This method is used by
AbstractIntegerDistribution.inverseCumulativeProbability(double)
to find critical values.
getDomainLowerBound
in class AbstractIntegerDistribution
p
- the desired probability for the critical value
protected int getDomainUpperBound(double p)
p
, used to
bracket a CDF root. This method is used by
AbstractIntegerDistribution.inverseCumulativeProbability(double)
to find critical values.
getDomainUpperBound
in class AbstractIntegerDistribution
p
- the desired probability for the critical value
@Deprecated public void setNormal(NormalDistribution value)
value
- the new distributionpublic int getSupportLowerBound()
public int getSupportUpperBound()
Integer.MAX_VALUE
and
AbstractIntegerDistribution.isSupportUpperBoundInclusive()
returns true
.
Integer.MAX_VALUE
for positive infinity)public double getNumericalVariance()
p
, the variance is p
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |