SSJ
V. 1.1.9.

umontreal.iro.lecuyer.probdist
Class PoissonDist

java.lang.Object
  extended by umontreal.iro.lecuyer.probdist.DiscreteDistributionInt
      extended by umontreal.iro.lecuyer.probdist.PoissonDist

public class PoissonDist
extends DiscreteDistributionInt

Extends the class DiscreteDistributionInt for the Poisson distribution with mean λ >=  0. The mass function is

p(x) = e-λλx/(x!),        for x = 0, 1,...

and the distribution function is

F(x) = e-λ∑j=0x  λj/(j!),        for x = 0, 1,....

If one has to compute p(x) and/or F(x) for several values of x with the same λ, where λ is not too large, then it is more efficient to instantiate an object and use the non-static methods, since the functions will then be computed once and kept in arrays.

For the static methods that compute F(x) and bar(F)(x), we exploit the relationship F(x) = 1 - Gx+1(λ), where Gx+1 is the gamma distribution function with parameters (α, λ) = (x + 1, 1).


Field Summary
static double MAXLAMBDA
           
 
Fields inherited from class umontreal.iro.lecuyer.probdist.DiscreteDistributionInt
EPSILON
 
Constructor Summary
PoissonDist(double lambda)
          Creates an object that contains the probability and distribution functions, for the Poisson distribution with parameter lambda, which are computed and stored in dynamic arrays inside that object.
 
Method Summary
static double barF(double lambda, int x)
          Computes and returns the value of the complementary Poisson distribution function, bar(F)(x), for λ = lambda.
 double barF(int x)
          Returns bar(F)(x), the complementary distribution function.
static double cdf(double lambda, int x)
          Computes and returns the value of the Poisson distribution function, F(x), for λ = lambda.
 double cdf(int x)
          Returns the distribution function F evaluated at x (see).
 double getLambda()
          Returns the λ associated with this object.
 int inverseF(double u)
          Returns the inverse distribution function F-1(u), where 0 <= u <= 1.
static int inverseF(double lambda, double u)
          Performs a linear search to get the inverse function without precomputed tables.
static double prob(double lambda, int x)
          Computes and returns the value of the Poisson probability p(x), for λ = lambda.
 double prob(int x)
          Returns p(x), the probability of x, which should be a real number in the interval [0, 1].
 void setLambda(double lambda)
          Sets the λ associated with this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAXLAMBDA

public static double MAXLAMBDA
Constructor Detail

PoissonDist

public PoissonDist(double lambda)
Creates an object that contains the probability and distribution functions, for the Poisson distribution with parameter lambda, which are computed and stored in dynamic arrays inside that object.

Method Detail

prob

public double prob(int x)
Description copied from class: DiscreteDistributionInt
Returns p(x), the probability of x, which should be a real number in the interval [0, 1].

Specified by:
prob in class DiscreteDistributionInt
Parameters:
x - value at which the mass function must be evaluated
Returns:
the mass function evaluated at x

cdf

public double cdf(int x)
Description copied from class: DiscreteDistributionInt
Returns the distribution function F evaluated at x (see).

Specified by:
cdf in class DiscreteDistributionInt
Parameters:
x - value at which the distribution function must be evaluated
Returns:
the distribution function evaluated at x

barF

public double barF(int x)
Description copied from class: DiscreteDistributionInt
Returns bar(F)(x), the complementary distribution function.

Overrides:
barF in class DiscreteDistributionInt
Parameters:
x - value at which the complementary distribution function must be evaluated
Returns:
the complementary distribution function evaluated at x

inverseF

public int inverseF(double u)
Description copied from class: DiscreteDistributionInt
Returns the inverse distribution function F-1(u), where 0 <= u <= 1. The default implementation uses binary search.

Overrides:
inverseF in class DiscreteDistributionInt
Parameters:
u - value in the interval (0, 1) for which the inverse distribution function is evaluated
Returns:
the inverse distribution function evaluated at u

prob

public static double prob(double lambda,
                          int x)
Computes and returns the value of the Poisson probability p(x), for λ = lambda. If λ >= 20, this (static) method uses the logarithm of the gamma function, defined in, to estimate the density.


cdf

public static double cdf(double lambda,
                         int x)
Computes and returns the value of the Poisson distribution function, F(x), for λ = lambda.


barF

public static double barF(double lambda,
                          int x)
Computes and returns the value of the complementary Poisson distribution function, bar(F)(x), for λ = lambda. Computes and adds the non-negligible terms in the tail.


inverseF

public static int inverseF(double lambda,
                           double u)
Performs a linear search to get the inverse function without precomputed tables. If λ > 150, uses the gamma approximation (see the static cdf method) and calls GammaDist.inverseF (x+1, 15, lambda).


getLambda

public double getLambda()
Returns the λ associated with this object.


setLambda

public void setLambda(double lambda)
Sets the λ associated with this object.


SSJ
V. 1.1.9.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.