Report a bug
If you spot a problem with this page, click here to create a GitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
a local clone.
mir.stat.distribution.gamma
This module contains algorithms for the Gamma Distribution.
This module uses the shape/scale parameterization of the gamma distribution. To
use the shape/rate parameterization, apply the inverse to the rate and pass it
as the scale parameter.
License:
Authors:
Ilia Ki, John Michael Hall
- pure nothrow @nogc @safe T
gammaPDF
(T)(const Tx
, const Tshape
, const Tscale
= 1)
if (isFloatingPoint!T);
pure nothrow @nogc @safe TgammaPDF
(T)(const Tx
, const size_tshape
, const Tscale
= 1)
if (isFloatingPoint!T); - Computes the gamma probability density function (PDF).
shape
values less than 1 are supported when it is a floating point type. Ifshape
is passed as a size_t type (or a type convertible to that), then the PDF is calculated using the relationship with the poisson distribution (i.e. replacing the gamma function with the factorial).Parameters:T x
value to evaluate PDF T shape
shape parameter T scale
scale parameter See Also:Examples:import mir.test: shouldApprox; 2.0.gammaPDF(3.0).shouldApprox == 0.2706706; 2.0.gammaPDF(3.0, 4.0).shouldApprox == 0.01895408; // Calling with `size_t` uses factorial function instead of gamma, but // produces same results 2.0.gammaPDF(3).shouldApprox == 2.0.gammaPDF(3.0); 2.0.gammaPDF(3, 4.0).shouldApprox == 2.0.gammaPDF(3.0, 4.0);
- pure nothrow @nogc @safe T
gammaCDF
(T)(const Tx
, const Tshape
, const Tscale
= 1)
if (isFloatingPoint!T); - Computes the gamma cumulative distribution function (CDF).Parameters:
T x
value to evaluate CDF T shape
shape parameter T scale
scale parameter See Also:Examples:import mir.test: shouldApprox; 2.0.gammaCDF(5).shouldApprox == 0.05265302; 1.0.gammaCDF(5, 0.5).shouldApprox == 0.05265302;
- pure nothrow @nogc @safe T
gammaCCDF
(T)(const Tx
, const Tshape
, const Tscale
= 1)
if (isFloatingPoint!T); - Computes the gamma complementary cumulative distribution function (CCDF).Parameters:
T x
value to evaluate CCDF T shape
shape parameter T scale
scale parameter See Also:Examples:import mir.test: shouldApprox; 2.0.gammaCCDF(5).shouldApprox == 0.947347; 1.0.gammaCCDF(5, 0.5).shouldApprox == 0.947347;
- pure nothrow @nogc @safe T
gammaInvCDF
(T)(const Tp
, const Tshape
, const Tscale
= 1)
if (isFloatingPoint!T); - Computes the gamma inverse cumulative distribution function (InvCDF).Parameters:
T p
value to evaluate InvCDF T shape
shape parameter T scale
scale parameter See Also:Examples:import mir.test: shouldApprox; 0.05.gammaInvCDF(5).shouldApprox == 1.97015; 0.05.gammaInvCDF(5, 0.5).shouldApprox == 0.9850748;
- pure nothrow @nogc @safe T
gammaLPDF
(T)(const Tx
, const Tshape
, const Tscale
= 1)
if (isFloatingPoint!T);
pure nothrow @nogc @safe TgammaLPDF
(T)(const Tx
, const size_tshape
, const Tscale
= 1)
if (isFloatingPoint!T); - Computes the gamma log probability density function (LPDF).
shape
values less than 1 are supported when it is a floating point type. Ifshape
is passed as a size_t type (or a type convertible to that), then the LPDF is calculated using the relationship with the poisson distribution (i.e. replacing the logGamma function with the logFactorial).Parameters:T x
value to evaluate LPDF T shape
shape parameter T scale
scale parameter See Also:Examples:import mir.test: shouldApprox; 2.0.gammaLPDF(3.0).shouldApprox == -1.306853; 2.0.gammaLPDF(3.0, 4.0).shouldApprox == -3.965736; // Calling with `size_t` uses log factorial function instead of log gamma, // but produces same results 2.0.gammaLPDF(3).shouldApprox == 2.0.gammaLPDF(3.0); 2.0.gammaLPDF(3, 4.0).shouldApprox == 2.0.gammaLPDF(3.0, 4.0);
Copyright © 2016-2023 by Ilya Yaroshenko | Page generated by
Ddoc on Wed Oct 18 12:23:06 2023