Chi-Square Test of Independence Calculator
Paste a table of counts, one row per line. The calculator returns the expected counts table, the chi-square statistic, the p-value, and a conclusion in plain words, and warns in words when an expected count falls below 5.
Chi-square test of independence calculator
How this calculator works
The test of independence asks whether two categorical variables move together: whether the row a case falls in says anything about its column. Paste the table of counts, one row per line, with the counts separated by commas.
Under independence, the expected count in a cell is its row total times its column total, divided by the grand total. The page prints the full expected counts table beside the result. The statistic adds, over the cells, the squared gap between observed and expected divided by the expected. The degrees of freedom are the rows minus one, times the columns minus one. When an expected count falls below 5, the page warns in words that the p-value runs rough rather than exact, and an exact test is the safer route for a small two by two table.
Worked example
A two by two table with rows 30, 20 and 15, 35 gives expected counts of 22.5 and 27.5 in each row. The chi-square statistic is 9.0909 at 1 degree of freedom, and the p-value is 0.0026, below 0.05, so the test rejects independence.
Values computed from the chi-square distribution. The method was checked against reference calculations: the entries in the worked example reproduce to four decimal places, and the full pair record sits in the package verification file.