[R] Power Function

jethi kartija at hotmail.com
Sat Sep 25 02:26:08 CEST 2010


Hi, at first, i´m from germany, so sorry for my bad english. but i need ur
help in R to programm a power function  and to make at last a graphik of it.

i have already tried my best. but it doesn´t work.the topic is: the
homogeneity test of correlation based entropy. 

so it means, that i have to check if all correlations of a bivariate random
vectors are same or not. for that i saperate the  n bivariate random vectors 
(x1,y1),...,(xn,yn)  in blocks  m so, so that i at first calculate  the
correlation in a  block. n=m*k. the numbers of the blocks m are 
user-defined. the test value is the entropy. pls help me!!!


set.seed(1000)
n=100
m=5
k=n/m

x=rnorm(n,0,0.5)
y=rnorm(n,0,0.8)


 #alpha/2 Quantil
 q_1=qnorm(0.05,0,0.05) 
 
 #1-alpha/2 Quantile
 q_2=qnorm(0.95,0,0.05)


 l=matrix(0,nrow=m,ncol=1)
for(i in 1:m){


l[i]=print(cor((x[(((i-1)*k)+1):(((i-1)*k)+k)]),
(y[(((i-1)*k)+1):(((i-1)*k)+k)])))


}
güte=function(l){
p=matrix(0,nrow=m,ncol=1)
for(i in 1:m){
p[i]=l[i]^2/sum(l^2)

}
H=log(m)-sum(p*log(p))
1-mean(q_1<=H & H <=q_2)
}


l=seq(0,1,len=10)





plot(l,güte, type="o",pch=20,ylim=c(0,1),col="red")
-- 
View this message in context: http://r.789695.n4.nabble.com/Power-Function-tp2631929p2631929.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list