簡體   English   中英

R 中有條件的一種方式方差分析和 TUKEY

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

我試圖找到包含以下 6 個因素的變量 stim_ending_t 之間的平均差異: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

這是我的數據的可視化表示這是我的數據的可視化表示

問:如何在比較平均值的條件下進行方差分析,其中包含“現在專注於圖像”和“現在專注於聲音”的“Opening_test”。

問:我還想通過事后測試來跟進。

這是我嘗試過的,但顯然不是正確的方法!

# 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 個因子,因此自由度 (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

注意:參與者在一個會話中完成實驗,從條件-Opening_text 開始,隨機並完成另一個。

  1. 以下6個因素:1, 1.5, 2, 2.5, 3, 3.5

    不是! 如果您將其視為因子,它將是一個具有六個級別的因子。 您將其用作定量變量,請參閱方差分析表中的Df 它應該是 5 而不是 1。在aov之前嘗試as.factor()函數。

  2. m是因變量嗎? 如果是, visbilitysoundvolume多少? 如果它們也是因素,那么獨立性假設是錯誤的。 在這種情況下,您應該將這些因素引入建模。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM