Documentation/Calc Functions/CHISQDIST

    From The Document Foundation Wiki

    Function name:

    CHISQDIST

    Category:

    Statistical Analysis

    Summary:

    Calculates chi-square ([math]\displaystyle{ \chi }[/math]2) distribution values from either the probability density function or the cumulative distribution function, for a given number of degrees of freedom.

    Chi-square distributions are a family of continuous probability distributions on the interval [0, +∞), with the shape of each distribution dependent on the number of degrees of freedom. Although few real-world observations follow a chi-square distribution, they are widely used in statistical hypothesis testing.

    Syntax:

    CHISQDIST(Number; Degrees of Freedom[; Cumulative])

    Returns:

    Returns a non-negative real number, which is the chi-square 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 chi-square distribution is to be evaluated.

    Degrees of Freedom is a positive integer, or a reference to a cell containing that number, which is the number of degrees of freedom of the chi-square 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 either Number or Degrees of Freedom is non-numeric, then CHISQDIST reports a #VALUE! error.
    • If Degrees of Freedom is less than 1, then CHISQDIST reports an invalid argument error (Err:502).
    • If Degrees of Freedom is a non-integer value, then CHISQDIST truncates it to an integer value.
    • If Degrees of Freedom is greater than or equal to 1 and Number is less than or equal to 0.0, then CHISQDIST returns the value 0. However, this behavior is a requirement of ODF 1.2 and negative values of Number are not expected.

    Additional details:

    • Calc's CHISQDIST and CHISQ.DIST functions perform similar calculations. However, there are differences between the two functions with respect to the conditions placed on argument values. The requirements for CHISQDIST are specified in ODF 1.2; CHISQ.DIST is provided for interoperability with Microsoft Excel.
    • The main differences between CHISQDIST and CHISQ.DIST are as follows:
    • The Cumulative argument is optional for CHISQDIST and required for CHISQ.DIST.
    • CHISQDIST accepts negative values for the Number argument, whereas CHISQ.DIST reports an error in this circumstance.
    • CHISQDIST does not set a maximum value for the Degrees of Freedom argument, whereas CHISQ.DIST reports an error if the argument is set to a value greater than 1010.
    • The formula for the chi-square probability density function is given by:
    [math]\displaystyle{ \text{CHISQDIST}(x;\:k;\:\text{FALSE}())~=~\frac{x^{\frac{k}{2}-1}\:e^{-\frac{x}{2}}}{2^\frac{k}{2}\:\Gamma(\frac{k}{2})} }[/math]
    where k is the number of degrees of freedom (k ≥ 1), x is the value of the chi-square statistic (x > 0), and [math]\displaystyle{ \Gamma }[/math] is the gamma function.
    • The formula for the chi-square cumulative distribution function is given by:
    [math]\displaystyle{ \text{CHISQDIST}(x;\:k;\:\text{TRUE}())~=~\int_{0}^{x }\frac{t^{\frac{k}{2}-1}\:e^{-\frac{t}{2}}}{2^\frac{k}{2}\:\Gamma(\frac{k}{2})}~dt }[/math]
    where x > 0.
    • The following figure shows probability density function plots for five sample chi-square distributions.
    Chi square distribution PDF plots.png
    • The following figure shows cumulative distribution function plots for five sample chi-square distributions.
    Chi square distribution CDF plots.png

    Examples:

    Formula Description Returns
    =CHISQDIST(A1; A2; A3) where cells A1:A3 contain the values 3, 2, and 0 respectively. Here the function calculates the value of the probability density function for the chi-square distribution with two degrees of freedom, evaluated at a chi-square statistic value of 3. The formula =CHISQ.DIST(3; 2; 0) returns than same result. 0.111565080074215
    =CHISQDIST(2.3; 15.95; FALSE) Here the function calculates the value of the probability density function for the chi-square distribution with 15 degrees of freedom, evaluated at a chi-square statistic value of 2.3. Note that the non-integer value for the Degrees of Freedom argument is truncated to 15 and that the formula =CHISQDIST(2.3; 15; FALSE) returns the same result. 0.000209862334569992
    =CHISQDIST(-2; 7; 0) Here, since the value of the Degrees of Freedom argument is valid, the function does no calculation and returns the value 0 because the Number argument is set to a negative value. 0
    =CHISQDIST(3; 2) Here the function calculates the value of the cumulative distribution function for the chi-square distribution with two degrees of freedom, evaluated at a chi-square statistic value of 3. No value is supplied for the Cumulative argument and so the default setting of TRUE or 1 is assumed. The formulas =CHISQDIST(3; 2; TRUE()) and =CHISQ.DIST(3; 2; TRUE()) return the same result. 0.77686983985157
    =CHISQDIST(2.3; 15.95; TRUE) Here the function calculates the value of the cumulative distribution function for the chi-square distribution with 15 degrees of freedom, evaluated at a chi-square statistic value of 2.3. Note that the non-integer value for the Degrees of Freedom argument is truncated to 15 and that the formula =CHISQDIST(2.3; 15; TRUE) returns the same result. 7.4247191214056E-05
    =CHISQDIST(-2; 7; 1) Here, since the value of the Degrees of Freedom argument is valid, the function does no calculation and returns the value 0 because the Number argument is less than or equal to zero. 0

    Related LibreOffice functions:

    CHIDIST

    CHIINV

    CHISQ.DIST

    CHISQ.DIST.RT

    CHISQ.INV

    CHISQ.INV.RT

    CHISQ.TEST

    CHISQINV

    CHITEST

    ODF standard:

    Section 6.18.12, part 2

    Related (or similar) Excel functions:

    None