Bench Tools Free browser-based calculators for the lab and for bioinformatics

ToolsStatistics

Chi-Square and Fisher's Exact Test Calculator (with OR / RR)

Contingency table independence tests — Pearson chi-square, Yates' correction, and Fisher's exact p-value; OR and RR with confidence intervals for 2×2 tables.

Independence testing for contingency tables: Pearson chi-square, Yates’ continuity correction, and Fisher’s exact test; odds ratio (OR) and relative risk (RR) with 95% confidence intervals for 2×2 tables. Supports arbitrary R×C tables (chi-square portion).

The three methods can give contradictory conclusions

This is the most important point on this page. Using the table [[12, 8], [5, 15]]:

Method p-value At α=0.05
Pearson chi-square 0.0252 Significant
Yates’ continuity correction 0.0550 Not significant
Fisher’s exact test 0.0536 Not significant

Same data, three different conclusions. So “which method to use” is not something you pick after seeing the results — the method should be decided before looking at the data, otherwise you are simply choosing the answer you want.

The general guidance: use Pearson chi-square when sample size is adequate (all expected cell counts ≥ 5); use Fisher’s exact test when any expected cell count is < 5. Yates’ correction was a hand-calculation approximation to Fisher’s test from before computers were widespread. Today Fisher’s exact test can be computed directly, and most statisticians no longer recommend Yates’ correction — it tends to be overly conservative. This page still reports it because many journals and textbooks continue to use it.

Why expected cell counts matter

The chi-square statistic’s distribution is approximated by the chi-square distribution; this approximation requires adequate expected counts in each cell. When expected counts are too small the approximation breaks down and the p-value is unreliable. This page computes the expected count for each cell and flags the minimum; a warning appears when it falls below 5.

Note: it is the expected count, not the observed count, that matters. Observing a zero in a cell is not necessarily a problem; a small expected value is.

OR vs. RR

Odds ratio (OR) = (a/b) / (c/d) — the ratio of the odds of the outcome. Case-control studies can only report OR because sampling on the outcome means the true incidence rate cannot be estimated.

Relative risk (RR) = (a/(a+b)) / (c/(c+d)) — the ratio of incidence rates; more intuitive, but meaningful only in cohort studies or randomised trials.

When the outcome is rare, OR ≈ RR; when the outcome is common, OR substantially overestimates RR. Interpreting a case-control OR as if it were an RR is one of the most common errors in epidemiology.

Confidence intervals are computed by Woolf’s log method: the interval is constructed on the log scale and then exponentiated back, so the interval is asymmetric about 1.

What this test cannot answer

A chi-square test only indicates that two variables are not independent — it says nothing about the direction of causation or the strength of association. With a large enough sample, even a negligibly small association will be statistically significant. For effect size, examine OR/RR and their confidence intervals; do not rely on the p-value alone.

FAQ

Which should I use — chi-square, Yates, or Fisher?

Use Pearson chi-square when all expected cell counts are ≥ 5; use Fisher's exact test when any expected count is < 5. Yates' correction was a pre-computer hand-calculation approximation to Fisher's exact test. Fisher's exact test can now be computed directly, and most statisticians no longer recommend Yates' correction because it tends to be overly conservative. This page still reports it because many journals and textbooks continue to use it. The key point: decide on the method before looking at the data.

How serious is an expected count below 5?

The chi-square statistic is approximated by the chi-square distribution, and that approximation requires adequate expected counts per cell. When expected counts are too small the approximation breaks down and the p-value is unreliable. Note: the criterion is based on the expected count, not the observed count — observing a zero in a cell is not necessarily a problem; a small expected value is.

What is the difference between OR and RR, and when can they not be used interchangeably?

OR compares the odds of the outcome: (a/b)/(c/d). RR compares the incidence rates: (a/(a+b))/(c/(c+d)). Case-control studies sample on the outcome, so the true incidence rate cannot be estimated — only OR can be reported. When the outcome is rare, OR ≈ RR; when the outcome is common, OR substantially overestimates RR. Interpreting a case-control OR as if it were an RR is one of the most common errors in epidemiology.

Why is the confidence interval asymmetric about 1?

Because the interval is computed on the logarithmic scale (Woolf's method): log(OR) ± z×SE is computed first, then exponentiated back. The exponential transformation converts a symmetric interval into an asymmetric one — this is correct behaviour, not a calculation error.

Does a significant chi-square indicate a causal relationship?

No. It only indicates that two variables are not independent. The association could arise from confounding, selection bias, or reverse causation. Moreover, with a large enough sample even a negligibly small association will be statistically significant — for effect size, examine OR/RR and their confidence intervals; do not rely on the p-value alone.

Related tools

Correlation Coefficient Calculator Online: Pearson, Spearman, and Kendall

Compute all three correlation coefficients with p-values in one step, plus Pearson's 95% CI and r², with automatic warnings for outliers or non-linearity.

How to Choose a Statistical Test: By Data Type, Number of Groups, and Paired vs. Independent Design

Answer three questions to identify the right test: comparing values or proportions, how many groups, paired or independent. Each row links to the corresponding tool.

Multiple Testing Correction Calculator: BH (FDR), BY, and Bonferroni

Paste a column of p-values and get BH q-values, BY, and Bonferroni corrections side by side in one step.

No ads, no tracking, no sign-up — and every formula here is checked against a known answer. Keeping it that way takes ongoing work. If it saved you time, buy me a coffee.
Buy me a coffee