我想进行理论上的卡方拟合优度测试:
actual <- c(20,80)
expected <- c(10,90)
chisq.test(expected,actual)
样本量 n=100,alpha=0.05,df=1。这给出了 3.84 的临界 chi 值。我可以手动计算测试统计为 ((20-10)^2)/10 + ((80-90)^2)/90 = 100/9 > 3.84
但是,上面的代码只是产生
Pearson's Chi-squared test with Yates' continuity correction
data: expected and actual
X-squared = 0, df = 1, p-value = 1
我的错误在哪里?