How this calculator works
Under the null odds ratio of one, the upper-left cell has a hypergeometric distribution conditional on the margins. The two-sided p-value adds probabilities of all feasible tables no more probable than the observed table. This probability-ordering definition can differ from doubling a one-sided p-value. Right-tailed inference favours odds ratio above one. The displayed odds ratio is the sample cross-product ratio, not the conditional maximum-likelihood estimate. Use independent sampling units rather than paired outcomes.
Formula
P(A = a | margins) = C(a + b,a) C(c + d,c)/C(n,a + c). Sample OR = ad/(bc). Two-sided p sums tables with probability ≤ the observed table probability.
Worked example
The table [1,9;11,3] has sample odds ratio 1/33 and two-sided exact p ≈ 0.002759456. For [1,1;1,1], all association evidence is absent and the two-sided p-value is 1.
Advertisement
Frequently asked questions
Why do exact programs sometimes disagree?
Two-sided discrete tests can use probability ordering, doubled tails or other conventions. Compare definitions before comparing numbers.
Can cells be zero?
Yes, if all row and column totals remain positive. A sample odds ratio can then be zero, infinite or undefined.
Is this appropriate for before-and-after pairs?
No. Pairing changes the sampling model; McNemar's test uses the discordant pairs.