我在R中进行了卡方检验,结果是:
crianza = matrix(c(1,1,0,12,12,7,2,1,0,0,1,0,0,0,5,
0,0,0,1,1,2,0,0,3,0,0,0,13,35,29,0,0,1,10,
0,0,1,0,0,0,0,0),ncol=3,byrow=TRUE)
colnames (crianza) = c("Neonate","Juevenile","Adult")
rownames (crianza) = c("C.acronotus","C.limbatus","C.obscurus","C.perezi",
"C.porosus","C.falciformis","G.cuvier","G.cirratum","M.canis",
"R.porosus","R.lalandii","S.lewini","S.mokarran","S.tiburo")
crianza = as.table(crianza)
Pearson's Chi-squared test
data: crianza
X-squared = NaN, df = 26, p-value = NA
Warning message:
In chisq.test(crianza) : Chi-squared approximation may be incorrect
有人知道它为什么发出警告吗?是因为我使用了错误的方法吗?
答案 0 :(得分:3)
您获得NA
个值,因为您的行根本没有计数。
cc <- crianza[rowSums(crianza)>0,]
chisq.test(cc)
要规避警告,请尝试simulate.p.value=TRUE
:
chisq.test(cc, simulate.p.value=TRUE)
请注意,这是一个非常不平衡的表,具有模拟的p值,实际上您将获得一个小至1 /(运行模拟的数量)的值:
chisq.test(cc, simulate.p.value=TRUE, B=1e6)
在没有耐心之前,我已经达到B=1e7
。您可能不必担心报告的值超出“ p值非常小,最多1e-6”