Friday, 15 November 2013

Barnard's Test Calculator

This blog post implements an online Barnard's Test Calculator on a 2 by 2 contingency table for a two-sided test. Barnard's test is computationally intensive, and is not as widely used as Fisher's Exact test. However, many statisticians argue (with reasonable justification) that it is a more powerful test especially for the 2 $\times$ 2 contingency table scenario.

Please fill in the four text areas with integers greater than or equal to zero, but less than or equal to 100 (for computational reasons). Note that the outcomes are the rows of the table, whilst the columns are the categories (also known as treatments).

Category 1: Category 2:
Outcome 1:

Row Sum 1

Outcome 2:

Row Sum 2

Column Sum 1

Column Sum 2


Results pending...


  1. Hello. It appears that your calculator is entering rows and columns incorrectly. Suppose that I have 20 controls and 20 treated animals. The controls have 13 deaths and 7 survivors. The treated animals have 8 deaths and 12 survivors. I entered this data into SAS and got a p-value for Barnard's of 0.1539 versus your calculator's value of 0.1223. Next I flipped rows and columns, so there are 21 controls (13 deaths and 8 survivors) and 19 treated (7 deaths and 12 survivors). SAS yields a p-value of 0.1254 and your calculator yields 0.1254. If you send me your email, I can send you the SAS output.

  2. If outcome 1 is death and 2 is survival while category 1 is control and category 2 is treated then the numbers (in ABCD format) entered into the matrix are 13, 8, 7, 12. This produces a value of 0.1539 which seems to agree with the SAS calculation. So it appears to be ok.