[R] what is the result of this code
Ehs
ehsazh at gmail.com
Tue Oct 28 10:25:55 CET 2008
can any one help me to now , what is the result of this code ?
#start
edw<-function(mm,n){
v2<-v3<-0
d<-dim(mm)
dd<-d[1]*d[2]
p1<-2*n/(dd*(dd-n))
p2<-(n*(n-1)*(dd-n)+2*n*(dd-d[1]-d[2]-n+2))/(dd-d[1]-d[2]+1)*(dd-n)
v1<-((dd-n-1)/(n+1))*sum(mm^2)
c1<-(dd^2*p1)/(n+1)^2-1
c2<-(dd^2*p2)/(n+1)^2-1
for(i in 1:d[1]){
for(j in 1:d[2]){
f1<-c(mm[i,-j],as.matrix(t(mm[-i,j])))
f2<-mm[-i,-j]
a<-sum(c2*f2*mm[i,j])
b<-sum(c1*f1*mm[i,j])
v2<-v2+a
v3<-v3+b
}
}
v<-(v1+v2+v3)/dd^2
}
#end
thanks .
More information about the R-help
mailing list