Published
R’s exact2x2 drops a tied table in Boschloo’s test
For 8 of 10 vs 3 of 10 events, exact2x2::boschloo() gives a two-sided p of 0.033 instead of 0.041, because two tables that tie by symmetry are compared with exact floating-point equality.
A tied table is dropped
Boschloo’s test compares two proportions, such as tumours in 8 of 10 treated mice and 3 of 10 controls. It keeps the group sizes fixed and is usually more powerful than Fisher’s exact test for small tables. In the R package exact2x2 (version 1.7.0), boschloo() gives a two-sided p-value of 0.033 for that table. Kept correctly, the test gives 0.041. SciPy’s boschloo_exact gives 0.041.
The test orders every possible table by its one-sided Fisher p-value and adds up the probability of tables at least as extreme as the observed one. Two tables, (8, 3) and (7, 2), have the same Fisher p-value by the symmetry of the hypergeometric distribution. The two computed numbers differ only in the last digits:
| Table (events in group 1, group 2) | Computed Fisher p |
|---|---|
| (8, 3), observed | 0.034889259347463682 |
| (7, 2) | 0.034889259347463696 |
exact2x2 decides “at least as extreme” with exact floating-point equality, so table (7, 2) counts as less extreme and is left out. Summing over the nuisance parameter with the tie kept gives a one-sided p of 0.0207 and a two-sided p of 0.0414. With exact equality, as in exact2x2, the same calculation gives 0.0165 one-sided, which is the package’s result.
Ties of this kind can occur whenever the two groups have the same size, so the effect is not limited to this table. In this example both values are below 0.05, so the decision at the 5% level does not change.
What to do until it is fixed
In Python, use scipy.stats.boschloo_exact with each group in its own column; our chi-square vs Fisher guide shows how. In R, a user-supplied ordering function that rounds the Fisher p-value to 12 significant figures keeps the tie: the workaround script gives 0.0207 one-sided and 0.0414 two-sided. Our 2 × 2 table calculator compares tables with a relative tolerance and gives 0.041.
A fix in the package could compare the ordering statistic with a relative tolerance, as R’s own fisher.test() does when it collects tables at least as extreme.
Reproduce the observation
Rscript reproduce.RThe recorded run used R 4.3.3 and exact2x2 1.7.0 on Linux x86_64 on 11 November 2026; the comparison used Python 3.13 with SciPy 1.18.1.
- reproduce.R — standalone reproduction, about one second.
- observed-output.txt — captured output.
- scipy-output.txt — SciPy result for the same table.
- README.md — instructions and environment.
- SHA256SUMS — hashes for the four files above.
Status
Tasuku Kobayashi reported the problem to the exact2x2 maintainer by email on 11 November 2026, with this reproducer and a suggested fix. Upstream confirmation and a correction remain pending. The reproducer supports the technical observation; it does not show that the maintainer has received, confirmed or accepted the report. We found the problem while verifying the 2 × 2 table calculator against R and SciPy.