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

Time:12-01

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 {WSR2} 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!

CodePudding user response:

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.

CodePudding user response:

You can get both using effect.size = "both".

However, you may want to be aware of this issue raised on the github page for this package regarding how effect.size is calculated:

https://github.com/kassambara/rstatix/issues/132

  • Related