mot.library_functions.continuous_distributions package

Submodules

mot.library_functions.continuous_distributions.gamma module

class mot.library_functions.continuous_distributions.gamma.gamma_cdf[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Calculate the Cumulative Distribution Function of the Gamma function.

This computes: lower_incomplete_gamma(k, x/theta) / gamma(k)

With k the shape parameter, theta the scale parameter, lower_incomplete_gamma the lower incomplete gamma function and gamma the complete gamma function.

Function arguments:

  • shape: the shape parameter of the gamma distribution (often denoted \(k\))
  • scale: the scale parameter of the gamma distribution (often denoted \(\theta\))
class mot.library_functions.continuous_distributions.gamma.gamma_logpdf[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Computes the log of the Gamma probability density function using the shape and scale parameterization.

This computes the gamma PDF as:

\[\frac{-x}{\theta} + (k-1)\ln(x) - \ln(\Gamma(k)) - k * \ln(\theta)\]

With \(x\) the desired position, \(k\) the shape and \(\theta\) the scale.

class mot.library_functions.continuous_distributions.gamma.gamma_pdf[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Computes the Gamma probability density function using the shape and scale parameterization.

This computes the gamma PDF as:

\[{\frac{1}{\Gamma (k)\theta ^{k}}}x^{k-1}e^{-{\frac {x}{\theta }}}\]

With \(x\) the desired position, \(k\) the shape and \(\theta\) the scale.

class mot.library_functions.continuous_distributions.gamma.gamma_ppf[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Computes the inverse of the cumulative distribution function of the Gamma distribution.

This is the inverse of the Gamma CDF.

class mot.library_functions.continuous_distributions.gamma.igam[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Complemented incomplete Gamma integral

Also known as the regularized lower incomplete gamma function. Copied from Scipy (https://github.com/scipy/scipy/blob/master/scipy/special/cephes/igam.c), 05-05-2018:

/*                                                     igam.c
 *
 *     Incomplete Gamma integral
 *
 *
 *
 * SYNOPSIS:
 *
 * double a, x, y, igam();
 *
 * y = igam( a, x );
 *
 * DESCRIPTION:
 *
 * The function is defined by
 *
 *                           x
 *                            -
 *                   1       | |  -t  a-1
 *  igam(a,x)  =   -----     |   e   t   dt.
 *                  -      | |
 *                 | (a)    -
 *                           0
 *
 *
 * In this implementation both arguments must be positive.
 * The integral is evaluated by either a power series or
 * continued fraction expansion, depending on the relative
 * values of a and x.
 *
 * ACCURACY:
 *
 *                      Relative error:
 * arithmetic   domain     # trials      peak         rms
 *    IEEE      0,30       200000       3.6e-14     2.9e-15
 *    IEEE      0,100      300000       9.9e-14     1.5e-14
 */
class mot.library_functions.continuous_distributions.gamma.igam_fac[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Compute x^a * exp(-x) / gamma(a)

Copied from Scipy (https://github.com/scipy/scipy/blob/master/scipy/special/cephes/igam.c), 05-05-2018.

class mot.library_functions.continuous_distributions.gamma.igam_igamc_asymptotic_series[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Compute igam/igamc using DLMF 8.12.3/8.12.4.

Copied from Scipy (https://github.com/scipy/scipy/blob/master/scipy/special/cephes/igam.c), 05-05-2018.

The argument func should be 1 when computing for IGAM and 0 when computing for IGAMC.

class mot.library_functions.continuous_distributions.gamma.igam_series[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Compute igamc using DLMF 8.11.4

Copied from Scipy (https://github.com/scipy/scipy/blob/master/scipy/special/cephes/igam.c), 05-05-2018.

class mot.library_functions.continuous_distributions.gamma.igamc[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Complemented incomplete Gamma integral

Also known as the regularized upper incomplete gamma function. Copied from Scipy (https://github.com/scipy/scipy/blob/master/scipy/special/cephes/igam.c), 05-05-2018:

/*                                                  igamc()
 *
 *  Complemented incomplete Gamma integral
 *
 *
 *
 * SYNOPSIS:
 *
 * double a, x, y, igamc();
 *
 * y = igamc( a, x );
 *
 * DESCRIPTION:
 *
 * The function is defined by
 *
 *
 *  igamc(a,x)   =   1 - igam(a,x)
 *
 *                            inf.
 *                              -
 *                     1       | |  -t  a-1
 *               =   -----     |   e   t   dt.
 *                    -      | |
 *                   | (a)    -
 *                             x
 *
 *
 * In this implementation both arguments must be positive.
 * The integral is evaluated by either a power series or
 * continued fraction expansion, depending on the relative
 * values of a and x.
 *
 * ACCURACY:
 *
 * Tested at random a, x.
 *                a         x                      Relative error:
 * arithmetic   domain   domain     # trials      peak         rms
 *    IEEE     0.5,100   0,100      200000       1.9e-14     1.7e-15
 *    IEEE     0.01,0.5  0,100      200000       1.4e-13     1.6e-15
 */
class mot.library_functions.continuous_distributions.gamma.igamc_continued_fraction[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Compute igamc using DLMF 8.9.2.

Copied from Scipy (https://github.com/scipy/scipy/blob/master/scipy/special/cephes/igam.c), 05-05-2018.

class mot.library_functions.continuous_distributions.gamma.igamc_series[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Compute igamc using DLMF 8.7.3.

This is related to the series in igam_series but extra care is taken to avoid cancellation.

Copied from Scipy (https://github.com/scipy/scipy/blob/master/scipy/special/cephes/igam.c), 05-05-2018.

class mot.library_functions.continuous_distributions.gamma.igamci[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Copied from Scipy (https://github.com/scipy/scipy/blob/master/scipy/special/cephes/igami.c), 05-05-2018.

class mot.library_functions.continuous_distributions.gamma.igami[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Copied from Scipy (https://github.com/scipy/scipy/blob/master/scipy/special/cephes/igami.c), 05-05-2018.

mot.library_functions.continuous_distributions.normal module

class mot.library_functions.continuous_distributions.normal.normal_cdf[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Compute the Cumulative Distribution Function of the Gaussian distribution.

class mot.library_functions.continuous_distributions.normal.normal_logpdf[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Compute the log of the Probability Density Function of the Gaussian distribution.

class mot.library_functions.continuous_distributions.normal.normal_pdf[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Compute the Probability Density Function of the Gaussian distribution.

class mot.library_functions.continuous_distributions.normal.normal_ppf[source]

Bases: mot.library_functions.base.SimpleCLLibrary

Computes the inverse of the cumulative distribution function of the Gaussian distribution.

This is the inverse of the Gaussian CDF.

Module contents