hi how can i plot now this function??? have to be m= 2??? because of the dimensions?thanks for ur help
myfun <- function(n, m, alpha = .05, seeder = 1000) { set.seed(seeder) x <- matrix(rnorm(n, 0, 0.5), ncol = m) y <- matrix(rnorm(n, 0, 0.8), ncol = m) l <- diag(cor(x, y)) cat("Correlations between two random variables \n", l, fill = TRUE) gute <- function(x, m, alpha) { q_1 <- qnorm(alpha, 0, 0.05) q_2 <- qnorm(1 - alpha, 0, 0.05) p <- (x^2)/sum(x^2) H <- log(m) - sum(p * log(p), na.rm = TRUE) 1 - mean(q_1 <= H & H <= q_2) } dat <- seq(0, 1, length.out = 10) output <- gute(x = dat, m = m, alpha = alpha) return(output) } [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.