Skip to main content

Module chi_square

Module chi_square 

Source
Expand description

χ² tests — goodness-of-fit and independence (contingency table), with a real upper-tail p-value from chi_squared.

Structs§

ChiSquareResult
χ² test result.

Functions§

chi_square_gof
Pearson goodness-of-fit: Σ (Oᵢ − Eᵢ)² / Eᵢ with dof = k − 1. None if the vectors differ in length, are shorter than 2, or any expected count is ≤ 0.
chi_square_independence
χ² test of independence on an R×C contingency table of counts. Expected Eᵢⱼ = rowᵢ·colⱼ / total, dof = (R−1)(C−1). None if the table is not at least 2×2, is ragged, or the grand total is 0.