Documentation/Calc Functions/CHIINV
TDF LibreOffice Document Liberation Project Community Blogs Weblate Nextcloud Redmine Ask LibreOffice Donate
Function name:
CHIINV
Category:
Statistical Analysis
Summary:
Calculates the inverse of a right-tail probability value for the chi-square ([math]\displaystyle{ \chi }[/math]2) distribution with a given number of degrees of freedom. The value returned is the chi-square statistic that corresponds to the specified right-tail probability value.
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.
CHIINV is the inverse of CHIDIST, so that for valid arguments [math]\displaystyle{ \text{CHIINV}(\text{CHIDIST}(x;\:df);\:df)~=~x }[/math].
Syntax:
CHIINV(Number; Degrees freedom)
Returns:
Returns a non-negative real number, which is the inverse of the specified right-tail probability value for the given chi-square distribution.
Arguments:
Number is a real number (expressed as a percentage, such as 2.5%, or a decimal fraction, such as 0.025), or a reference to a cell containing that number, which is the right-tail probability for which the inverse is required. Number lies in the range (0, 1] (0 < Number ≤ 1).
Degrees 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.
- If either Number or Degrees freedom is non-numeric, then CHIINV reports a #VALUE! error.
- If Degrees freedom is less than 1.0, then CHIINV reports an invalid argument error (Err:502).
- If Degrees freedom is a non-integer value, then CHIINV truncates it to an integer value.
- If Number is less than or equal to 0.0, or greater than 1.0, then CHIINV reports an invalid argument error (Err:502).
Additional details:
- Calc's CHIINV function meets the requirements of the LEGACY.CHIINV function in ODF 1.2.
- CHIINV utilizes an iterative algorithm to determine the inverse of the specified right-tail probability.
- The following figure shows inverse right-tail probability plots for five sample chi-square distributions.
- For more information about chi-square distributions, visit Wikipedia's Chi-squared distribution page.
Examples:
Fair / loaded dice
A die is rolled 1020 times and the numbers 1 through 6 are observed to come up 195, 151, 148, 189, 183, and 154 times respectively. In order to test a null hypothesis that the die is fair, a chi-square goodness of fit test is to be performed to assess the observed data.
For N rolls of a die, the expected number of appearances of a particular number on the die is [math]\displaystyle{ \frac{N}{6} }[/math]. For 1020 rolls, this equals 170.
Using the formula [math]\displaystyle{ \chi^2~=~\sum_{}^{}\frac{(O-E)^2}{E} }[/math] to calculate the chi-square statistic for the experiment gives the value 13.271 with 5 degrees of freedom.
To assess this chi-square statistic consider two cases:
- In the first case, assume that the significance level chosen for the experiment is the common value of 0.05 (5%). Then the formula
=CHIINV(0.05; 5)
returns the value 11.070, meaning that the null hypothesis should be rejected for any chi-square statistic that is greater than 11.070. Therefore the observed data suggests that for the 0.05 significance level, the die should be assumed to be loaded. - In the second case, assume that the significance level chosen for the experiment is 0.02 (2%). Then the formula
=CHIINV(0.02; 5)
returns the value 13.388, meaning that the null hypothesis should be rejected for any chi-square statistic that is greater than 13.388. This means that based on a significance level of 0.02, there is insufficient evidence to conclude that the die is loaded.
Table of chi-square critical values
There are many sources on the Internet that provide tables of critical chi-square values that can be used in chi-square tests. These tables typically list a range of degrees of freedom down the left-hand side and list a range of significance levels along the top of the table. The values in such tables are easily generated using the CHIINV function, as shown in the following example table that uses right-tail probabilities. The critical chi-square values presented in the table have been rounded to three decimal places.
A | B | C | D | E | |
---|---|---|---|---|---|
1 | Significance Levels | ||||
2 | Degrees of Freedom |
10% | 5% | 2.5% | 1% |
3 | 1 | 2.706 | 3.841 | 5.024 | 6.635 |
4 | 2 | 4.605 | 5.991 | 7.378 | 9.210 |
5 | 3 | 6.251 | 7.815 | 9.348 | 11.345 |
6 | 4 | 7.779 | 9.488 | 11.143 | 13.277 |
7 | 5 | 9.236 | 11.070 | 12.833 | 15.086 |
8 | 6 | 10.645 | 12.592 | 14.449 | 16.812 |
9 | 7 | 12.017 | 14.067 | 16.013 | 18.475 |
10 | 8 | 13.362 | 15.507 | 17.535 | 20.090 |
11 | 9 | 14.684 | 16.919 | 19.023 | 21.666 |
12 | 10 | 15.987 | 18.307 | 20.483 | 23.209 |
Each cell in the range B3 to E12 contains a formula that comprises a simple call to the CHIINV function.
- The formulas in cells B3 and B12 are
=CHIINV(B$2,$A3)
and=CHIINV(B$2,$A12)
respectively. The formulas in cells B4:B11 follow the obvious intermediate pattern. - The formulas in cells C3 and C12 are
=CHIINV(C$2,$A3)
and=CHIINV(C$2,$A12)
respectively. The formulas in cells C4:C11 follow the obvious intermediate pattern. - The formulas in cells D3 and D12 are
=CHIINV(D$2,$A3)
and=CHIINV(D$2,$A12)
respectively. The formulas in cells D4:D11 follow the obvious intermediate pattern. - The formulas in cells E3 and E12 are
=CHIINV(E$2,$A3)
and=CHIINV(E$2,$A12)
respectively. The formulas in cells E4:E11 follow the obvious intermediate pattern.
An example of the use of such values is given in the previous example concerning the assessment of the fairness of a die.
Other examples
Formula | Description | Returns |
---|---|---|
=CHIINV(A1; A2) where cells A1 and A2 contain the values 0.5 and 3 respectively. | Here the function calculates the value of the chi-square statistic that gives a right-tail probability of 0.5 (50%), assuming 3 degrees of freedom. The formula =CHISQ.INV.RT(0.5; 3) returns the same value. Note also that the formulas =CHIDIST(2.36597388437534; 3) and =CHIDIST(CHIINV(50%; 3); 3) both return 0.5. |
2.36597388437534 |
=CHIINV(0.9; 6.75) | Here the non-integer value for degrees of freedom is truncated to 6. Note that the formula =CHIINV(0.9; 6) returns the same result. |
2.20413065649864 |
Related LibreOffice functions:
ODF standard:
Related (or similar) Excel functions:
CHIINV