ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_distGamma Module Reference

This module contains classes and procedures for computing various statistical quantities related to the Gamma distribution. More...

Data Types

type  distGamma_type
 This is the derived type for signifying distributions that are of type Gamma as defined in the description of pm_distGamma. More...
 
interface  getGammaCDF
 Generate and return the Cumulative Distribution Function (CDF) of the Gamma distribution for an input x within the support of the distribution \(x \in (0,+\infty)\). More...
 
interface  getGammaLogPDF
 Generate and return the natural logarithm of the Probability Density Function (PDF) of the Gamma distribution for an input x within the support of the distribution \(x \in (0,+\infty)\). More...
 
interface  getGammaLogPDFNF
 Generate and return the natural logarithm of the normalization factor of the Probability Density Function (PDF) of the Gamma distribution for an input parameter set \((\kappa,\sigma)\). More...
 
interface  setGammaCDF
 Return the Cumulative Distribution Function (CDF) of the Gamma distribution for an input x within the support of the distribution \(x \in (0,+\infty)\). More...
 
interface  setGammaLogPDF
 Return the natural logarithm of the Probability Density Function (PDF) of the Gamma distribution for an input x within the support of the distribution \(x \in (0,+\infty)\).
More...
 
interface  setGammaRand
 Return a scalar or array of arbitrary rank of Gamma-distributed random values with the specified shape and scale parameters \((\kappa, \sigma)\) of the Gamma distribution corresponding to the procedure arguments (kappa, sigma). More...
 

Variables

character(*, SK), parameter MODULE_NAME = "@pm_distGamma"
 

Detailed Description

This module contains classes and procedures for computing various statistical quantities related to the Gamma distribution.

Specifically, this module contains routines for computing the following quantities of the Gamma distribution:

  1. the Probability Density Function (PDF)
  2. the Cumulative Distribution Function (CDF)
  3. the Random Number Generation from the distribution (RNG)
  4. the Inverse Cumulative Distribution Function (ICDF) or the Quantile Function

The PDF of the Gamma distribution over a strictly-positive support \(x \in (0, +\infty)\) is defined with the two (shape, scale) parameters \((\kappa > 0, \sigma > 0)\) as,

\begin{equation} \large \pi(x | \kappa, \sigma) = \frac {1} {\sigma\Gamma(\kappa)} \bigg(\frac{x}{\sigma}\bigg)^{\kappa - 1} \exp\bigg(-\frac{x}{\sigma}\bigg) ~, \end{equation}

where \(\eta = \frac{1}{\sigma\Gamma(\kappa)}\) is the normalization factor of the distribution with \(\Gamma(\kappa)\) representing the Gamma function whose natural logarithm is returned by the Fortran intrinsic log_gamma().
Note that \(\lim_{x\to0} \pi(x | 0 < \kappa < 1, \sigma) \to +\infty\) \(\).
However, this divergence is integrable and the Gamma PDF is properly normalized.

The CDF of the Gamma distribution over a strictly-positive support \(x \in (0, +\infty)\) with the two (shape, scale) parameters \((\kappa > 0, \sigma > 0)\) is defined by the regularized Lower Incomplete Gamma function as,

\begin{eqnarray} \large \mathrm{CDF}(x | \kappa, \sigma) & = & P(\kappa, \frac{x}{\sigma}) \\ & = & \frac{1}{\Gamma(\kappa)} \int_0^{\frac{x}{\sigma}} ~ t^{\kappa - 1}{\mathrm e}^{-t} ~ dt ~, \end{eqnarray}

where \(\Gamma(\kappa)\) represents the Gamma function.

Note
The Cumulative Distribution Function (CDF) of the Gamma distribution for a triple \((x, \kappa, \sigma)\) is directly returned by calling getGammaIncLow(sigma * x, kappa).
See also
Press et al., 1992, Numerical Recipes.
Marsaglia and Tsang, 2000, A simple method for generating gamma variables
Intel Math Kernel Library
Blog Post by Sukhbinder Singh
Blog Post by Yutaka Masuda
cdflib
Test:
test_pm_distGamma


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, Oct 16, 2009, 11:14 AM, Michigan

Variable Documentation

◆ MODULE_NAME

character(*, SK), parameter pm_distGamma::MODULE_NAME = "@pm_distGamma"

Definition at line 83 of file pm_distGamma.F90.