本文介绍了从R中的回归输出(lm)中提取最终的p值的处理方法
您可以通过键入
class(sumres)
#> "summary.lm"
获取类,然后通过键入
stats:::print.summary.lm
进入包含以下行的控制台:
cat(...lots of stuff..., "p-value:", format.pval(pf(x$fstatistic[1L],
x$fstatistic[2L], x$fstatistic[3L], lower.tail = FALSE),
digits = digits)...morestuff...)
因此,在这种情况下,您需要:
pf(sumres$fstatistic[1L], sumres$fstatistic[2L], sumres$fstatistic[3L], lower.tail = FALSE)
如果你看完上面还不理解的话,直接加入我写好的这段代码即可得到P值:
sumres <- summary(fit)
P <- pf(sumres$fstatistic[1L], sumres$fstatistic[2L], sumres$fstatistic[3L], lower.tail = FALSE)
这篇关于从R中的回归输出(lm)中提取最终的p值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助