hey, how can i plot this function?

n=1000
m=2
k=n/m
N=100
myfun <- function(n, m, alpha = .05, seeder = 1000) {
l=matrix(0,nrow=m,ncol=N)
for(i in 1:N){
set.seed(i)
for(j in 1:m){
x=rnorm(n,0,0.5)
y=rnorm(n,0,0.8)
l[j,i]=cor((x[(((j-1)*k)+1):(((j-1)*k)+k)]),
(y[(((j-1)*k)+1):(((j-1)*k)+k)]))
}
}

gute <- function(x) {
    q_1 <- qnorm(alpha, 0, 0.05)
 
    q_2 <- qnorm(1 - alpha, 0, 0.05)
 
p=matrix(0,nrow=m,ncol=N)
H=matrix(0,nrow=N,ncol=1)
for(i in 1:N){
for (j in 1:m){
p[j,i]=x[j]^2/sum(x[,i]^2)
}
H[i]=log(m)-sum(p[,i]*log(p[,i]))
}
   1 - mean(q_1 <= H & H <= q_2)
}
output <- gute(x = l)
 return(output)
}

regards
jethi
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Power-Function-tp2631929p2713799.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

Reply via email to