I am using FactomineR to explore a set of continuous variables in a large set of sites (ecological data). I did a PCA and found the relevant principal components and their scores and such. Afterwards I do a hierarchical clustering on the resulting PCA using HCPC with K-means clustering of the sites. The result comes up with 3 clusters, which confirms what I expected when seeing the PCA plot. The data I am using (just for learning this stuff) can be found on http://datadryad.org/resource/doi:10.5061/dryad.rg832/1

The code I am using is the following:

pca <- PCA(pca_data_jouffray, graph=FALSE, scale.unit = TRUE)
hcpc <- HCPC(pca, min = 3, max=10, iter.max=10, graph=FALSE)

My question is the following: I can see the significance of each variable for each cluster with (in this case for cluster 1)


              v.test Mean in category Overall mean sd in category Overall sd          p.value
Macroalgae 11.646270        38.144928    15.142384      23.438186 18.6474238 2.397240e-31
Sand        9.303437        21.561594    11.087748      13.893514 10.6290048 1.359779e-20
CCA        -4.386715         3.094203     6.719785       3.940017  7.8031164 1.150752e-05
Hard.coral -5.755929         6.797101    18.303808       7.952790 18.8740653 8.616669e-09
Complexity -5.934810         1.702899     2.283113       0.737548  0.9230203 2.941863e-09
Turf.algae -7.446795        30.673913    48.649007      14.649733 22.7893314 9.563492e-14

But what I would like to know is if I can find out if the complete cluster is significantly different from the overall mean. So a p-value for each cluster as a whole, not split up by variable. I would think that there could be a test to see if the mean euclidean distances between the individuals of a cluster is significantly different of the overall mean euclidean distance between all individuals?

Is this possible?


By using the FactoMineR package it is possible to do what I want with the pvclust function. Basically what it does is get a number of random points (you specify the amount) that are the centroids of clusters. Than it calculates all the eucledian distances from all individual points to those centroids, assigns each point to the nearest cluster centroid, recalculates the cluster centroids, then recalculates the distance from each point to each new cluster centroid, and so on, in a maximum number of steps. It then calculates p-values for the resulting clusters with the null hypothesis that the cluster doesn't exist.

An example is the following:

fit <- pvclust(scale(na.omit(pca_data_jouffray)), method.hclust="ward", method.dist = "euclidean", nboot=10000)
plot(fit,print.pv = TRUE, print.num=FALSE, col.pv=c("purple","green","white"))

For more info see http://www.sigmath.es.osaka-u.ac.jp/shimo-lab/prog/pvclust/


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.