細(xì)節(jié)可參考:
https://www.plob.org/article/9194.html
https://blog.csdn.net/u011955252/article/details/50704459
https://www.cnblogs.com/emanlee/archive/2008/10/25/1319569.html
https://statsandr.com/blog/fisher-s-exact-test-in-r-independence-test-for-a-small-sample/
使用結(jié)論:
一:對(duì)于2*2的列聯(lián)表:
(1)當(dāng)T(此處為最小理論頻數(shù)座舍,下同)>=5, n>=40 時(shí)衫冻,直接用Pearson 卡方檢驗(yàn)沿腰;
(2)當(dāng)1 = 40 時(shí)诉濒,需要用連續(xù)性校正公式做卡方檢驗(yàn)挣跋。這是因?yàn)榭ǚ椒植紴檫B續(xù)型分布,而2*2列聯(lián)表資料是分類資料献起,所以樣本量較小時(shí)要進(jìn)行連續(xù)性校正涨椒。
(3)當(dāng)T<1 , 或者 n < 40, 或做卡方檢驗(yàn)后所得的P值接近檢驗(yàn)水準(zhǔn)a 時(shí),用Fisher exact test
二:對(duì)于行×列表資料檢驗(yàn)
要求每個(gè)格子中的理論頻數(shù)T均大于5或1<1或1
注意:
理論頻數(shù)津坑,并非實(shí)際觀測值
可參考:https://www.cnblogs.com/emanlee/archive/2008/10/25/1319569.html
理論頻數(shù)計(jì)算:
> b <- data.frame(CD=c(19,34), contol=c(24,10))
> b
CD contol
1 19 24
2 34 10
> chisq.test(b)$expected
CD contol
[1,] 26.1954 16.8046
[2,] 26.8046 17.1954
在通過判斷理論值T及總數(shù)n進(jìn)行選擇Chi-square test還是Fisher exact test