##Excel卡方检验,chisq.test()对数据排列有要求
---------------|----------------------
实际数| 64| 57.84| 理论数
实际数| 51| 57.16| 理论数
实际数| 21 |27.16| 理论数
实际数 |33 |26.84 |理论数
P值= 0.247684448 是错误的
##正确的数据排列是 :
实际数 64 21
51 33
理论数 57.84 27.16
57.16 26.84
P值 chisq.test(b1:c2,b3:c4)=0.042110012
R软件计算如下:
x<-matrix(c(64,51,21,33),2)
x
[,1] [,2]
[1,] 64 21
[2,] 51 33
chisq.test(x,correct = FALSE)
data: x
Pearson’s Chi-squared test
X-squared = 4.1305, df = 1, p-value = 0.04212