chi_square_independence
Test if row and column variables in a contingency table are independent. Returns chi-squared statistic, p-value, and flags low expected counts.
Instructions
Test whether the row and column variables of a contingency table are independent (e.g. "does group membership relate to outcome?"). Returns the chi-squared statistic, degrees of freedom, p-value, a citation, and a warning if any expected cell count is below 5 (consider cramers_v afterwards for effect size).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"table": "<table>"
},
"name": "chi_square_independence"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alpha | No | significance level for the test (and any confidence interval); default 0.05 | |
| table | Yes | contingency table as a list of rows, each a list of raw counts (not proportions), e.g. [[treated_success, treated_failure], [control_success, control_failure]] for a 2x2 table |