one way ANOVA and TUKEY in R with conditions

前提是你 提交于 2020-01-16 16:29:09

问题


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

You can access the df Here

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."

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! 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

Note: the participants completed the experiment at one session by starting with either condition-Opening_text, randomly and completing the other one.

来源:https://stackoverflow.com/questions/56878555/one-way-anova-and-tukey-in-r-with-conditions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!