The drug-trial table [[8, 2], [1, 5]], the whole battery by hand
A small trial: 10 patients on a treatment, 6 on control. 8 of the 10 treated patients improved and 2 did not; 1 of the 6 controls improved and 5 did not. N = 16; row margins 10 and 6, column margins 9 and 7. Every figure below uses only the formulas on this page — type the table into the calculator and the explorer under this example to reproduce each one.
- Expected counts: E = row total × column total ÷ N. E(a) = 10 × 9/16 = 5.625; E(b) = 10 × 7/16 = 4.375; E(c) = 6 × 9/16 = 3.375; E(d) = 6 × 7/16 = 2.625. The observed-minus-expected gap is ±2.375 in every cell.
- Cochran's rule: only 1 of the 4 expected counts reaches 5, and the smallest is 2.625 — the rule is not met, so the chi-square approximations are on probation and Fisher's exact test is the result to trust.
- Pearson chi-square: χ² = Σ(O − E)²/E, cell by cell: 2.375² ÷ 5.625 = 1.003; 2.375² ÷ 4.375 = 1.289; 2.375² ÷ 3.375 = 1.671; 2.375² ÷ 2.625 = 2.149. Sum: χ² = 6.112. On 1 degree of freedom, p = 0.0134.
- Yates correction: shrink each gap by 0.5 first — (2.375 − 0.5)² = 3.515625 — so χ² = 3.515625 × 1.08355 = 3.810, p = 0.0510. The correction alone moves this table across the 0.05 line.
- G-test: G = 2 × Σ O ln(O/E) = 2 × [8 ln(8/5.625) + 2 ln(2/4.375) + 1 ln(1/3.375) + 5 ln(5/2.625)] = 2 × 3.2576 = 6.515, p = 0.0107.
- Fisher's exact test: with the margins fixed, the observed table's hypergeometric probability is 0.023601; summing the tables no more probable than it (probability ordering) gives the two-sided p = 0.0350 — between the optimistic approximations and the conservative Yates figure, and the only exact one of the four.
- Odds ratio and relative risk: OR = ad/bc = (8 × 5)/(2 × 1) = 20.0. RR = (8/10)/(1/6) = 4.80. Same table, two honest answers — odds stretch the ratio because the outcome is common.
- Phi and Cramér's V: φ = (ad − bc)/√(10 × 6 × 9 × 7) = 38/√3780 = 0.618, and V = |φ| = 0.618. Cross-check: √(χ²/N) = √(6.112/16) = 0.618. On the 0.1 / 0.3 / 0.5 bands, a large association.
- Adjusted residuals: for cell a, (8 − 5.625)/√(5.625 × (1 − 10/16) × (1 − 9/16)) = 2.375/0.9607 = +2.47. All four cells give ±2.47, past ±1.96, so every cell is flagged as driving the result — the forced symmetry of a 2×2 table.
- The verdict to report: Fisher's exact p = 0.0350, odds ratio 20.0, φ = 0.618 — a significant, large association in a very small sample, quoted from the exact test because Cochran's rule failed, with the sample size stated so the reader can weigh it.
Fisher p = 0.0350 (the figure to trust here) · Pearson χ² = 6.112, p = 0.0134 · Yates χ² = 3.810, p = 0.0510 · G = 6.515, p = 0.0107 · OR = 20.0 · RR = 4.80 · φ = V = 0.618 · adjusted residuals ±2.47.