## Types in MathNet.Numerics.Distributions

Type Gamma

Namespace MathNet.Numerics.Distributions

Interfaces IContinuousDistribution

The Gamma distribution is parametrized by a shape and inverse scale parameter. When we want to specify a Gamma distribution which is a point distribution we set the shape parameter to be the location of the point distribution and the inverse scale as positive infinity. The distribution with shape and inverse scale both zero is undefined. Random number generation for the Gamma distribution is based on the algorithm in: "A Simple Method for Generating Gamma Variables" - Marsaglia & Tsang ACM Transactions on Mathematical Software, Vol. 26, No. 3, September 2000, Pages 363–372.

### Public Constructors

#### Gamma(double shape, double rate, Random randomSource)

Initializes a new instance of the Gamma class.
##### Parameters
###### `double` shape

The shape (k, α) of the Gamma distribution. Range: α ≥ 0.

###### `double` rate

The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

###### `Random` randomSource

The random number generator which is used to draw random samples.

#### Gamma(double shape, double rate)

Initializes a new instance of the Gamma class.
##### Parameters
###### `double` shape

The shape (k, α) of the Gamma distribution. Range: α ≥ 0.

###### `double` rate

The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

### Public Static Functions

#### doubleCDF(double shape, double rate, double x)

Computes the cumulative distribution (CDF) of the distribution at x, i.e. P(X ≤ x).
##### Parameters
###### `double` shape

The shape (k, α) of the Gamma distribution. Range: α ≥ 0.

###### `double` rate

The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

###### `double` x

The location at which to compute the cumulative distribution function.

##### Return
###### `double`

the cumulative distribution at location x.

#### doubleInvCDF(double shape, double rate, double p)

Computes the inverse of the cumulative distribution function (InvCDF) for the distribution at the given probability. This is also known as the quantile or percent point function.
##### Parameters
###### `double` shape

The shape (k, α) of the Gamma distribution. Range: α ≥ 0.

###### `double` rate

The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

###### `double` p

The location at which to compute the inverse cumulative density.

##### Return
###### `double`

the inverse cumulative density at p.

#### boolIsValidParameterSet(double shape, double rate)

Tests whether the provided values are valid parameters for this distribution.
##### Parameters
###### `double` shape

The shape (k, α) of the Gamma distribution. Range: α ≥ 0.

###### `double` rate

The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

#### doublePDF(double shape, double rate, double x)

Computes the probability density of the distribution (PDF) at x, i.e. ∂P(X ≤ x)/∂x.
##### Parameters
###### `double` shape

The shape (k, α) of the Gamma distribution. Range: α ≥ 0.

###### `double` rate

The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

###### `double` x

The location at which to compute the density.

##### Return
###### `double`

the density at x.

#### doublePDFLn(double shape, double rate, double x)

Computes the log probability density of the distribution (lnPDF) at x, i.e. ln(∂P(X ≤ x)/∂x).
##### Parameters
###### `double` shape

The shape (k, α) of the Gamma distribution. Range: α ≥ 0.

###### `double` rate

The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

###### `double` x

The location at which to compute the density.

##### Return
###### `double`

the log density at x.

#### doubleSample(Random rnd, double shape, double rate)

Generates a sample from the Gamma distribution.
##### Parameters
###### `Random` rnd

The random number generator to use.

###### `double` shape

The shape (k, α) of the Gamma distribution. Range: α ≥ 0.

###### `double` rate

The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

##### Return
###### `double`

a sample from the distribution.

#### doubleSample(double shape, double rate)

Generates a sample from the Gamma distribution.
##### Parameters
###### `double` shape

The shape (k, α) of the Gamma distribution. Range: α ≥ 0.

###### `double` rate

The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

##### Return
###### `double`

a sample from the distribution.

#### IEnumerable<double>Samples(Random rnd, double shape, double rate)

Generates a sequence of samples from the Gamma distribution.
##### Parameters
###### `Random` rnd

The random number generator to use.

###### `double` shape

The shape (k, α) of the Gamma distribution. Range: α ≥ 0.

###### `double` rate

The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

##### Return
###### `IEnumerable<double>`

a sequence of samples from the distribution.

#### voidSamples(Random rnd, Double[] values, double shape, double rate)

Fills an array with samples generated from the distribution.
##### Parameters
###### `Random` rnd

The random number generator to use.

###### `Double[]` values

The array to fill with the samples.

###### `double` shape

The shape (k, α) of the Gamma distribution. Range: α ≥ 0.

###### `double` rate

The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

##### Return
###### `void`

a sequence of samples from the distribution.

#### IEnumerable<double>Samples(double shape, double rate)

Generates a sequence of samples from the Gamma distribution.
##### Parameters
###### `double` shape

The shape (k, α) of the Gamma distribution. Range: α ≥ 0.

###### `double` rate

The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

##### Return
###### `IEnumerable<double>`

a sequence of samples from the distribution.

#### voidSamples(Double[] values, double shape, double rate)

Fills an array with samples generated from the distribution.
##### Parameters
###### `Double[]` values

The array to fill with the samples.

###### `double` shape

The shape (k, α) of the Gamma distribution. Range: α ≥ 0.

###### `double` rate

The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

##### Return
###### `void`

a sequence of samples from the distribution.

#### GammaWithShapeRate(double shape, double rate, Random randomSource)

Constructs a Gamma distribution from a shape and inverse scale parameter. The distribution will be initialized with the default random number generator.
##### Parameters
###### `double` shape

The shape (k, α) of the Gamma distribution. Range: α ≥ 0.

###### `double` rate

The rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

###### `Random` randomSource

The random number generator which is used to draw random samples. Optional, can be null.

#### GammaWithShapeScale(double shape, double scale, Random randomSource)

Constructs a Gamma distribution from a shape and scale parameter. The distribution will be initialized with the default random number generator.
##### Parameters
###### `double` shape

The shape (k) of the Gamma distribution. Range: k ≥ 0.

###### `double` scale

The scale (θ) of the Gamma distribution. Range: θ ≥ 0

###### `Random` randomSource

The random number generator which is used to draw random samples. Optional, can be null.

### Public Methods

#### doubleCumulativeDistribution(double x)

Computes the cumulative distribution (CDF) of the distribution at x, i.e. P(X ≤ x).
##### Parameters
###### `double` x

The location at which to compute the cumulative distribution function.

##### Return
###### `double`

the cumulative distribution at location x.

#### doubleDensity(double x)

Computes the probability density of the distribution (PDF) at x, i.e. ∂P(X ≤ x)/∂x.
##### Parameters
###### `double` x

The location at which to compute the density.

##### Return
###### `double`

the density at x.

#### doubleDensityLn(double x)

Computes the log probability density of the distribution (lnPDF) at x, i.e. ln(∂P(X ≤ x)/∂x).
##### Parameters
###### `double` x

The location at which to compute the log density.

##### Return
###### `double`

the log density at x.

#### doubleInverseCumulativeDistribution(double p)

Computes the inverse of the cumulative distribution function (InvCDF) for the distribution at the given probability. This is also known as the quantile or percent point function.
##### Parameters
###### `double` p

The location at which to compute the inverse cumulative density.

##### Return
###### `double`

the inverse cumulative density at p.

#### doubleSample()

Generates a sample from the Gamma distribution.
##### Return
###### `double`

a sample from the distribution.

#### voidSamples(Double[] values)

Fills an array with samples generated from the distribution.

#### IEnumerable<double>Samples()

Generates a sequence of samples from the Gamma distribution.
##### Return
###### `IEnumerable<double>`

a sequence of samples from the distribution.

#### stringToString()

A string representation of the distribution.
##### Return
###### `string`

a string representation of the distribution.

### Public Properties

#### doubleEntropy get;

Gets the entropy of the Gamma distribution.

#### doubleMaximum get;

Gets the maximum of the Gamma distribution.

#### doubleMean get;

Gets the mean of the Gamma distribution.

#### doubleMedian get;

Gets the median of the Gamma distribution.

#### doubleMinimum get;

Gets the minimum of the Gamma distribution.

#### doubleMode get;

Gets the mode of the Gamma distribution.

#### RandomRandomSource get; set;

Gets or sets the random number generator which is used to draw random samples.

#### doubleRate get;

Gets or sets the rate or inverse scale (β) of the Gamma distribution. Range: β ≥ 0.

#### doubleScale get;

Gets or sets the scale (θ) of the Gamma distribution.

#### doubleShape get;

Gets or sets the shape (k, α) of the Gamma distribution. Range: α ≥ 0.

#### doubleSkewness get;

Gets the skewness of the Gamma distribution.

#### doubleStdDev get;

Gets the standard deviation of the Gamma distribution.

#### doubleVariance get;

Gets the variance of the Gamma distribution.