Reputation: 43
I calculated several rank-aligned ANOVAs using the ARTool package in RStudio. Please note that all included variables are repeated measures (i.e., 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. However, I found that only the output of a between-subjects design contains the sum of squares. If I calculate a within-subjects ANOVA, the partial eta squared or sum of squares are not printed. Does anyone have an idea on why this occurs? (I've updated the ARTool package to its latest version)
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
Upvotes: 1
Views: 486
Reputation: 510
Partial eta-squared can also be calculated from the F value and the degrees of freedom.
With the caveat that I wrote it, at the time of writing, this is addressed here: 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 ***
Upvotes: 1