dat <- data.frame(x1 = c(1, 1, 1, 1, 2, 2, 2, 2, 2),
x2 = c(1, 1, 1, 2, 2, 2, 3, 3, 3),
y1 = c(3, 2, 4, 5, 6, 4, 7, 5, 7),
y2 = c(2, 4, 1, 5, 3, 3, 4, 6, 7))
# Eta squared for y1 explained by x1
eta.sq(dat$y1, group = dat$x1)
# Eta squared for y1 and y2 explained by x1 and x2
eta.sq(dat[, c("y1", "y2")], group = dat[, c("x1", "x2")])
Run the code above in your browser using DataLab