# Documentation/Calc Functions/CHITEST

TDF LibreOffice Document Liberation Project Community Blogs Weblate Nextcloud Redmine Ask LibreOffice Donate

## Function name:

CHITEST

## Category:

Statistical Analysis

## Summary:

Returns the probability of a deviance from a random distribution of two test series based on the chi-square test for independence. CHITEST returns the chi-square distribution of the data.

## Syntax:

CHITEST(**DataB**; **DataE**)

## Returns:

Returns a real number which is the chi-square distribution of the data. It is a probability and hence it ranges from 0 to 1, i.e. [0,1].

## Arguments:

**DataB** is a range of references to the cells containing the array of the observations.

**DataE** is a range of references to the cells containing the range of the expected values.

- If
**DataB**and**DataE**have different number of data points then the function returns an error value. - If any of the cell whose reference is passed contains non-numeric value then the function returns an error value.

## Additional details:

- The probability determined by CHITEST can also be determined with CHIDIST, in which case the chi-square of the random sample must be passed as a parameter instead of the data row.

- The χ2 test first calculates a χ2 statistic using the formula:

where:

Aij = element of actual data which is **DataB** in our case

Eij = element of expected values which is **DataE** in our case

r = number or rows

c = number of columns

Then CHIDIST is called with chi-square value and a degree of freedom (df). If r>1 and c>1: df = (r-1)(c-1) else df = r*c-1 and CHITEST = CHIDIST(χ2;df).

- For more details on CHITEST, visit Wikipedia

## Examples:

Data_B (observed) | Data_E (expected) | |
---|---|---|

1 | 195 | 170 |

2 | 151 | 170 |

3 | 148 | 170 |

4 | 189 | 170 |

5 | 183 | 170 |

6 | 154 | 170 |

Formula | Description | Returns |
---|---|---|

=CHITEST(A1:A6;B1:B6) | This is the probability that suffices the observed data of the theoretical Chi-square distribution. | 0.020975769403022 |

=CHITEST(A1:A5;B1:B6) | DataB size not equal to that of DataE so the function will return an error value. |
Err:502 |

## Related LibreOffice functions:

## ODF standard:

## Equivalent Excel functions:

CHITEST