R-方差分析提取 p_value 的一种方式 [英] R- One way anova extracting p_value

查看:39
本文介绍了R-方差分析提取 p_value 的一种方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对数据集的几行进行单向方差分析,然后提取 p_value 以供以后使用.

I'm trying to do a one-way anova on several row of a dataset and extract the p_value to use it afterwards.

这是我所做的:

anova <- function(x) {summary(aov(x ~ bt.factor))[[1]]["Pr(>F)"]}
anv.pval <- apply(golubALL, 1, anova)

使用这个公式,我可以提取 pvalue 但它带有其他元素:

With this formula i'm able to extract the pvalue but it comes with other elements:

$`1414_at`
            Pr(>F)
bt.factor   0.7871
Residuals

我想要的结果只是列表中的这个.我怎么能提取它?

What I would like to have as a result is only this in a list. How could I extract it ?

推荐答案

考虑使用 broom.使用 tidy(),您只能提取 p.value 字段:

Consider using broom. With tidy(), you can extract only the p.value field:

require(broom)
a <- aov(mpg ~ wt, mtcars)

tidy(a)
#        term df    sumsq     meansq statistic      p.value
# 1        wt  1 847.7252 847.725250  91.37533 1.293959e-10
# 2 Residuals 30 278.3219   9.277398        NA           NA

tidy(a)$p.value
# [1] 1.293959e-10           NA

这篇关于R-方差分析提取 p_value 的一种方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆