This class simulates a "%Poisson distribution". More...
#include <Poisson.h>
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. | |
| long | operator() () |
| Returns a poisson random number, i.e. | |
| double | p (const long &) const |
Returns the probability for "x" hits when the distribution's parameter is set to pMean. | |
Protected Attributes | |
| double | pMean |
The value of in the poisson distribution (see class 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
is very large and the probability
for a single hit is very small.
Then the Poisson distribution is given for all
as:

where
is the parameter of the distribution and given by
.
Below you can see the distribution for the parameter values
and
:
Definition at line 87 of file Poisson.h.
| Poisson::Poisson | ( | double | mean = 0 |
) |
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
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.
| mean | the initial value for stored in pMean, the default is "0" |
Definition at line 76 of file Poisson.cpp.
| 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.
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
(see class description) as stored in pMean is initialized.
| mean | the initial value for stored in pMean | |
| r | the pseudo random number generator that is used |
Definition at line 111 of file Poisson.cpp.
| 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
in the poisson distribution (see class description) is set to newMean.
| newMean | the new value of pMean (parameter ) |
Definition at line 146 of file Poisson.h.
References pMean.
| double Poisson::mean | ( | ) | const [inline] |
Returns the distribution parameter's current value.
The current value of pMean that represents the value of
in the poisson distribution (see class description) is returned.
)Definition at line 120 of file Poisson.h.
References pMean.
| long Poisson::operator() | ( | ) | [virtual] |
Returns a poisson random number, i.e.
Returns a poisson random number, i.e. the number of hits for parameter
as stored in pMean.
the number of hits for parameter
as stored in pMean.
Implements RandomVar< long >.
Definition at line 187 of file Poisson.cpp.
References pMean.
| long Poisson::operator() | ( | double | mean | ) |
Returns a poisson random number, i.e.
Returns a poisson random number, i.e. the number of hits for parameter
.
the number of hits for parameter
.
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.
| mean | the value for |
Definition at line 144 of file Poisson.cpp.
| double Poisson::p | ( | const long & | x | ) | const [virtual] |
Returns the probability for "x" hits when the distribution's parameter
is set to pMean.
| x | the number of hits |

Implements RandomVar< long >.
Definition at line 225 of file Poisson.cpp.
References pMean.
double Poisson::pMean [protected] |
The value of
in the poisson distribution (see class description).
Definition at line 168 of file Poisson.h.
Referenced by mean(), operator()(), and p().