-
Notifications
You must be signed in to change notification settings - Fork 10
Barnard exact test
Maurice HT Ling edited this page Aug 14, 2021
·
1 revision
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 Boschloo’s exact test are more robust than Fisher exact test.
Code:
>>> from scipy import stats
>>> table = [[77, 404],
... [16, 122]]
>>> result = stats.barnard_exact(table)
>>> print("statistic = %.3f" % result.statistic)
statistic = 1.279
>>> print("p-value = %.3f" % result.pvalue)
p-value = 0.204
Reference:
- Barnard GA. 1947. Significance Tests for 2x2 Tables. Biometrika 34(1/2), 123-138.
Copyright (c) 2008-2024, Maurice HT Ling
Refereed Publications and Technical Reports
Abstracts and Other Un-Refereed Works
Autobiographic Verses (Poems that I wrote) and My Sayings