Poisson Class Reference

This class simulates a "%Poisson distribution". More...

#include <Poisson.h>

Inheritance diagram for Poisson:

RandomVar< long >

List of all members.

Public Member Functions

 Poisson (double mean=0)
 Creates a new instance of the poisson random number generator and initializes the distribution's parameter value.
 Poisson (double mean, RNG &r)
 Creates a new poisson random generator instance by using the pseudo random number generator "r" for the determination of random values and initializes the distribution's parameter value.
double mean () const
 Returns the distribution parameter's current value.
void mean (double newMean)
 Sets the distribution parameter's current value to "newMean".
long operator() (double mean)
 Returns a poisson random number, i.e. the number of hits for parameter $\lambda = \mbox{mean}$.
long operator() ()
 Returns a poisson random number, i.e. the number of hits for parameter $\lambda$ as stored in pMean.
double p (const long &) const
 Returns the probability for "x" hits when the distribution's parameter $\lambda$ is set to pMean.

Protected Attributes

double pMean


Detailed Description

This class simulates a "%Poisson distribution".

This class is derived from class RandomVar and the uniformally distributed pseudo random number values of the interval (0,1) are transformed to type "long", indicating the number of "hits" out of a given number of trials with a given probability for a single hit.
This is similar to the Binomial distribution, but the Poisson distribution delivers an approximation, when the number of trials $n$ is very large and the probability $p$ for a single hit is very small.
Then the Poisson distribution is given for all $x \geq 0$ as:

$ p_x^{(n)} = P(X = x) = ( \lambda^x \cdot e^{- \lambda} ) / x! $

where $\lambda > 0$ is the parameter of the distribution and given by $\lambda = n \cdot p$.
Below you can see the distribution for the parameter values $\lambda = 2.0$ and $\lambda = 5.0$:

poisson.png

Author:
M. Kreutz
Date:
1995-01-01
Changes:
none
Status:
stable

Constructor & Destructor Documentation

Poisson::Poisson ( double  mean = 0  ) 

Creates a new instance of the poisson random number generator and initializes the distribution's parameter value.

Creates a new instance of the poisson random number generator and initializes the distribution's parameter value.

The mean value pMean that represents the value of $\lambda$ in the poisson distribution (see class description) is initialized by mean.
For this instance, the default pseudo random number generator as member of class RandomVar is used.

Parameters:
mean the initial value for $\lambda$ stored in pMean, the default is "0"
Returns:
none
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable

Poisson::Poisson ( double  mean,
RNG r 
)

Creates a new poisson random generator instance by using the pseudo random number generator "r" for the determination of random values and initializes the distribution's parameter value.

Creates a new poisson random generator instance by using the pseudo random number generator "r" for the determination of random values and initializes the distribution's parameter value.

Each instance of a poisson random number generator is based on a generator, that is defined in class RNG and returns uniformally pseudo random numbers of the interval (0,1). By default, this is a global generator named RNG::globalRng and included as member in class RandomVar.
Here another pseudo random number generator r is used instead.
Additionally to defining the used pseudo random number generator, the parameter $\lambda$ (see class description) as stored in pMean is initialized.

Parameters:
mean the initial value for $\lambda$ stored in pMean
r the pseudo random number generator that is used
Returns:
none
Author:
M. Kreutz
Date:
1998-08-17
Changes
none
Status
stable


Member Function Documentation

double Poisson::mean (  )  const [inline]

Returns the distribution parameter's current value.

The current value of pMean that represents the value of $\lambda$ in the poisson distribution (see class description) is returned.

Returns:
the current value of pMean (parameter $\lambda$)
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable

void Poisson::mean ( double  newMean  )  [inline]

Sets the distribution parameter's current value to "newMean".

The current value of pMean that represents the value of $\lambda$ in the poisson distribution (see class description) is set to newMean.

Parameters:
newMean the new value of pMean (parameter $\lambda$)
Returns:
none
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable

long Poisson::operator() ( double  mean  ) 

Returns a poisson random number, i.e. the number of hits for parameter $\lambda = \mbox{mean}$.

Returns a poisson random number, i.e. the number of hits for parameter $\lambda = \mbox{mean}$.

This method performs the inverse transformation of the original uniformally distributed random numbers of the interval (0,1) created by the used pseudo random number generator to the type of the poisson distribution.
The implementation of this method is based on "Numerical Recipes in C", p. 221.

Parameters:
mean the value for $\lambda$
Returns:
the number of hits (events)
Author:
M. Kreutz
Date:
1995-01-01
Changes
mt, 2002-02-01:
A positive integer drawn from a poisson distribution with given "mean"; is case mean > 100, a (positive) gauss number ( floor(mean+gauss(sqrt(mean))+.5) ) is returned.
Status
stable

long Poisson::operator() (  )  [virtual]

Returns a poisson random number, i.e. the number of hits for parameter $\lambda$ as stored in pMean.

Returns a poisson random number, i.e. the number of hits for parameter $\lambda$ as stored in pMean.

Returns:
the number of hits (events)
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable

Implements RandomVar< long >.

double Poisson::p ( const long &  x  )  const [virtual]

Returns the probability for "x" hits when the distribution's parameter $\lambda$ is set to pMean.

Returns the probability for "x" hits when the distribution's parameter $\lambda$ is set to pMean.

Parameters:
x the number of hits
Returns:
the probability for x hits or "0" if $x < 0$
Author:
M. Kreutz
Date:
1995-01-01
Changes
none
Status
stable

Implements RandomVar< long >.


Member Data Documentation

double Poisson::pMean [protected]

The value of $\lambda$ in the poisson distribution (see class description).


The documentation for this class was generated from the following files:

Generated on Thu Aug 28 18:34:50 2008 for Dolphin by  doxygen 1.5.6