Gamma

Package: Libraries.Compute.Statistics.Distributions · Inherits from: Libraries.Language.Object

This class, ported from Apache Commons, is an implementation of the Gamma Distribution. More information can be found here: https://en.wikipedia.org/wiki/Gamma_distribution

Variables

  • number DEFAULT_EPSILON

Actions

Gamma(number x)

* The constant {@code C12} defined in {@code DGAM1}.

Parameters

  • x number

Returns

number

InvGamma1pm1(number x)

* From the recurrence relation * Gamma(x) = (x - 1) * ... * (x - n) * Gamma(x - n), * then * Gamma(t) = 1 / [1 + invGamma1pm1(t - 1)], * where t = x - n. This means that t must satisfy * -0.5 <= t - 1 <= 1.5.

Parameters

  • x number

Returns

number

Lanczos(number x)

* From the reflection formula * Gamma(x) * Gamma(1 - x) * sin(pi * x) = pi, * and the recurrence relation * Gamma(1 - x) = -x * Gamma(-x), * it is found * Gamma(x) = -pi / [x * sin(pi * x) * Gamma(-x)].

Parameters

  • x number

Returns

number

LogGamma(number x)

Computes the function ln(Gamma(x)). This is adapted from Apache Commons. The implementation is based on:

Parameters

  • x number: the value.

Returns

number: the log gamma function ln(Gamma(x))

LogGamma1p(number x)

* From the recurrence relation * Gamma(x) = Gamma(x + n + 1) / [x * (x + 1) * ... * (x + n)] * then * Gamma(x + n + 1) = 1 / [1 + invGamma1pm1(x + n)], * which requires -0.5 <= x + n <= 1.5.

Parameters

  • x number

Returns

number

RegularizedGammaP(number a, number x)

Returns the regularized gamma function P(a, x). The action is ported from Apache Commons. This uses the default epsilon (error) and the maximum number of iterations is the largest possible integer.

Parameters

  • a number: the a parameter.
  • x number: the value.

Returns

number: the regularized gamma function P(a, x)

RegularizedGammaP(number a, number x, number epsilon, integer maxIterations)

Returns the regularized gamma function P(a, x). The action is ported from Apache Commons The implementation of this method is based on:

Parameters

  • a number: the a parameter.
  • x number: the value.
  • epsilon number: When the absolute value of the nth item in the series is less than epsilon the approximation ceases to calculate further elements in the series.
  • maxIterations integer: Maximum number of "iterations" to complete.

Returns

number: the regularized gamma function P(a, x)

RegularizedGammaQ(number a, number x)

Returns the regularized gamma function Q(a, x) = 1 - P(a, x). This is adapted from Apache Commons.

Parameters

  • a number: the a parameter.
  • x number: the value.

Returns

number: the regularized gamma function P(a, x)

RegularizedGammaQ(number a, number x, number epsilon, integer maxIterations)

Returns the regularized gamma function Q(a, x) = 1 - P(a, x). This is adapted from Apache Commons. The implementation of this method is based on:

Parameters

  • a number: the a parameter.
  • x number: the value.
  • epsilon number: When the absolute value of the nth item in the series is less than epsilon the approximation ceases to calculate further elements in the series.
  • maxIterations integer: Maximum number of "iterations" to complete.

Returns

number: the regularized gamma function P(a, x)

Inherited Actions

3 actions from Libraries.Language.Object