I have a dateset plink.raw and I am testing if a maker CN00020133 (has three level 0, 1, 2) is associated with phenotype5. I want to compare 0 vs 1 and 2 vs 1 using GLM or fisher extract test:
table(plink.raw$phenotype5,plink.raw$CN00020133)
1 0 2
0 3559 0 7
1 14806 54 123
tested using GLM, I can see the p value for 0 vs 1 is 0.912894.
plink.raw$CN00020133 <- factor(plink.raw$CN00020133, levels=c("1","0","2")) univariate=glm(phenotype5 ~ relevel(CN00020133,ref ="1"), family = binomial, data = plink.raw) summary(univariate)
Call:
glm(formula = phenotype5 ~ relevel(CN00020133, ref = "1"), family = binomial, data = plink.raw)
Deviance Residuals:
Min 1Q Median 3Q Max -2.4173 0.6564 0.6564 0.6564 0.6564
Coefficients:
Estimate Std. Error z value Pr(>|z|) (Intercept) 1.42555 0.01867 76.361 < 2e-16 *** relevel(CN00020133, ref = "1")0 13.14051 120.12616 0.109 0.912894 relevel(CN00020133, ref = "1")2 1.44072 0.38902 3.703 0.000213 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 18158 on 18548 degrees of freedom Residual deviance: 18114 on 18546 degrees of freedom AIC: 18120 Number of Fisher Scoring iterations: 13
But if I tested it using fisher exact test, p value for 0 vs 1 is 4.618e-06.
Convictions <- matrix(c(0, 54, 3559, 14806), nrow = 2,dimnames = list(c("control", "case"),c("del/dup", "normal_copy"))) fisher.test(Convictions, alternative = "less") Fisher's Exact Test for Count Data data: Convictions p-value = 9.048e-06 alternative hypothesis: true odds ratio is less than 1 95 percent confidence interval: 0.0000000 0.2374411 sample estimates: odds ratio 0