Search code examples
rdebugginganovarstatix

In the rstatix function anova_test, how do I get both ges and pes as effect sizes?


It says here that one can get one or the other or both. I have been able to get each one separately but not both together even when I set effect.size = c("ges", "pes"). Instead, I only get "pes". I have the same problem when I use my own data and when I use the hangover dataset from the {WRS2} package. For the hangover data, my code is:

anova_test(data = hangover, dv = symptoms, wid = id, between = group, within = time, effect.size = c("ges", "pes"))

I would be very grateful for your help!


Solution

  • This seems to be an error in either the docs or the code. The docs do say you can specify both, but the relevant code uses if / else to return just one or the other:

    add_anova_effect_size <- function(res.anova.summary, effect.size = "ges",  observed = NULL){
      ss.exists <- "SSn" %in% colnames(res.anova.summary$ANOVA)
      if(!ss.exists){
        return(res.anova.summary)
      }
      if("pes" %in% effect.size){
        res.anova.summary <- res.anova.summary %>%
          add_partial_eta_squared()
      }
      else {
        res.anova.summary <- res.anova.summary %>%
          add_generalized_eta_squared(observed)
      }
      res.anova.summary
    }
    

    But also, as discussed here and mentioned by @Phenomniverse, rstatix currently calculates ges incorrectly.