我必须进行Shapiro-Wilk常态测试。我的数据集构建如下:
Condition0 <- c(0.9201584, 0.8386860, 0.8092635, 0.8166590, 0.8653545)
Condition1 <- c(0.9905397, 0.9498400, 1.0378111, 0.9740314, 1.0355568)
Condition2 <- c(0.9529179, 1.0919274, 1.0089470, 1.0067670, 0.9686904)
Condition3 <- c(0.7402958, 0.7890059, 0.8060471, 0.8020820, 0.7931508)
Condition4 <- c(0.7725662, 0.6916708, 0.7698080, 0.7476060, 0.7602339)
Control <- c(0.7707546, 0.7035131, 0.7268695, 0.8217838, 0.7641010)
dataset <- data.frame(Condition0, Condition1, Condition2, Condition3, Condition4, Control, row.names = c("d1", "d2", "d3", "d4", "d5"))
如您所见,有6个条件,每个条件有5个结果。
以这种方式进行Shapiro-Wilk测试是否正确,为每个条件划分数据集?
shapiro.test(dataset$Condition0)
shapiro.test(dataset$Condition1)
shapiro.test(dataset$Condition2)
shapiro.test(dataset$Condition3)
shapiro.test(dataset$Condition4)
shapiro.test(dataset$Control)
或者,我是否应该以不同的方式构建我的数据集,并在整个数据集中进行测试,无论因素如何&#34;条件&#34;? 像这样:
my_data <- c(0.9201584, 0.8386860, 0.8092635, 0.8166590, 0.8653545,
0.9905397, 0.9498400, 1.0378111, 0.9740314, 1.0355568,
0.9529179, 1.0919274, 1.0089470, 1.0067670, 0.9686904,
0.7402958, 0.7890059, 0.8060471, 0.8020820, 0.7931508,
0.7725662, 0.6916708, 0.7698080, 0.7476060, 0.7602339,
0.7707546, 0.7035131, 0.7268695, 0.8217838, 0.7641010)
cycle <- rep(c("d1", "d2", "d3", "d4", "d5"), 6)
Condition <- rep(c("Condition0","Condition1", "Condition2", "Condition3", "Condition4", "Control"), each = 5)
dataset2 <- data.frame(my_data, cycle, Condition)
shapiro.test(dataset2$my_data)
在Shapiro-Wilk测试之后,我将运行ANOVA或Kruskall-Wallis(取决于结果)以查看不同条件之间是否存在任何差异。像这样:
my_lm <- lm(my_data ~ Condition, data= dataset2)
anova(my_lm)
您认为哪一个是正确的?谢谢你的回答!