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

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

Data Types

type  distBeta_type
 This is the derived type for signifying distributions that are of type Beta as defined in the description of pm_distBeta. More...
 
interface  getBetaCDF
 Generate and return the CDF of the Beta distribution for the given parameters \((\alpha, \beta)\) as defined in the details section of pm_distBeta. More...
 
interface  getBetaLogPDF
 Generate and return the natural logarithm of the Probability Density Function (PDF) of the Beta distribution for an input x within the support of the distribution \(x \in (0,1)\). More...
 
interface  getBetaPDF
 Generate and return the Probability Density Function (PDF) of the Beta distribution for an input x within the support of the distribution \(x \in [0,1]\). More...
 
interface  setBetaCDF
 Return the CDF of the Beta distribution for the given parameters \((\alpha, \beta)\) as defined in the details section of pm_distBeta. More...
 
interface  setBetaLogPDF
 Return the natural logarithm of the Probability Density Function (PDF) of the Beta distribution for an input x within the support of the distribution \(x \in (0,1)\). More...
 
interface  setBetaRand
 Return a scalar or array of arbitrary rank of Beta-distributed random values in range \([0, 1]\) (or \((0, 1)\), depending on the specific parameter values) with the specified two shape parameters \((\alpha, \beta)\) of the Beta distribution corresponding to the procedure arguments (alpha, beta). More...
 

Variables

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

Detailed Description

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

Specifically, this module contains routines for computing the following quantities of the Beta 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 Beta distribution is defined with two shape parameters \((\alpha > 0, \beta > 0)\) as,

\begin{equation} \large \pi(x | \alpha, \beta) = \begin{cases} \frac {x^{\alpha - 1} (1 - x)^{\beta - 1}} {\mathrm{B}(\alpha, \beta)} &,~ x \in (0, 1) ~, \\ 0 &,~ x \notin (0,1) ~. \end{cases} \end{equation}

where,

\begin{equation} \mathrm{B}(\alpha, \beta) = \frac {\Gamma(\alpha) \Gamma(\beta)} {\Gamma(\alpha + \beta)} \end{equation}

is the Beta function whose natural logarithm is returned by getLogBeta.
Note that the common definitions of the Beta distribution consider the end points \( x = 0, x = 1\) also as part of the support of the distribution.
But this inclusion is valid only if the condition \((\alpha \geq 1, \beta \geq 1)\) holds.
Furthermore, the end points correspond to a PDF value of either \(0\) or \(+\infty\), yielding a NaN when the natural logarithm of the PDF is returned in numerical algorithms.
As such, the support of the Beta distribution in this module is always taken to be the open-interval \(x \in (0,1)\).

The CDF of the Beta distribution is exactly given by the regularized incomplete Beta function.
See the documentation of pm_mathBeta for details of the CDF of the Beta distribution.

Random Number Generation

If \(X\) and \(Y\) are independent, with \(X \sim \Gamma(\alpha, \theta)\) and \(Y \sim \Gamma(\beta, \theta)\) then,

\begin{equation} \frac{X}{X + Y} \sim \mathrm{B}(\alpha, \beta) ~, \end{equation}

where \((\alpha, \beta)\) are the parameters of the target Beta distribution and, \(\theta\) is an arbitrary parameter of the Gamma distribution.
So one algorithm for generating random Beta variates is to generate \(\frac{X}{X + Y}\), where \(X\) is a Gamma variate with parameters \((\alpha, 1)\) and, \(Y\) is an independent gamma variate with parameters \((\beta, 1)\).

Note
When \(\alpha > 1\), the PDF of the Beta distribution is bound to zero at \(x = 0\).
When \(\beta > 1\), the PDF of the Beta distribution is bound to zero at \(x = 1\).
When \(\alpha \leq 1\), the PDF of the Beta distribution is unbounded ( \(+\infty\)) at \(x = 0\).
When \(\beta \leq 1\), the PDF of the Beta distribution is unbounded ( \(+\infty\)) at \(x = 1\).
The Cumulative Distribution Function (CDF) of the Beta distribution for a triple \((x, \alpha, \beta)\) is directly returned by calling getBetaInc(x, alpha, beta).
Similarly, the Cumulative Distribution Function (CDF) of the Beta distribution for a triple \((x, \alpha, \beta)\) is directly returned by calling getBetaInv(x, alpha, beta).
See also
pm_mathBeta
pm_distUnif
pm_distGamma
pm_mathGamma
Test:
test_pm_distBeta
Todo:
Critical Priority: The quantile function must be implemented here.


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_distBeta::MODULE_NAME = "@pm_distBeta"

Definition at line 107 of file pm_distBeta.F90.