4.6 Fisher’s exact test

We can wrap our table in the fisher.test function to perform a Fisher’s exact test. This test tells us whether there is a non-random association between any of the SNP alleles, while accounting for the relative proportions of each allele.

fisher.test(table(haplotypes$snp1_allele, haplotypes$snp2_allele))
## 
##  Fisher's Exact Test for Count Data
## 
## data:  table(haplotypes$snp1_allele, haplotypes$snp2_allele)
## p-value < 2.2e-16
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
##  22.49760 32.33934
## sample estimates:
## odds ratio 
##    26.9124

The p-value is very small (< 2.2e-16), so we can reject the null hypothesis that the two SNPs are associating independently of each other.


How do we interpret the odds ratio from the Fisher’s exact test?

In addition to the p-value, Fisher’s Exact Test also gives us an odds ratio of 26.9, with a 95% confidence interval of [22.5, 32.3]. In this context, the odds ratio reflects how much more likely you are to see an A at SNP1 if you also see an C at SNP2.

We can observe that the 95% confidence interval doesn’t overlap with 1. An odds ratio of 1 would mean that seeing C at SNP2 doesn’t influence the probability of seeing an A at SNP1.

This is a somewhat non-canonical usage of Fisher’s exact test, and in our case the odds ratio applies to whatever haplotype is in the top left corner of our 4x4 table. We could rearrange the table to calculate the odds ratio for any of the three other combinations of alleles.


Together, the p-value and 95% confidence interval tell us that there is strong evidence of LD between these SNPs. Perhaps this isn’t surprising, since our two SNPs are common and close to one another on chromosome 21.