Calculating effect sizes between 3 groups for a set of variables in a dataset
问题 I would like to calculate the effect sizes of 3 treatments on 3 variables (x1, x2, x3). Suppose I have the following dataset: set.seed(1234) data <- data.frame( dose=factor(c(rep(1,25), rep(2,35), rep(3,40)), labels = c("low", "middle", "high")), x1 = rnorm(100, 0, 2), x2 = rnorm(100, 3, 3), x3 = rnorm(100, 9, 4) ) Now, I would like to calculate, for each combination of treatments, its effect size. I have found this function to calculate Cohen's d. cohens_d <- function(x, y) { lx <- length(x)