The geometric distribution with starting value 0. The parameter "p" is called "ratio". The Geometric distribution is discrete but does not inherit from discreteDistribution because its range is infinite.
More...
#include <geometricDistribution.h>
|
| geometricDistribution (double p) |
| Unique constructor for the class, from its "ratio". More...
|
|
double | getProba (double k) |
| Function to obtain the probability of a specific value k. More...
|
|
double | p () |
| Function to obtain the parameter (or ratio) of the distribution. Redundant with p() but defined to be more explicit. More...
|
|
double | getRatio () |
| Function to obtain the parameter (or ratio) of the distribution. Redundant with getRatio() but defined according to the coding convention. More...
|
|
double | mean () |
| Function to obtain the mean (expectation). Its value is 1/(1-_p) More...
|
|
double | rate () |
|
double | moment (int order) |
| Computing the moments of the distribution. 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) |
|
bool | hasMoment (int order) |
| Test of existence of a moment. These distributions always have one. More...
|
|
geometricDistribution * | rescale (double factor) |
| Rescaling the distribution. Geometric distributions cannot be rescaled. A copy is returned. A warning is issued if the factor is not 1.0. More...
|
|
geometricDistribution * | copy () |
| copying a distribution. Typically implemented as rescale(1.0). More...
|
|
double | sample () |
| Sampling from the distribution. The method uses the fact that the integer part of an exponential random variable is a geometric random variable. More...
|
|
std::string | toString () |
|
void | write (FILE *out, int mode) |
|
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...
|
|
The geometric distribution with starting value 0. The parameter "p" is called "ratio". The Geometric distribution is discrete but does not inherit from discreteDistribution because its range is infinite.
- Author
- Alain Jean-Marie
geometricDistribution::geometricDistribution |
( |
double |
p | ) |
|
Unique constructor for the class, from its "ratio".
- Author
- Alain Jean-Marie
- Parameters
-
p | the probability of being larger than 0 |
Constructor for a geometric distribution The mean is calculated at creation. The value p = 1 is admitted, in which case the law is a Dirac at infinity and has no moments.
- Author
- Alain Jean-Marie
- Parameters
-
p | the probability of being non 0 |
- Returns
- an object of type geometricDistribution
double geometricDistribution::cdf |
( |
double |
x | ) |
|
|
virtual |
- Parameters
-
- Returns
- double
Computation of the cumulative density function at some real point x. Based on the formula P(X >= k) = p^k for integer k so that P( X <= x ) = P( X <= floor(x) ) = 1 - P( X >= floor(x) + 1 ) = 1 - p^( floor(x) + 1 )
- Author
- Alain Jean-Marie
- Parameters
-
x | value at which the CDF is computed |
- Returns
- CDF(x)
Implements Distribution.
copying a distribution. Typically implemented as rescale(1.0).
- See also
- rescale(double)
- Returns
- a copy of the distribution
Implements Distribution.
double geometricDistribution::dLaplace |
( |
double |
s | ) |
|
|
virtual |
computing the derivative of the Laplace transform at real points
- Parameters
-
s | the 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
-
s | value at which the derivative is computed |
- Returns
- d LT(s)/ds
Implements Distribution.
double geometricDistribution::getProba |
( |
double |
k | ) |
|
Function to obtain the probability of a specific value k.
- Parameters
-
k | the 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
-
k | value at which the probability is computed |
- Returns
- P( X = k )
double geometricDistribution::getRatio |
( |
| ) |
|
|
inline |
Function to obtain the parameter (or ratio) of the distribution. Redundant with getRatio() but defined according to the coding convention.
- Returns
- double
bool geometricDistribution::hasMoment |
( |
int |
order | ) |
|
|
virtual |
Test of existence of a moment. These distributions always have one.
- Author
- Alain Jean-Marie
- Parameters
-
- Returns
- true
Test of existence of a moment. These distributions always have one.
- Author
- Alain Jean-Marie
- Parameters
-
- Returns
- true iff p < 1.0
Implements Distribution.
double geometricDistribution::laplace |
( |
double |
s | ) |
|
|
virtual |
computing the Laplace transform of the distribution at real point
- Parameters
-
s | the 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
-
s | value at which the derivative is computed |
- Returns
- LT(s)
Implements Distribution.
double geometricDistribution::mean |
( |
| ) |
|
|
virtual |
Function to obtain the mean (expectation). Its value is 1/(1-_p)
- See also
- geometricDistribution::_p
- Returns
- the mathematical expectation of the distribution
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 geometricDistribution::moment |
( |
int |
order | ) |
|
|
virtual |
Computing the moments of the distribution.
- Parameters
-
order | the order of the moment to be computed |
- Returns
- the moment
Calculation of the of order n
- Author
- Alain Jean-Marie
- Parameters
-
- Returns
- the moment
Implements Distribution.
double geometricDistribution::p |
( |
| ) |
|
|
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 geometricDistribution::rate |
( |
| ) |
|
|
virtual |
- Returns
- double
Calculation of the rate, which is the inverse of the mean
- Author
- Alain Jean-Marie
- Returns
- the rate
Implements Distribution.
Rescaling the distribution. Geometric distributions cannot be rescaled. A copy is returned. A warning is issued if the factor is not 1.0.
- Parameters
-
factor | the factor by which to rescale |
- Returns
- the rescaled distribution.
Implements Distribution.
double geometricDistribution::sample |
( |
| ) |
|
|
virtual |
Sampling from the distribution. The method uses the fact that the integer part of an exponential random variable is a geometric random variable.
- Returns
- a sample from the geometric distribution
Implements Distribution.
std::string geometricDistribution::toString |
( |
| ) |
|
|
virtual |
void geometricDistribution::write |
( |
FILE * |
out, |
|
|
int |
mode |
|
) |
| |
|
virtual |
The documentation for this class was generated from the following files: