Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在r中运行多个方差分析测试_R_Anova - Fatal编程技术网

在r中运行多个方差分析测试

在r中运行多个方差分析测试,r,anova,R,Anova,我有七组人,我想对他们进行方差分析,看看他们之间是否有显著差异。我有大约600个特征。 我已经计算了每个群体和每个特征的平均值、标准差和方差。七组有不同的样本量。如何安排数据,以便能够在R中运行所有数据?set.seed(2) set.seed(2) sampledata <- expand.grid(group = paste0("group", 1:7), trait = paste0("trait", 1:600), value = 1:5) sampledata$value &l

我有七组人,我想对他们进行方差分析,看看他们之间是否有显著差异。我有大约600个特征。 我已经计算了每个群体和每个特征的平均值、标准差和方差。七组有不同的样本量。如何安排数据,以便能够在R中运行所有数据?

set.seed(2)
set.seed(2)

sampledata <- expand.grid(group = paste0("group", 1:7), trait = paste0("trait", 1:600), value = 1:5)
sampledata$value <- rnorm(nrow(sampledata))

sampledata.aov <- aov(value ~ group * trait, data = sampledata)
anova(sampledata.aov)

Analysis of Variance Table

Response: value
               Df  Sum Sq Mean Sq F value  Pr(>F)  
group           6     7.1  1.1784  1.1670 0.32072  
trait         599   658.0  1.0985  1.0878 0.07096 .
group:trait  3594  3613.0  1.0053  0.9955 0.56604  
Residuals   16800 16964.3  1.0098                  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
样本数据