Documentation/Calc Functions/BETADIST

    From The Document Foundation Wiki

    Function name:

    BETADIST

    Category:

    Statistical Analysis

    Summary:

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

    The beta distribution is a family of continuous probability distributions that can be used to model random variables that lie within finite bounds. The distribution has two characteristic positive real numbers, usually denoted as alpha (α) and beta (β), that control its shape. In many cases the beta distribution is defined on the range [0, 1] but in the more general case can be defined on a range [a, b], where a and b are the lower and upper bounds of the distribution (a < b).

    Syntax:

    BETADIST(Number; Alpha; Beta [; Start [; End [; Cumulative]]])

    Returns:

    Returns a non-negative real number, which is the beta 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 real number, or a reference to a cell containing that number, which is the value of the random variable that is to be used in the calculation. Number should normally lie in the range [Start, End].

    Alpha is a positive real number, or a reference to a cell containing that number, which is the value of one of the two parameters that control the shape of the beta distribution.

    Beta is a positive real number, or a reference to a cell containing that number, which is the value of the second of the two parameters that control the shape of the beta distribution.

    Start is a real number, or a reference to a cell containing that number, which is the lower bound of the distribution. If omitted, the default value of 0.0 is used.

    End is a real number, or a reference to a cell containing that number, which is the upper bound of the distribution. If omitted, the default value of 1.0 is used.

    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, Beta, Start, or End is non-numeric, then BETADIST reports a #VALUE! error.
    • If either Alpha or Beta is less than or equal to 0.0, then BETADIST reports an invalid argument error (Err:502).
    • If End is less than or equal to Start, then BETADIST reports an invalid argument error (Err:502).
    • Other errors may arise depending on the exact combination of values passed as arguments to BETADIST.

    Additional details:

    • Calc's BETADIST and BETA.DIST functions perform similar calculations. However, there are differences between the two functions with respect to the order of their arguments and the conditions placed on argument values. The requirements for BETADIST are specified in ODF 1.2; BETA.DIST is provided for interoperability with Microsoft Excel.
    • The formula for the probability density function of the beta distribution can be written as:
    [math]\displaystyle{ \text{PDF}_{beta}(x)~=~\frac{1}{\text{B}(\alpha,\:\beta)}\:\times\:x^{\alpha-1}\:\times\:(1\:-\:x)^{\beta-1} }[/math]
    where [math]\displaystyle{ \text{B}(\alpha, \beta) }[/math] is the beta function, [math]\displaystyle{ x }[/math] lies in the range [0, 1], and both α and β are greater than 0. Note also that the beta function is closely related to the gamma function:
    [math]\displaystyle{ \text{B}(\alpha,\:\beta)~=~\frac{\Gamma(\alpha)\:\Gamma(\beta)}{\Gamma(\alpha\:+\:\beta)} }[/math]
    • The formula for the cumulative distribution function of the beta distribution can be written as:
    [math]\displaystyle{ \text{CDF}_{beta}(x)~=~\frac{1}{\text{B}(\alpha,\:\beta)}\:\times\int_{0}^{x}\:t^{\alpha-1}\times(1\:-\:t)^{\beta-1}~dt }[/math]
    where [math]\displaystyle{ x }[/math] again lies in the range [0, 1] and both α and β are greater than 0.
    • The above formulas relate to a beta distribution that is bounded on the [0, 1] interval and this is a common scenario. In more general cases when the lower bound is not 0 and / or the upper bound is not 1, then equivalent formulas are obtained by linear transformation.
    • The following figure shows four sample probability density function plots for the beta distribution.
    Beta distribution PDF plots.png
    • The following figure shows four sample cumulative distribution function plots for the beta distribution.
    Beta distribution CDF plots.png
    • For more information on the beta distribution, visit Wikipedia's Beta distribution page.

    Examples:

    Formula Description Returns
    =BETADIST(A1; A2; A3; A4; A5; A6) where cells A1:A6 contain the numbers 0, 1, 2, 0, 1, and 0 respectively. Here the function calculates the value of the beta probability distribution function defined on the range [0, 1] for the parameters x=0; α=1; β=2. 2
    =BETADIST(0.5, 1, 2, 0, 1, FALSE()) Similar to the previous example, except that here x=0.5 and the function returns 1. Note that the formula =BETADIST(1, 1, 2, 0, 1, FALSE()) returns 0 – the probability distribution function in this case is a straight line that goes from (0, 2) to (1, 0). In addition, formulas such as =BETADIST(-0.5, 1, 2, 0, 1, FALSE()) and =BETADIST(1.5, 1, 2, 0, 1, FALSE()) return 0 to reflect that the values of x are outside the defined range bounds. 1
    =BETADIST(0.25; 1; 2) Here the function calculates the value of the beta cumulative distribution function defined on the range [0, 1] for the parameters x=0.25; α=1; β=2. The Start, End, and Cumulative arguments are omitted and assume the default values of 0, 1, and 1 respectively. 0.4375
    =BETADIST(1.1; 6.2; 4.3; -2.4; 6.5) Here the function calculates the value of the beta cumulative distribution function defined on the range [-2.4, 6.5] for the parameters x=1.1; α=6.2; β=4.3. Note that the formula =BETADIST(-3.0; 6.2; 4.3; -2.4; 6.5)returns 0, while the formula =BETADIST(7.0; 6.2; 4.3; -2.4; 6.5) returns 1. 0.0975038972564338

    Related LibreOffice functions:

    BETA.DIST

    BETA.INV

    BETAINV

    ODF standard:

    Section 6.18.7, part 2

    Related (or similar) Excel functions:

    BETADIST