When to use it
Use for 2x2 tables when sample sizes are small or expected cell counts are < 5.
Required Inputs
- 2x2 Contingency Matrix counts [[a, b], [c, d]]
- Alternative hypothesis (two-sided, greater, less)
Calculate exact hyper-geometric p-values and odds ratios for 2x2 contingency tables using Fisher's exact test.
Run this test live in StatLab npm i @statlab/coreUse for 2x2 tables when sample sizes are small or expected cell counts are < 5.
p = [ (a+b)! (c+d)! (a+c)! (b+d)! ] / [ a! b! c! d! n! ]
from scipy import stats
oddsratio, pvalue = stats.fisher_exact([[4, 1], [0, 5]])
print(f"OR={oddsratio:.4f}, p={pvalue:.4f}")
fisher.test(matrix(c(4, 0, 1, 5), nrow=2))
import { fisherExact } from '@statlab/core';
const res = fisherExact([[4, 1], [0, 5]]);
Continuous A/B testing, statistical telemetry analysis, and automated feedback loops for live backend services.
Explore VoxelPulse →Fixed-price AI release-readiness sprints, automated regression testing, and reliability statistical benchmarks.
Explore VoxelAssurance →Explore static calculators across the StatLab inference engine suite.