#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. the number of hits for parameter ![]() | |
long | operator() () |
Returns a poisson random number, i.e. the number of hits for parameter ![]() | |
double | p (const long &) const |
Returns the probability for "x" hits when the distribution's parameter ![]() | |
Protected Attributes | |
double | pMean |
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
:
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 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 ![]() |
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 (see class description) as stored in pMean is initialized.
mean | the initial value for ![]() | |
r | the pseudo random number generator that is used |
double Poisson::mean | ( | ) | const [inline] |
void Poisson::mean | ( | double | newMean | ) | [inline] |
long Poisson::operator() | ( | double | mean | ) |
Returns a poisson random number, i.e. the number of hits for parameter .
Returns a poisson random number, i.e. 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 ![]() |
long Poisson::operator() | ( | ) | [virtual] |
Returns a poisson random number, i.e. the number of hits for parameter as stored in pMean.
Returns a poisson random number, i.e. the number of hits for parameter as stored in pMean.
Implements RandomVar< long >.
double Poisson::p | ( | const long & | x | ) | const [virtual] |
Returns the probability for "x" hits when the distribution's parameter is set to pMean.
Returns the probability for "x" hits when the distribution's parameter is set to pMean.
x | the number of hits |
Implements RandomVar< long >.
double Poisson::pMean [protected] |
The value of in the poisson distribution (see class description).