Chi-Square Test
stats_chi_squareTest independence between categorical variables using a contingency table. Applies Yates' correction for 2x2 tables when enabled.
Instructions
Run a chi-square test of independence on a contingency table (Yates correction optional).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | 2-D contingency table of observed counts (list of rows; all rows same length; at least 2 rows and 2 columns; non-negative). | |
| correction | No | If True apply Yates' continuity correction (meaningful for 2x2 tables only). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dof | Yes | Degrees of freedom. | |
| method | Yes | Method used: 'Yates continuity correction' (2x2 with correction) or "Pearson's chi-squared". | |
| p_value | Yes | p-value. | |
| expected | Yes | Expected frequencies under independence. | |
| statistic | Yes | The chi-square statistic. | |
| correction | Yes | Whether Yates' continuity correction was applied. |