Skip to content

Contingency Table Analysis

Chi square, G squared, odds ratio, risk ratio, McNemar, kappa, Cramer V and gamma online.

Open the Cross-Tabulation calculator

When to use it

Use to summarise the joint distribution of two categorical variables and test their independence. Standard pairing for survey data, epidemiology 2 by 2 tables, and ecology presence-absence matrices.

When NOT to use it

Do not use when expected cell counts fall below five and the table is small; use Fisher exact instead. Do not use chi-square on paired or matched binary data; use McNemar. For ordinal categorical variables prefer linear-by-linear or gamma rather than chi-square.

What you get

Pearson chi-square and likelihood-ratio G-squared with df and p; Cramer's V (effect size); for 2 by 2 tables: odds ratio with 95 percent CI, relative risk with 95 percent CI, Fisher exact p, and McNemar (paired); ordinal effect sizes (gamma, Kendall tau-b, Somers d); kappa for inter-rater reliability; row and column percentages; standardized residuals; low-expected-cell warnings.

Worked example

3 by 3 demo contingency table (fertiliser by soil class).

Fertilizer A: 30, 20, 10
Fertilizer B: 25, 35, 15
Fertilizer C: 10, 15, 40

Source: StatVeda built-in example.

How to interpret the output

Chi-square p below alpha means row and column variables are not independent. Cramer's V quantifies the strength of association: under 0.1 weak, 0.1 to 0.3 moderate, above 0.3 strong (Cohen 1988). Standardized residuals greater than |1.96| flag specific cells driving the association. For 2 by 2 outcomes report the OR or RR with CI, not just the chi-square. The five-per-cell rule of thumb (Cochran 1954) guides whether asymptotic chi-square is trustworthy; if not, use Fisher exact.

Common pitfalls

Try it in StatVeda

The Cross-Tabulation engine runs entirely in the browser. No signup, no install, no data sent to a server. Paste your data, hit Run, copy the output.

Open Cross-Tabulation

References

Related concepts

Related calculators