简体   繁体   English

如何使用重复测量计算秩对齐方差分析的部分 eta 平方(R 中的 ARTool package)?

[英]How can I calculate partial eta squared for rank-aligned ANOVA with repeated measures (ARTool package in R)?

I calculated several rank-aligned ANOVAs using the ARTool package in RStudio.我使用 RStudio 中的 ARTool package 计算了几个秩对齐的方差分析。 Please note that all included variables are repeated measures (ie, within-subjects; all participants went through all experimental manipulations).请注意,所有包含的变量都是重复测量(即,受试者内;所有参与者都经历了所有实验操作)。

According to this source https://cran.r-project.org/web/packages/ARTool/vignettes/art-effect-size.html , the output should include the partial eta squared and the sum of squares, respectively.根据此来源https://cran.r-project.org/web/packages/ARTool/vignettes/art-effect-size.html ,Z78E6221F6393D1356681DB398F14CE 的总和分别应包括 6 的平方和。 However, I found that only the output of a between-subjects design contains the sum of squares.但是,我发现只有受试者间设计的 output 包含平方和。 If I calculate a within-subjects ANOVA, the partial eta squared or sum of squares are not printed.如果我计算受试者内方差分析,则不会打印部分 eta 平方或平方和。 Does anyone have an idea on why this occurs?有谁知道为什么会发生这种情况? (I've updated the ARTool package to its latest version) (我已将 ARTool package 更新到最新版本)

The example does not actually make sense with this dataset, but just to demonstrate:该示例实际上对这个数据集没有意义,只是为了演示:

data("cars")

cars$id <- 1:50
cars_long <- reshape2::melt(cars, id = "id")
cars_long <- cars_long[base::order(cars_long$id), ]

ardat_cars_bs <- ARTool::art(data = cars_long,
                              formula = value ~ variable) 
ardat_cars_ws <- ARTool::art(data = cars_long,
                                 formula = value ~ variable + (1|id)) 

aranova_cars_bs <- stats::anova(ardat_cars_bs) #between-subjects rank-aligned ANOVA
base::print(aranova_cars_bs, verbose = TRUE) #prints sum of squares needed to calculate partial eta squared

aranova_cars_ws <- stats::anova(ardat_cars_ws) #within-subjects rank-aligned ANOVA
base::print(aranova_cars_ws, verbose = TRUE) #does not print sum of squares

Please note: I also asked this question here https://stats.stackexchange.com/questions/559730/how-can-i-calculate-partial-eta-squared-for-rank-aligned-anova-with-repeated-mea请注意:我在这里也问过这个问题https://stats.stackexchange.com/questions/559730/how-can-i-calculate-partial-eta-squared-for-rank-aligned-anova-with-repeated-mea

Partial eta -squared can also be calculated from the F value and the degrees of freedom.也可以从F值和自由度计算偏eta -squared。

With the caveat that I wrote it, at the time of writing, this is addressed here: rcompanion.org/handbook/F_16.html在撰写本文时,请注意我写的内容: rcompanion.org/handbook/F_16.html

A simple example:一个简单的例子:

Y = c(1,2,3,4,5,6,7,8,9,10,11,12)
Group = factor(c(rep("A", 6), rep("B", 6)))
ID    = factor(rep(c("i", "ii"), 6))
Data  = data.frame(Group, ID, Y)

library(ARTool)

model = art(Y ~ Group + (1|ID), data=Data)

Result = anova(model)


Result$part.eta.sq = with(Result, `F` * `Df` / (`F` * `Df` + `Df.res`))

Result

   ### Analysis of Variance of Aligned Rank Transformed Data
   ### 
   ### Table Type: Analysis of Deviance Table (Type III Wald F tests with Kenward-Roger df) 
   ### Model: Mixed Effects (lmer)
   ### Response: art(Y)
   ### 
   ###               F Df Df.res     Pr(>F) part.eta.sq    
   ### 1 Group 30.857  1      9 0.00035418     0.77419 *** 

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

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