这个结果来自R中的chisq.test。
rslt <- chisq.test(a$x, a$y)
Pearson's Chi-squared test
data: a$x and a$y
X-squared = 32944, df = 9, p-value < 2.2e-16但是提取p.value仅仅是0
> rslt$p.value
[1] 0我期望得到2.2e-16,而不是0。
我还试着取消列出rslt。
> unlist(rslt)
statistic.X-squared parameter.df p.value method
"32943.9488257678" "9" "0" "Pearson's Chi-squared test"但我还是得到了0而不是2.2e-16。
有没有办法从描述或实际值中获取信息,而不是从缩写的值中获取信息?
谢谢。
发布于 2019-12-07 07:31:44
rslt = chisq.test(cbind(c(10,20),c(30,40)))
Pearson's Chi-squared test with Yates' continuity correction
data: cbind(c(10, 20), c(30, 40))
X-squared = 0.44643, df = 1, p-value = 0.504我们总是可以使用测试中的chi-sq估计,并计算p.value。使用上面的示例,您可以看到它们是相同的。
rslt$p.value == pchisq(rslt$statistic,rslt$parameter,lower.tail=FALSE)
X-squared
TRUE 以您的示例为例,由于p.value非常小,因此使用日志:
pchisq(32943.9488257678,9,lower.tail=F,log.p=TRUE)
-16440.44发布于 2019-12-07 05:26:09
您的p值似乎是零,即:< 2.2e-16。或者小于R所能处理的。
https://stackoverflow.com/questions/59220464
复制相似问题