IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Meta.Numerics.Statistics.Distributions.GammaDistribution Class Reference

Represents a Gamma distribution. More...

+ Inheritance diagram for Meta.Numerics.Statistics.Distributions.GammaDistribution:
+ Collaboration diagram for Meta.Numerics.Statistics.Distributions.GammaDistribution:

Public Member Functions

 GammaDistribution (double shape, double scale)
 Initializes a new instance of a Gamma distribution with the given parameters. More...
 
 GammaDistribution (double shape)
 Initializes a new instance of the standard Gamma distribution. More...
 
override double ProbabilityDensity (double x)
 Returns the probability density at the given point.
Parameters
xThe reference point.
Returns
The probability density p(x).
The probability density function (PDF) gives the relative probability of obtaining different values. More...
 
override double LeftProbability (double x)
 Returns the cumulative probability to the left of (below) the given point.
Parameters
xThe reference point.
Returns
The integrated probability to obtain a result below the reference point.
The left probability function is commonly called the cumulative distribution function (CDF). More...
 
override double RightProbability (double x)
 Return the cumulative probability to the right of (above) the given point.
Parameters
xThe reference point.
Returns
The integrated probability 1-P(x1) to obtain a result above the reference point.
In survival analysis, the right probability function is commonly called the survival function, because it gives the fraction of the population remaining after the given time. More...
 
override double Moment (int r)
 Computes a raw moment of the distribution.
Parameters
rThe order of the moment to compute.
Returns
The rth raw moment of the distribution.
See also
Moment
More...
 
override double MomentAboutMean (int r)
 Computes a central moment of the distribution.
Parameters
rThe order of the moment to compute.
Returns
The rth central moment of the distribution.
See also
Moment
More...
 
override double Cumulant (int r)
 Computes a cumulant of the distribution.
Parameters
rThe index of the cumulant to compute.
Returns
The rth cumulant of the distribution.
More...
 
override double InverseLeftProbability (double P)
 Returns the point at which the cumulative distribution function attains a given value.
Parameters
PThe left cumulative probability P, which must lie between 0 and 1.
Returns
The value x at which LeftProbability equals P.
The inverse left probability is commonly called the quantile function. Given a quantile, it tells which variable value is the lower border of that quantile. More...
 
override double GetRandomValue (Random rng)
 Returns a random value.
Parameters
rngA random number generator.
Returns
A number distributed according to the distribution.
Note that the random number generator rng will be advanced by this method. The next call to its generator methods will not give the same value as it would had it not been passed to this method. More...
 
- Public Member Functions inherited from Meta.Numerics.Statistics.Distributions.Distribution
virtual double InverseRightProbability (double Q)
 Returns the point at which the right probability function attains the given value. More...
 
virtual double ExpectationValue (Func< double, double > f)
 Computes the expectation value of the given function. More...
 

Static Public Member Functions

static FitResult FitToSample (Sample sample)
 Computes the Gamma distribution that best fits the given sample. More...
 

Properties

double ShapeParameter [get]
 Gets the shape parameter for the distribution. More...
 
double ScaleParameter [get]
 Gets the scale parameter for the distribution. More...
 
override Interval Support [get]
 
override double Mean [get]
 
override double Variance [get]
 
override double Skewness [get]
 
override double ExcessKurtosis [get]
 
- Properties inherited from Meta.Numerics.Statistics.Distributions.Distribution
virtual double Median [get]
 Gets the median of the distribution. More...
 
virtual Interval Support [get]
 Gets the interval over which the distribution is nonvanishing. More...
 
- Properties inherited from Meta.Numerics.Statistics.Distributions.UnivariateDistribution
virtual double Mean [get]
 Gets the mean of the distribution. More...
 
virtual double Variance [get]
 Gets the variance of the distribution. More...
 
virtual double StandardDeviation [get]
 Gets the standard deviation of the distribution. More...
 
virtual double Skewness [get]
 Gets the skewness of the distribution. More...
 
virtual double ExcessKurtosis [get]
 Gets the excess kurtosis of the distribution. More...
 

Private Member Functions

double ApproximateInverseStandardGamma (double P, double Q)
 
double InverseLeftStandardGamma (double P)
 

Static Private Member Functions

static double ApproximateProbit (double P)
 

Private Attributes

readonly double a
 
readonly double s
 
readonly double ga
 
readonly IDeviateGenerator gammaRng
 

Detailed Description

Represents a Gamma distribution.

The sum of n exponentially distributed variates is a Gamma distributed variate.

When the shape parameter is an integer, the Gamma distribution is also called the Erlang distribution. When the shape parameter is one, the Gamma distribution reduces to the exponential distribution.

See also
ExponentialDistribution

Constructor & Destructor Documentation

Meta.Numerics.Statistics.Distributions.GammaDistribution.GammaDistribution ( double  shape,
double  scale 
)
inline

Initializes a new instance of a Gamma distribution with the given parameters.

Parameters
shapeThe shape parameter, which must be positive.
scaleThe scale parameter, which must be positive.

References Meta.Numerics.Functions.AdvancedMath.Gamma(), and Meta.Numerics.Functions.AdvancedMath.LogGamma().

Meta.Numerics.Statistics.Distributions.GammaDistribution.GammaDistribution ( double  shape)
inline

Initializes a new instance of the standard Gamma distribution.

Parameters
shapeThe shape parameter, which must be positive.

Member Function Documentation

override double Meta.Numerics.Statistics.Distributions.GammaDistribution.ProbabilityDensity ( double  x)
inlinevirtual

Returns the probability density at the given point.

Parameters
xThe reference point.
Returns
The probability density p(x).
The probability density function (PDF) gives the relative probability of obtaining different values.

Implements Meta.Numerics.Statistics.Distributions.Distribution.

Referenced by Test.DistributionTest.DistributionUnitarityIntegral(), and Meta.Numerics.Statistics.Distributions.ChiSquaredDistribution.ProbabilityDensity().

override double Meta.Numerics.Statistics.Distributions.GammaDistribution.LeftProbability ( double  x)
inlinevirtual

Returns the cumulative probability to the left of (below) the given point.

Parameters
xThe reference point.
Returns
The integrated probability to obtain a result below the reference point.
The left probability function is commonly called the cumulative distribution function (CDF).

Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.

References Meta.Numerics.Functions.AdvancedMath.LeftRegularizedGamma().

Referenced by Meta.Numerics.Statistics.Distributions.ChiSquaredDistribution.LeftProbability().

override double Meta.Numerics.Statistics.Distributions.GammaDistribution.RightProbability ( double  x)
inlinevirtual

Return the cumulative probability to the right of (above) the given point.

Parameters
xThe reference point.
Returns
The integrated probability 1-P(x1) to obtain a result above the reference point.
In survival analysis, the right probability function is commonly called the survival function, because it gives the fraction of the population remaining after the given time.

Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.

References Meta.Numerics.Functions.AdvancedMath.RightRegularizedGamma().

Referenced by Meta.Numerics.Statistics.Distributions.ChiSquaredDistribution.RightProbability().

override double Meta.Numerics.Statistics.Distributions.GammaDistribution.Moment ( int  r)
inlinevirtual

Computes a raw moment of the distribution.

Parameters
rThe order of the moment to compute.
Returns
The rth raw moment of the distribution.
See also
Moment

Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.

override double Meta.Numerics.Statistics.Distributions.GammaDistribution.MomentAboutMean ( int  r)
inlinevirtual

Computes a central moment of the distribution.

Parameters
rThe order of the moment to compute.
Returns
The rth central moment of the distribution.
See also
Moment

Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.

override double Meta.Numerics.Statistics.Distributions.GammaDistribution.Cumulant ( int  r)
inlinevirtual

Computes a cumulant of the distribution.

Parameters
rThe index of the cumulant to compute.
Returns
The rth cumulant of the distribution.

Reimplemented from Meta.Numerics.Statistics.Distributions.UnivariateDistribution.

References Meta.Numerics.Functions.AdvancedIntegerMath.Factorial(), and Meta.Numerics.MoreMath.Pow().

static double Meta.Numerics.Statistics.Distributions.GammaDistribution.ApproximateProbit ( double  P)
inlinestaticprivate
double Meta.Numerics.Statistics.Distributions.GammaDistribution.ApproximateInverseStandardGamma ( double  P,
double  Q 
)
inlineprivate
double Meta.Numerics.Statistics.Distributions.GammaDistribution.InverseLeftStandardGamma ( double  P)
inlineprivate
override double Meta.Numerics.Statistics.Distributions.GammaDistribution.InverseLeftProbability ( double  P)
inlinevirtual

Returns the point at which the cumulative distribution function attains a given value.

Parameters
PThe left cumulative probability P, which must lie between 0 and 1.
Returns
The value x at which LeftProbability equals P.
The inverse left probability is commonly called the quantile function. Given a quantile, it tells which variable value is the lower border of that quantile.

Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.

Referenced by Meta.Numerics.Statistics.Distributions.ChiSquaredDistribution.InverseLeftProbability().

override double Meta.Numerics.Statistics.Distributions.GammaDistribution.GetRandomValue ( Random  rng)
inlinevirtual

Returns a random value.

Parameters
rngA random number generator.
Returns
A number distributed according to the distribution.
Note that the random number generator rng will be advanced by this method. The next call to its generator methods will not give the same value as it would had it not been passed to this method.

Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.

static FitResult Meta.Numerics.Statistics.Distributions.GammaDistribution.FitToSample ( Sample  sample)
inlinestatic

Computes the Gamma distribution that best fits the given sample.

Parameters
sampleThe sample to fit.
Returns
The best fit parameters.

The returned fit parameters are the ShapeParameter and ScaleParameter, in that order. These are the same parameters, in the same order, that are required by the GammaDistribution(double,double) constructor to specify a new Gamma distribution.

Exceptions
ArgumentNullExceptionsample is null.
InvalidOperationExceptionsample contains non-positive values.
InsufficientDataExceptionsample contains fewer than three values.

References Meta.Numerics.Matrices.SymmetricMatrix.CholeskyDecomposition(), Meta.Numerics.Statistics.Sample.Count, Meta.Numerics.Analysis.FunctionMath.FindZero(), Meta.Numerics.Matrices.CholeskyDecomposition.Inverse(), and Meta.Numerics.Functions.AdvancedMath.Psi().

Referenced by Test.SampleTest.GammaFit(), and Test.SampleTest.GammaFitUncertainty().

Member Data Documentation

readonly double Meta.Numerics.Statistics.Distributions.GammaDistribution.a
private
readonly double Meta.Numerics.Statistics.Distributions.GammaDistribution.s
private
readonly double Meta.Numerics.Statistics.Distributions.GammaDistribution.ga
private
readonly IDeviateGenerator Meta.Numerics.Statistics.Distributions.GammaDistribution.gammaRng
private

Property Documentation

double Meta.Numerics.Statistics.Distributions.GammaDistribution.ShapeParameter
get

Gets the shape parameter for the distribution.

Referenced by Test.DistributionTest.DistributionVarianceIntegral(), and Test.SampleTest.GammaFit().

double Meta.Numerics.Statistics.Distributions.GammaDistribution.ScaleParameter
get

Gets the scale parameter for the distribution.

Referenced by Test.SampleTest.GammaFit().

override Interval Meta.Numerics.Statistics.Distributions.GammaDistribution.Support
get
override double Meta.Numerics.Statistics.Distributions.GammaDistribution.Mean
get

override double Meta.Numerics.Statistics.Distributions.GammaDistribution.Variance
get

override double Meta.Numerics.Statistics.Distributions.GammaDistribution.Skewness
get

override double Meta.Numerics.Statistics.Distributions.GammaDistribution.ExcessKurtosis
get


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