从 chisq.test 中提取完整的 p.value
Extract the full p.value from chisq.test
从 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。
有没有办法从描述或实际值中获取信息而不是缩短值?
谢谢。
您的 p 值似乎为零,即:< 2.2e-16
。或者小于 R 可以处理的。
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
我们总是可以使用测试中的卡方估计,并计算 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
从 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。
有没有办法从描述或实际值中获取信息而不是缩短值?
谢谢。
您的 p 值似乎为零,即:< 2.2e-16
。或者小于 R 可以处理的。
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
我们总是可以使用测试中的卡方估计,并计算 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