Crohns additive test of association with rs11957134
m = matrix(c(341,395,3151,5467),nrow=2)
row.names(m) = c("crohns","control")
colnames(m) = c("A","G")
print(m)
## A G
## crohns 341 3151
## control 395 5467
chisq.test(m)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: m
## X-squared = 27.242, df = 1, p-value = 1.795e-07
fisher.test(m)
##
## Fisher's Exact Test for Count Data
##
## data: m
## p-value = 2.287e-07
## alternative hypothesis: true odds ratio is not equal to 1
## 95 percent confidence interval:
## 1.283301 1.747461
## sample estimates:
## odds ratio
## 1.497685
example when chi2 approximation fails
m = matrix(c(11,0,31,54),nrow=2)
row.names(m) = c("crohns","control")
colnames(m) = c("A","G")
print(m)
## A G
## crohns 11 31
## control 0 54
chisq.test(m)$p.value
## Warning in chisq.test(m): Chi-squared approximation may be incorrect
## [1] 0.0002390852
fisher.test(m)$p.value
## [1] 4.853876e-05
chisq.test(m)$p.value/fisher.test(m)$p.value
## Warning in chisq.test(m): Chi-squared approximation may be incorrect
## [1] 4.925656