I am trying to get pairwise comparisons of effect sizes. I can do this with coh_d
, however, it gives me repeat comparisons. For example, in the following code, setosa vs. versicolor is the same as versicolor vs. setosa (apart from the flipped negative/positive sign).
library(esvis)
iris<- iris
coh_d(Sepal.Length ~ Species, data=iris)
1.) Are both combinations something that would need to be reported? If not, is there a way to remove duplicated comparisons?
2.) Is there a way to add an identifying column to the output of each comparison. In the above code, that would be adding 6 rows that are labeled Sepal.Length, so when I find effect sizes for multiple columns, I know which variable the comparisons belong to. I'd like the final output to look something like:
a <- colnames(iris)
a <- a[1:4]
effect_fun<- function(y,x){
form2<- as.formula(paste0(y, "~", x))
res2<- effect<- rstatix::kruskal_effsize(data = iris, form2, conf.level = 0.95)
return(res2)
}
effect.sizes<- lapply(a, FUN = effect_fun, x="Species")
effect.sizes<- do.call(rbind, effect.sizes)
View(effect.sizes)
While using kruskal_effsize
gives me the format of the output I want, it does not show the pairwise comparisons which is why I switched to coh_d
.
Any help would be appreciated.