GammaDistribution Class Reference

marmote: GammaDistribution Class Reference
marmote
marmoteCore is a C++ API dedicated to modeling with Markov chains.

The Gamma distribution with two parameters: shape and scale. More...

#include <marmoteGammaDistribution.h>

+ Inheritance diagram for GammaDistribution:

Public Member Functions

 GammaDistribution (double shape, double scale)
 Constructor for the Gamma distribution from its shape and scale parameters. The mean is calculated at creation.
 
double shape ()
 
double rate ()
 
double scale ()
 
double Mean () const override
 computing the mathematical expectation or mean
 
double Rate () const override
 Computation of the "rate", defined as the inverse of the mean.
 
double Moment (int order) const override
 
double Variance () const override
 Computation of 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.
 
double Laplace (double s) const override
 Computation of the Laplace transform of the distribution at real point.
 
double DLaplace (double s) const override
 Computation of the derivative of the Laplace transform at real points.
 
double Cdf (double x) const override
 Computation of the cumulative distribution function at some real point x. This is the probability that the random variable is less or equal to x.
 
bool HasMoment (int) const override
 Test for the existence of moments of any order.
 
GammaDistributionRescale (double factor) const override
 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).
 
virtual GammaDistributionCopy () const override
 Copying a distribution. Implemented by default as Rescale(1.0).
 
double Sample () override
 drawing a (pseudo)random value according to the distribution.
 
void Write (std::ostream *out, inoutFormat format) const override
 Utility to write the a representation of the distribution to some stream, according to some format.
 
- Public Member Functions inherited from Distribution
 Distribution ()=default
 Standard constructor.
 
virtual ~Distribution ()=default
 Standard destructor.
 
std::string name ()
 Accessor to the type name of the distribution.
 
virtual double Ccdf (double x) const
 Computation of 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.
 
virtual void IidSample (unsigned long 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().
 
virtual bool HasProperty (std::string pro) const
 Property test function. Current properties are:
 
virtual std::string toString (inoutFormat format) const
 Utility to convert the distribution into a string.
 
void fprint () const
 write on standard output with the standard marmote format
 
std::string toString (void) const
 
- Public Member Functions inherited from marmote::Object
 Object (void)
 
virtual ~Object (void)
 
const std::string & className (void) const
 
void setClassName (const std::string &)
 
std::string toString (void) const
 
std::string content (void) const
 
std::string info (void) const
 

Protected Member Functions

std::string content_impl (void) const override
 
std::string info_impl (void) const override
 
- Protected Member Functions inherited from Distribution
std::string toString_impl (void) const override
 

Protected Attributes

double shape_
 
double rate_
 
double scale_
 
- Protected Attributes inherited from Distribution
std::string name_
 
double mean_ = 0.0
 

Additional Inherited Members

- Static Public Member Functions inherited from Distribution
static double Distance (distType type, Distribution *d1, Distribution *d2)
 Computing generally some distance between two distributions.
 
static double DistanceL1 (Distribution *d1, Distribution *d2)
 Computing generally the L1 distance between two distributions.
 
static double DistanceL2 (Distribution *d1, Distribution *d2)
 Computing generally the L2 distance between two distributions.
 
static double DistanceLInfinity (Distribution *d1, Distribution *d2)
 Computing generally the L-infinity distance between two distributions.
 
static double DistanceTV (Distribution *d1, Distribution *d2)
 Computing generally the total variation distance between two distributions.
 
static double U_0_1 (void)
 
static double Exponential (double Mean)
 
- Static Protected Attributes inherited from Distribution
static const double VALUE_TOLERANCE = 1.0e-8
 
static const double VALUE_SUMPROBAS = 1.0e-10
 
static const std::string distance_name [4] = { "L1", "L2", "L-infinity", "TV" }
 

Detailed Description

The Gamma distribution with two parameters: shape and scale.

Constructor & Destructor Documentation

◆ GammaDistribution()

GammaDistribution::GammaDistribution ( double shape,
double scale )

Constructor for the Gamma distribution from its shape and scale parameters. The mean is calculated at creation.

Author
Alain Jean-Marie
Parameters
shapethe shape parameter
scalethe rate parameter

Member Function Documentation

◆ Cdf()

double GammaDistribution::Cdf ( double x) const
overridevirtual

Computation of 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

Implements Distribution.

◆ content_impl()

std::string GammaDistribution::content_impl ( void ) const
overrideprotectedvirtual

Reimplemented from marmote::Object.

◆ Copy()

GammaDistribution * GammaDistribution::Copy ( ) const
overridevirtual

Copying a distribution. Implemented by default as Rescale(1.0).

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

Reimplemented from Distribution.

Reimplemented in ErlangDistribution, and ExponentialDistribution.

◆ DLaplace()

double GammaDistribution::DLaplace ( double s) const
overridevirtual

Computation of 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: d LT(s)/ds

Implements Distribution.

◆ HasMoment()

bool GammaDistribution::HasMoment ( int ) const
overridevirtual

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.

◆ info_impl()

std::string GammaDistribution::info_impl ( void ) const
overrideprotectedvirtual

Reimplemented from marmote::Object.

◆ Laplace()

double GammaDistribution::Laplace ( double s) const
overridevirtual

Computation of the Laplace transform of the distribution at real point.

Parameters
sthe value at which to compute
Returns
the value of the Laplace transform: LT(s)

Implements Distribution.

◆ Mean()

double GammaDistribution::Mean ( ) const
overridevirtual

computing the mathematical expectation or mean

Returns
the mean

Implements Distribution.

◆ Moment()

double GammaDistribution::Moment ( int order) const
overridevirtual

These distributions always have a moment.

Implements Distribution.

◆ Rate()

double GammaDistribution::Rate ( ) const
overridevirtual

Computation of the "rate", defined as the inverse of the mean.

Returns
the rate

Implements Distribution.

◆ rate()

double GammaDistribution::rate ( )
inline

◆ Rescale()

GammaDistribution * GammaDistribution::Rescale ( double factor) const
overridevirtual

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, f
Returns
a new distribution object, the distribution of f.X

Implements Distribution.

◆ Sample()

double GammaDistribution::Sample ( )
overridevirtual

drawing a (pseudo)random value according to the distribution.

Returns
a sample

Implements Distribution.

◆ scale()

double GammaDistribution::scale ( )
inline

◆ shape()

double GammaDistribution::shape ( )
inline

◆ Variance()

double GammaDistribution::Variance ( ) const
overridevirtual

Computation of 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

Reimplemented from Distribution.

◆ Write()

void GammaDistribution::Write ( std::ostream * out,
inoutFormat format ) const
overridevirtual

Utility to write the a representation of the distribution to some stream, according to some format.

Parameters
outthe descriptor of the stream on which to write
formata code for the output format to be used

Implements Distribution.

Field Documentation

◆ rate_

double GammaDistribution::rate_
protected

rate parameter "beta" of the distribution

◆ scale_

double GammaDistribution::scale_
protected

scale parameter "theta" of the distribution

◆ shape_

double GammaDistribution::shape_
protected

shape parameter "k" of the distribution


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