IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
Represents a Gamma distribution. More...
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.
| |||
override double | LeftProbability (double x) | ||
Returns the cumulative probability to the left of (below) the given point.
| |||
override double | RightProbability (double x) | ||
Return the cumulative probability to the right of (above) the given point.
| |||
override double | Moment (int r) | ||
Computes a raw moment of the distribution.
| |||
override double | MomentAboutMean (int r) | ||
Computes a central moment of the distribution.
| |||
override double | Cumulant (int r) | ||
Computes a cumulant of the distribution.
| |||
override double | InverseLeftProbability (double P) | ||
Returns the point at which the cumulative distribution function attains a given value.
| |||
override double | GetRandomValue (Random rng) | ||
Returns a random value.
| |||
![]() | |||
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] |
![]() | |
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... | |
![]() | |
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 |
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.
|
inline |
Initializes a new instance of a Gamma distribution with the given parameters.
shape | The shape parameter, which must be positive. |
scale | The scale parameter, which must be positive. |
References Meta.Numerics.Functions.AdvancedMath.Gamma(), and Meta.Numerics.Functions.AdvancedMath.LogGamma().
|
inline |
Initializes a new instance of the standard Gamma distribution.
shape | The shape parameter, which must be positive. |
|
inlinevirtual |
Returns the probability density at the given point.
x | The reference point. |
Implements Meta.Numerics.Statistics.Distributions.Distribution.
Referenced by Test.DistributionTest.DistributionUnitarityIntegral(), and Meta.Numerics.Statistics.Distributions.ChiSquaredDistribution.ProbabilityDensity().
|
inlinevirtual |
Returns the cumulative probability to the left of (below) the given point.
x | The reference point. |
Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.
References Meta.Numerics.Functions.AdvancedMath.LeftRegularizedGamma().
Referenced by Meta.Numerics.Statistics.Distributions.ChiSquaredDistribution.LeftProbability().
|
inlinevirtual |
Return the cumulative probability to the right of (above) the given point.
x | The reference point. |
Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.
References Meta.Numerics.Functions.AdvancedMath.RightRegularizedGamma().
Referenced by Meta.Numerics.Statistics.Distributions.ChiSquaredDistribution.RightProbability().
|
inlinevirtual |
Computes a raw moment of the distribution.
r | The order of the moment to compute. |
Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.
|
inlinevirtual |
Computes a central moment of the distribution.
r | The order of the moment to compute. |
Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.
|
inlinevirtual |
Computes a cumulant of the distribution.
r | The index of the cumulant to compute. |
Reimplemented from Meta.Numerics.Statistics.Distributions.UnivariateDistribution.
References Meta.Numerics.Functions.AdvancedIntegerMath.Factorial(), and Meta.Numerics.MoreMath.Pow().
|
inlinestaticprivate |
|
inlineprivate |
References Meta.Numerics.MoreMath.Pow().
|
inlineprivate |
|
inlinevirtual |
Returns the point at which the cumulative distribution function attains a given value.
P | The left cumulative probability P, which must lie between 0 and 1. |
Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.
Referenced by Meta.Numerics.Statistics.Distributions.ChiSquaredDistribution.InverseLeftProbability().
|
inlinevirtual |
Returns a random value.
rng | A random number generator. |
Reimplemented from Meta.Numerics.Statistics.Distributions.Distribution.
|
inlinestatic |
Computes the Gamma distribution that best fits the given sample.
sample | The sample to fit. |
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.
ArgumentNullException | sample is null. |
InvalidOperationException | sample contains non-positive values. |
InsufficientDataException | sample 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().
|
private |
|
private |
|
private |
|
private |
|
get |
Gets the shape parameter for the distribution.
Referenced by Test.DistributionTest.DistributionVarianceIntegral(), and Test.SampleTest.GammaFit().
|
get |
Gets the scale parameter for the distribution.
Referenced by Test.SampleTest.GammaFit().
|
get |
Referenced by Test.DistributionTest.DistributionUnitarityIntegral().
|
get |
|
get |
|
get |
|
get |