Jump to content

Documentation/Calc Functions/GAMMADIST

From The Document Foundation Wiki

Function name:

GAMMADIST

Category:

Statistical Analysis

Summary:

Calculates gamma distribution values from either the probability density function or the cumulative distribution function.

The gamma distribution is a family of continuous probability distributions that are typically used to model positive variables that have right-skewed distributions. The distribution has two characteristic positive real numbers, usually denoted as alpha (α) and beta (β), that control its shape and rate respectively.

Syntax:

GAMMADIST(Number; Alpha; Beta[; Cumulative])

Returns:

Returns a non-negative real number, which is the gamma distribution value for the given arguments. For the probability density function, the value returned lies in the range [0, +∞). For the cumulative distribution function, the value returned lies in the range [0, 1].

Arguments:

Number is a non-negative real number, or a reference to a cell containing that number, which is the value at which the gamma distribution is to be evaluated.

Alpha is a positive real number, or a reference to a cell containing that number, which is the value of the shape parameter of the gamma distribution.

Beta is a positive real number, or a reference to a cell containing that number, which is the value of the rate parameter of the gamma distribution.

Cumulative is a logical value, or a reference to a cell containing that value, that determines whether the required probability is taken from the probability density function or the cumulative distribution function. If Cumulative is set to 0 or FALSE, a value from the probability density function is calculated. For any other values of Cumulative, or if omitted, a value from the cumulative distribution function is calculated.

  • If any of Number, Alpha, or Beta is non-numeric, then GAMMADIST reports a #VALUE! error.
  • If either Alpha or Beta is less than or equal to 0.0, then GAMMADIST reports an invalid argument error (Err:502).
  • If Number is negative and other argument values are valid, then GAMMADIST returns 0.
  • Other errors may arise depending on the exact combination of values passed as arguments to GAMMADIST.

Additional details:

  • Calc's GAMMADIST and GAMMA.DIST functions perform similar calculations. However, there are minor differences between the two functions with respect to their arguments – for GAMMA.DIST the Cumulative argument cannot be omitted and negative Number values are not accepted. The requirements for GAMMADIST are specified in ODF 1.2; GAMMA.DIST is provided for interoperability with Microsoft Excel.
  • The formula for the probability density function of the gamma distribution can be written as:
[math]\displaystyle{ PDF_{gamma}(x, \alpha, \beta)~=~\frac{1}{\beta^\alpha\:\Gamma(\alpha)}\:x^{\alpha-1}\:e^{-\frac{x}{\beta}} }[/math]
where x ≥ 0, α > 0, and β > 0.
  • The formula for the cumulative distribution function of the gamma distribution can be written as:
[math]\displaystyle{ CDF_{gamma}(x, \alpha, \beta)~=~\frac{1}{\beta^\alpha\:\Gamma(\alpha)}\int_{0}^{x}\:t^{\alpha-1}\:e^{-\frac{t}{\beta}} \:dt }[/math]
where x ≥ 0, α > 0, and β > 0.
  • The following figure shows four sample probability density function plots for the gamma distribution.
  • The following figure shows four sample cumulative distribution function plots for the gamma distribution.
  • For more information on the gamma distribution, visit Wikipedia's Gamma distribution page.

Examples:

Formula Description Returns
=GAMMADIST(A1; A2; A3; A4) where cells A1:A4 contain the numbers 4.7, 3.4, 2.7, and 0 respectively. Here the function calculates the value of the probability density function for the given inputs. 0.0824160723859134
=GAMMADIST(4.7; 3.4; 2.7; 1) Here the function calculates the value of the cumulative distribution function for the same input values as in the previous example. The formula =GAMMADIST(4.7; 3.4; 2.7) returns the same result because the omitted Cumulative argument defaults to the value TRUE. 0.178647117849697
=GAMMADIST(0; 2; 4; 0) Here the function returns 0 for Number equal to 0. 0
=GAMMADIST(-2; 2; 4; 0) Here the function returns the value 0 for a negative value of Number. Contrast this with the formula =GAMMA.DIST(-2; 2; 4; 0) which returns Err:502. 0

Related LibreOffice functions:

GAMMA.DIST

GAMMA.INV

GAMMAINV

ODF standard:

Section 6.18.31, part 2

Related (or similar) Excel functions:

GAMMADIST