条件下R中的一种方差分析和TUKEY [英] one way ANOVA and TUKEY in R with conditions
问题描述
我正在尝试查找变量stim_ending_t之间的平均差异,该变量包含以下6个因素:1、1.5、2、2.5、3、3.5
I am trying to find the mean differences between my variable stim_ending_t which contains the following 6 factors: 1, 1.5, 2, 2.5, 3, 3.5
您可以访问df 此处
stim_ending_t visbility soundvolume Opening_text m sd coefVar
<dbl> <dbl> <dbl> <chr> <dbl> <dbl> <dbl>
1 1 0 0 Now focus on the Image 1.70 1.14 0.670
2 1 0 0 Now focus on the Sound 1.57 0.794 0.504
3 1 0 1 Now focus on the Image 1.55 1.09 0.701
4 1 0 1 Now focus on the Sound 1.77 0.953 0.540
5 1 1 0 Now focus on the Image 1.38 0.859 0.621
6 1 1 0 Now focus on the Sound 1.59 0.706 0.444
7 1.5 0 0 Now focus on the Image 1.86 0.718 0.387
8 1.5 0 0 Now focus on the Sound 2.04 0.713 0.350
9 1.5 0 1 Now focus on the Image 1.93 1.00 0.520
10 1.5 0 1 Now focus on the Sound 2.14 0.901 0.422
这是我的数据的直观表示
Here is a visual representation of my data
问:如何在通过"Opening_test"比较平均值的条件下进行方差分析,其中"Opening_test"包含"Now focus on the Image"和"Now focus on Sound".
Q: How I can do ANOVA with the condition of comparing the mean by "Opening_test" which contains "Now focus on the Image", and "Now focus on the Sound."
问:另外,我也想进行事后测试.
Q: Also I want to follow that with post hoc test.
这是我尝试过的方法,但显然不是正确的方法!
Here is what I have tried but apparently is not the right way!
# Compute one-way ANOVA test
res.aov <- aov(m ~ stim_ending_t, data = clean_test_master2)
summary(res.aov)
Df Sum Sq Mean Sq F value Pr(>F)
stim_ending_t 1 7.589 7.589 418.8 <2e-16 ***
Residuals 34 0.616 0.018
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
我认为aov结果有问题! stim_ending_t有6个因素,因此上表的Fredom(Df)的Dgree应该= 5而不是!= 1.
I think there is something wrong with result from aov! stim_ending_t has 6 factors, so Dgree of fredom (Df) should = 5 not != 1 from the above table.
# post hoc test
TukeyHSD(res.aov, conf.level = 0.99)
Here is the message I got
Error in TukeyHSD.aov(res.aov, conf.level = 0.99) :
no factors in the fitted model
In addition: Warning message:
In replications(paste("~", xx), data = mf) :
non-factors ignored: stim_ending_t
注意:参加者在一个会话中以任一条件-Opening_text开始,并随机完成了另一个,从而完成了实验.
推荐答案
以下6个因素:1、1.5、2、2.5、3、3.5
the following 6 factors: 1, 1.5, 2, 2.5, 3, 3.5
不!如果将其视为因子,它将是具有六个级别的一个因子.您将其用作定量变量,请参阅方差分析表中的Df
.应该改为5.1.在aov
之前尝试as.factor()
函数.
Not! It will be one factor with six levels, if you will treat it as factor. You are using it as quantitative variable, see Df
in ANOVA table. It should be 5 instead 1. Try as.factor()
function before aov
.
m
是因变量吗?如果是,visbility
和soundvolume
是什么?如果它们也是因素,则独立性的假设是错误的.在这种情况下,您应该引入这些因素进行建模.
Is m
the dependent variable? If yes, what is the visbility
and soundvolume
? If they are also factors, the assumption of independence is faulty. In this case you should introduce those factors to model.
这篇关于条件下R中的一种方差分析和TUKEY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!