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

Total





Results pending...

5 comments:

  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.

    ReplyDelete
    Replies
    1. did anyone reply to this and correct?

      Delete
    2. Hal, is your sas program able to test 3x3 or any different count of rows/cols tables?

      Delete
  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.

    ReplyDelete
  3. I have R package from https://www.r-statistics.com/2010/02/barnards-exact-test-a-powerful-alternative-for-fishers-exact-test-implemented-in-r/ and my output for Your data is:

    >Animals:
    Deaths Survivors
    Control group 13 7
    Treated animals 8 12
    > Barnard(Animals)
    2x2 matrix Barnard's exact test: 100 22x20 tables were evaluated
    -----------------------------------------------------------
    Wald statistic = 1.5831
    Nuisance parameter = 0.13139
    p-values: 1-tailed = 0.066963 2-tailed = 0.13393
    -----------------------------------------------------------
    ----
    >Animals2:
    Deaths Survivors
    Control group 13 8
    Treated animals 7 12
    2x2 matrix Barnard's exact test: 100 21x21 tables were evaluated
    -----------------------------------------------------------
    Wald statistic = 1.5831
    Nuisance parameter = 0.49495
    p-values: 1-tailed = 0.07692 2-tailed = 0.15384
    -----------------------------------------------------------

    ReplyDelete