Chi-square test

The chi-square test is used to test the independence of two categorical variables from a contingency table, or the fit of an observed distribution to an expected one. It compares the observed counts with the theoretical counts under the null hypothesis. It requires sufficient theoretical counts in each cell.

Example

from scipy.stats import chi2_contingency
chi2, p, dof, attendus = chi2_contingency(tableau)

Related concepts

The whole glossary