Hello,

I want to do pairwise calculation, but I am not sure how to do so.

i.e. I have a correlation matrix M 200*200. Namely colnames(M)=rownames(M).
In addition, colnames(M) is one of A, B, C, D. I want to first sort the
matrix M into 16 modules according to colnames and rownames, and then apply:
avecor <- function(x,y) {
z <- (sum(cor(x,y)*cor(x,y))/length(cor(x,y)))^0.5
return(z)
}

So as to calculate the average correlation between A,B; A,C; A,D; B,C; B,D;
C,D.

Thanks in advance for your help!

Best,
Amanda

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

Reply via email to