Boschloo’s exact test - mauriceling/mauriceling.github.io GitHub Wiki

Purpose: To test whether 2 categorical variables (defining the rows and columns) are independent in 2x2 contingency table.

Null hypothesis: There is no relationship between between the 2 categorical variables; that is, the 2 categorical variables are not independent.

Alternate hypothesis: There is a relationship between the 2 categorical variables; that is, the 2 categorical variables are not independent.

Note: This and Barnard exact test are more robust than Fisher exact test.

Code:

>>> from scipy import stats
>>> table = [[77, 404],
...          [16, 122]]
>>> result = stats.boschloo_exact(table)
>>> print("statistic = %.3f" % result.statistic)
statistic = 0.125
>>> print("p-value = %.3f" % result.pvalue)
p-value = 0.208

Reference:

  1. Boschloo RD. 1970. Raised Conditional Level of Significance for the 2x2-table when Testing the Equality of Two Probabilities. Statistica Neerlandica 24, 1–35.