简体   繁体   English

R 中有条件的一种方式方差分析和 TUKEY

[英]one way ANOVA and TUKEY in R with conditions

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我试图找到包含以下 6 个因素的变量 stim_ending_t 之间的平均差异:1、1.5、2、2.5、3、3.5

You can access the df Here您可以在此处访问 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这是我的数据的可视化表示这是我的数据的可视化表示

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."问:如何在比较平均值的条件下进行方差分析,其中包含“现在专注于图像”和“现在专注于声音”的“Opening_test”。

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

I think there is something wrong with result from aov!我认为 aov 的结果有问题! stim_ending_t has 6 factors, so Dgree of fredom (Df) should = 5 not != 1 from the above table. stim_ending_t 有 6 个因子,因此自由度 (Df) 应该 = 5,而不是上表中的 != 1。

# 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

Note: the participants completed the experiment at one session by starting with either condition-Opening_text, randomly and completing the other one.注意:参与者在一个会话中完成实验,从条件-Opening_text 开始,随机并完成另一个。

  1. the following 6 factors: 1, 1.5, 2, 2.5, 3, 3.5以下6个因素:1, 1.5, 2, 2.5, 3, 3.5

    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.您将其用作定量变量,请参阅方差分析表中的Df It should be 5 instead 1. Try as.factor() function before aov .它应该是 5 而不是 1。在aov之前尝试as.factor()函数。

  2. Is m the dependent variable? m是因变量吗? If yes, what is the visbility and soundvolume ?如果是, visbilitysoundvolume多少? If they are also factors, the assumption of independence is faulty.如果它们也是因素,那么独立性假设是错误的。 In this case you should introduce those factors to model.在这种情况下,您应该将这些因素引入建模。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM