Marmote Core
The project aims at realizing the prototype of a software environment dedicated to modeling with Markov chains.
Public Member Functions | List of all members
poissonDistribution Class Reference

The Poisson distribution. The parameter is called "lambda". The Poisson distribution is discrete but does not inherit from discreteDistribution because its range is infinite. More...

#include <poissonDistribution.h>

Inheritance diagram for poissonDistribution:
Distribution

Public Member Functions

 poissonDistribution (double lambda)
 Constructor for a Poisson distribution from its "lambda" parameter. The mean is calculated at creation. More...
 
 ~poissonDistribution ()
 Destructor for a Poisson distribution. More...
 
double getProba (double k)
 Function to obtain the probability of a specific value k. More...
 
double lambda ()
 Function to obtain the parameter (or ratio) of the distribution. Redundant with p() but defined to be more explicit. More...
 
double mean ()
 computing the mathematical expectation or mean More...
 
double rate ()
 computing the "rate", defined as the inverse of the mean More...
 
double moment (int order)
 Computing the moments of the distribution. More...
 
double variance ()
 Computing the variance of the random variable: the second moment minus the square of the first moment. Variance is the square of the coefficient of variation. The Distribution class offers a default implementation. More...
 
double laplace (double s)
 computing the Laplace transform of the distribution at real point More...
 
double dLaplace (double s)
 computing the derivative of the Laplace transform at real points More...
 
double cdf (double x)
 computing the cumulative distribution function at some real point x. This is the probability that the random variable is less or equal to x. More...
 
double ccdf (double x)
 computing the complementary cumulative distributon function (or tail) at some real point x. This is the probability that the random variable is strictly larger than x. The Distribution class offers a default implementation. More...
 
bool hasMoment (int order)
 test for the existence of moments of any order More...
 
poissonDistributionrescale (double factor)
 rescaling a distribution by some real factor. Not all distributions allow this for any real factor. If the operation fails, or if the factor is 1.0, a copy of the distribution should be returned (not by using the copy() function). More...
 
poissonDistributioncopy ()
 copying a distribution. Typically implemented as rescale(1.0). More...
 
double sample ()
 Sample from the Poisson distibution. Uses the "R" package. More...
 
void iidSample (int n, double *s)
 drawing an i.i.d. sample from the distribution. The result is returned in an array (that must have been already allocated) passed as a parameter. The Distribution class offers the default implementation with repeated call to sample(). More...
 
std::string toString ()
 an utility to convert the distribution into a string. More...
 
void write (FILE *out, int mode)
 an utility to write the distribution to some file, according to some format. More...
 
- Public Member Functions inherited from Distribution
virtual ~Distribution ()
 Standard destructor. More...
 
std::string name ()
 Read accessor to the type name of the distribution. More...
 
double variance ()
 Computing the variance of the random variable: the second moment minus the square of the first moment. Variance is the square of the coefficient of variation. The Distribution class offers a default implementation. More...
 
double ccdf (double x)
 computing the complementary cumulative distributon function (or tail) at some real point x. This is the probability that the random variable is strictly larger than x. The Distribution class offers a default implementation. More...
 
void iidSample (int n, double *s)
 drawing an i.i.d. sample from the distribution. The result is returned in an array (that must have been already allocated) passed as a parameter. The Distribution class offers the default implementation with repeated call to sample(). More...
 
virtual double distanceL1 (Distribution *d)
 Computing generally the L1 distance between distributions. More...
 
virtual bool hasProperty (std::string pro)
 Property test function. Current properties are: More...
 
void fprint ()
 write on stdout with NORMAL_PRINT_MODE More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Distribution
static double u_0_1 (void)
 
static double exponential (double mean)
 
- Protected Attributes inherited from Distribution
std::string _name
 
double _mean
 
- Static Protected Attributes inherited from Distribution
static const double VALUE_TOLERANCE = 1.0e-8
 

Detailed Description

The Poisson distribution. The parameter is called "lambda". The Poisson distribution is discrete but does not inherit from discreteDistribution because its range is infinite.

Author
Alain Jean-Marie

Constructor & Destructor Documentation

poissonDistribution::poissonDistribution ( double  lambda)

Constructor for a Poisson distribution from its "lambda" parameter. The mean is calculated at creation.

Author
Alain Jean-Marie
Parameters
lambdaa non-negative real number
Returns
an object of type poissonDistribution
poissonDistribution::~poissonDistribution ( )

Destructor for a Poisson distribution.

Author
Alain Jean-Marie

Member Function Documentation

double poissonDistribution::ccdf ( double  x)

computing the complementary cumulative distributon function (or tail) at some real point x. This is the probability that the random variable is strictly larger than x. The Distribution class offers a default implementation.

Parameters
xthe value at which to compute the ccdf
Returns
the value of the ccdf
double poissonDistribution::cdf ( double  x)
virtual

computing the cumulative distribution function at some real point x. This is the probability that the random variable is less or equal to x.

Parameters
xthe value at which to compute the cdf
Returns
the value of the cdf

Computation of the cumulative density function at some real point x

Author
Alain Jean-Marie
Parameters
xvalue at which the CDF is computed
Returns
CDF(x)

Implements Distribution.

poissonDistribution * poissonDistribution::copy ( )
virtual

copying a distribution. Typically implemented as rescale(1.0).

See also
rescale(double)
Returns
a copy of the distribution

Copying the law

Author
Alain Jean-Marie
Returns
a copy of the law

Implements Distribution.

double poissonDistribution::dLaplace ( double  s)
virtual

computing the derivative of the Laplace transform at real points

Parameters
sthe value at which to compute
Returns
the value of the derivative of the Laplace transform

Computation of the derivative of the Laplace transform at some real point s

Author
Alain Jean-Marie
Parameters
svalue at which the derivative is computed
Returns
d LT(s)/ds

Implements Distribution.

double poissonDistribution::getProba ( double  k)

Function to obtain the probability of a specific value k.

Parameters
kthe value at which the probability should be computed
Returns
the probability that the random variable is k

Computation of the probability of some value

Author
Alain Jean-Marie
Parameters
kvalue at which the probability is computed
Returns
P( X = k )
bool poissonDistribution::hasMoment ( int  order)
virtual

test for the existence of moments of any order

Parameters
orderthe order of the moment to be tested
Returns
true if the moment exists, false otherwise

Implements Distribution.

void poissonDistribution::iidSample ( int  n,
double *  s 
)

drawing an i.i.d. sample from the distribution. The result is returned in an array (that must have been already allocated) passed as a parameter. The Distribution class offers the default implementation with repeated call to sample().

Parameters
nthe number of values to sample
san array to be filled with the sample
double poissonDistribution::lambda ( )
inline

Function to obtain the parameter (or ratio) of the distribution. Redundant with p() but defined to be more explicit.

Returns
the value of the ratio
double poissonDistribution::laplace ( double  s)
virtual

computing the Laplace transform of the distribution at real point

Parameters
sthe value at which to compute
Returns
the value of the Laplace transform

Computation of the Laplace transform at some real point s

Author
Alain Jean-Marie
Parameters
svalue at which the derivative is computed
Returns
LT(s)

Implements Distribution.

double poissonDistribution::mean ( )
virtual

computing the mathematical expectation or mean

Returns
the mean

Calculation of the mean. Returns the value since it is pre-computed

Author
Alain Jean-Marie
Returns
the mathematical expectation of the distribution

Implements Distribution.

double poissonDistribution::moment ( int  order)
virtual

Computing the moments of the distribution.

Parameters
orderthe order of the moment to be computed
Returns
the moment

Implements Distribution.

double poissonDistribution::rate ( )
virtual

computing the "rate", defined as the inverse of the mean

Returns
the rate

Calculation of the rate, which is the inverse of the mean

Author
Alain Jean-Marie
Returns
the rate

Implements Distribution.

poissonDistribution * poissonDistribution::rescale ( double  factor)
virtual

rescaling a distribution by some real factor. Not all distributions allow this for any real factor. If the operation fails, or if the factor is 1.0, a copy of the distribution should be returned (not by using the copy() function).

See also
copy()
Parameters
factorthe real factor to be used
Returns
a new distribution object

Rescaling the law X by some real factor f

Author
Alain Jean-Marie
Parameters
factorthe factor f
Returns
the law f*X

Implements Distribution.

double poissonDistribution::sample ( )
virtual

Sample from the Poisson distibution. Uses the "R" package.

Implements Distribution.

std::string poissonDistribution::toString ( )
virtual

an utility to convert the distribution into a string.

Returns
the string representing the distribution.

Printing a representation of the law into a string

Author
Alain Jean-Marie
Returns
a string

Implements Distribution.

double poissonDistribution::variance ( )

Computing the variance of the random variable: the second moment minus the square of the first moment. Variance is the square of the coefficient of variation. The Distribution class offers a default implementation.

Returns
the variance
void poissonDistribution::write ( FILE *  out,
int  mode 
)
virtual

an utility to write the distribution to some file, according to some format.

Parameters
outthe file descriptor of the file
modea code for the format to be used

Printing a representation of the law

Author
Alain Jean-Marie
Parameters
outthe output stream
moderepresentation for the output

Implements Distribution.


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