Skip to content
EvalSuite
Documentation menu

Statistical tests

Chi-square test of independence

Implementedstatistics.chi_square_test

Definition

Pearson's χ² test of independence for a contingency table, with Yates' continuity correction for 2×2 tables by default.

Formula

χ² = Σ (O − E)² / E, E = row total · column total / n

Range: p in [0, 1]

Inputs and outputs

  • table: contingency table of counts
  • correction: Yates' correction for 2×2

Returns: result object

Assumptions

No assumptions beyond valid, aligned inputs of the documented types.

Limitations

No metric-specific limitations are documented yet. Interpret the value alongside the task, data, and other metrics.

Python API

PythonSince v0.2.0
import evalsuite as es

es.chi_square_test(table)

References

  1. Pearson K. On the criterion that a given system of deviations from the probable... Philosophical Magazine. 1900;50(302):157-175.

Implementation status