[R] Mean correlation within cluster
Sergio Ferreira Cardoso
sergio.ferreira-cardoso at umontpellier.fr
Tue Jun 13 10:15:00 CEST 2017
I'd like to calculate the mean correlation within a cluster and understand if it's significantly >0. I'm using packages 'geomorph' and 'paleomorph'.
#Simulate an array A <- array ( rep ( 1 : 36 , by = 4 ), dim = c ( 12 , 3 , 4 )) #Load 'geomorph' package and superimpose coordinates test.gpa <- gpagen ( A , print.progress = FALSE ) #Load 'paleomorph' and generate covariance and correlation matrices cvmatrix <- dotcvm ( test.gpa $ coords ) corrmatrix <- dotcorr ( test.gpa $ coords )
Then I do a clustering with Ward method and euclidean distance, using the cvmatrix and I get a dendrogram. This part is not the problem, so I'll go directly to what I want. I would like to calculate the mean correlation between the elements of each cluster. Since clustering methods will mandatorily produce clusters, I'd like to know if the elements of my clusters are correlated (I mean, if the clusters are valid).
I believe this might not be very complicated, given that I have all the elements. I just don't know how to do it on R. I tried to do the clustering with p-values for each cluster, with pvclust(), but I'm following a paper in which the authors test the significancy of the clusters by assessing the mean correlation of the elements within each cluster. I'd like to compare this method with the one from pvclust().
Thank you in advance.
[[alternative HTML version deleted]]
More information about the R-help