GammaFunction

require.mx('mxjs/base/math/statistics/gamma_function.js');

This is a list of utility functions around computing the gamma function.

These implementations are taking from the java package commons:commons-math3:3.6

StatusName
Number gammaCDF ( Number xoverscale, Number shape, Number logGammaShape )

Cumulative density function of the Gamma distribution.

Number gammaPDF ( Number x, Number shape, Number theta, Number gammaShape )

Probability density function of the Gamma distribution.

Number gammaPDF2 ( Number x, Number shape, Number theta, Number logGammaShape )

Probability density function of the Gamma distribution, calculated using lngamma to allow for larger numbers.


Library Functions

cdfvalue = Lib.gammaCDF ( xoverscale, shape, logGammaShape )

Cumulative density function of the Gamma distribution.

Parameters:
  • Number xoverscale - x divided by scale
  • Number shape - shape parameter for the Gamma distribution
  • Number logGammaShape - (optional) LogGamma(shape). If not provided, this will be calculated as needed. However, if you're calling gammaCDF many times with the same shape parameter, it can save some processing to precalculate this value just once and pass it as a parameter.
Returns: Number cdfvalue
pdfvalue = Lib.gammaPDF ( x, shape, theta, gammaShape )

Probability density function of the Gamma distribution.

Parameters:
  • Number x - x
  • Number shape - shape parameter for the Gamma distribution (aka k).
  • Number theta - scale parameter for the Gamma distribution (aka theta).
  • Number gammaShape - (optional) gamma(shape). If not provided, this will be calculated as needed. However, if you're calling gammaPDF many times with the same shape parameter, it can save some processing to precalculate this value just once and pass it as a parameter.
Returns: Number pdfvalue
pdfvalue = Lib.gammaPDF2 ( x, shape, theta, logGammaShape )

Probability density function of the Gamma distribution, calculated using lngamma to allow for larger numbers.

Parameters:
  • Number x - x
  • Number shape - shape parameter for the Gamma distribution (aka k).
  • Number theta - scale parameter for the Gamma distribution (aka theta).
  • Number logGammaShape - (optional) LogGamma(shape). If not provided, this will be calculated as needed. However, if you're calling gammaPDF2 many times with the same shape parameter, it can save some processing to precalculate this value just once and pass it as a parameter.
Returns: Number pdfvalue