correct but sw <- mean(w) => sw <- sd(w) !!!