SE2 <- function(x, y) { # SE von x und y zusammen # fuer einen 2-sample t-test nx = length(x) ny = length(y) sx = sd(x) sy = sd(y) num = ((nx - 1) * sx^2) + ((ny - 1) * sy^2) den = nx + ny - 2 sqrt(num/den) * sqrt(1/nx + 1/ny) } x = c(20, 15, 19, 22, 17, 16, 23, 18, 20) y = c(18, 15, 17, 24, 15, 12, 14, 11, 13, 17, 18)