Open frankpapenmeier opened 2 years ago
The development of effectsizes from anova models is better supported in the effectsize package, which is also used by the parameters package. Example:
library(parameters)
# generate some data
set.seed(325)
dat <- expand.grid(
factor1 = c("A","B"),
factor2 = c("X","Y"),
participant = 1:10
)
dat$participant <- factor(dat$participant)
dat$value <- rnorm(length(dat$participant))
# add some main effects
dat$value[dat$factor1 == "A"] <- dat$value[dat$factor1 == "A"] + rnorm(dat$value[dat$factor1 == "A"], 5)
dat$value[dat$factor2 == "X"] <- dat$value[dat$factor2 == "X"] + rnorm(dat$value[dat$factor2 == "X"], 2)
# 2x2 repeated measures ANOVA
model <- aov(value ~ factor1*factor2 + Error(participant/(factor1*factor2)), dat)
model_parameters(model, eta_squared = "partial")
#> # participant
#>
#> Parameter | Sum_Squares | df | Mean_Square
#> ------------------------------------------
#> Residuals | 17.41 | 9 | 1.93
#>
#> # participant:factor1
#>
#> Parameter | Sum_Squares | df | Mean_Square | F | p | Eta2 (partial)
#> -----------------------------------------------------------------------------
#> factor1 | 317.89 | 1 | 317.89 | 225.57 | < .001 | 0.96
#> Residuals | 12.68 | 9 | 1.41 | | |
#>
#> # participant:factor2
#>
#> Parameter | Sum_Squares | df | Mean_Square | F | p | Eta2 (partial)
#> ---------------------------------------------------------------------------
#> factor2 | 28.70 | 1 | 28.70 | 12.16 | 0.007 | 0.57
#> Residuals | 21.24 | 9 | 2.36 | | |
#>
#> # participant:factor1:factor2
#>
#> Parameter | Sum_Squares | df | Mean_Square | F | p | Eta2 (partial)
#> --------------------------------------------------------------------------------
#> factor1:factor2 | 4.81 | 1 | 4.81 | 4.58 | 0.061 | 0.34
#> Residuals | 9.46 | 9 | 1.05 | | |
#>
#> Anova Table (Type 1 tests)
Created on 2022-01-21 by the reprex package (v2.0.1)
I suggest using either effectsize or parameters. The anova-functions in sjstats are going to be deprecated.
I noticed that the anova_stats function returns wrong partial eta squared values for repeated measures ANOVAs.
Please see the following reproducible example for details regarding the issue and its source: