我对R真的很陌生,所以请多多包涵。我正在使用卡方检验来比较给定位置的核苷酸频率,并计算了两个不同数据集中的 A、C、G、T 的数量:
x1 <- c(272003,310418,201601,237168)
x2 <- c(239614,316515,182070,198025)
我可以想到两种方法来进行两样本卡方检验:
> chisq.test(x1,x2)
Pearson's Chi-squared test
data: x1 and x2
X-squared = 12, df = 9, p-value = 0.2133
Warning message:
In chisq.test(x1, x2) : Chi-squared approximation may be incorrect
或者
> chisq.test(cbind(x1,x2))
Pearson's Chi-squared test
data: cbind(x1, x2)
X-squared = 2942.065, df = 3, p-value < 2.2e-16
我怀疑第二个版本是正确的,因为我也可以这样做:
> chisq.test(x1,x1)
Pearson's Chi-squared test
data: x1 and x1
X-squared = 12, df = 9, p-value = 0.2133
Warning message:
In chisq.test(x1, x1) : Chi-squared approximation may be incorrect
具有相同且明显不正确的结果。
在这种情况下实际计算的是什么?
谢谢!