简体   繁体   中英

Cluster analysis, dendrogram by group/habitat not sample

I cannot seem to find a thread relating to my issue (in simple terms at least).

I have a community matrix of species (columns) by sample sites (rows). I firstly performed a Bray-Curtis transformation to get a similarity/dissimilarity matrix ( vegdist ) and secondly, applied hclust function to the matrix.

Section of script I used:

library(vegan)
community_matrix <- read.csv(choose.files(),sep=",",row.names=1)
d = (1 - vegdist(community_matrix, method="bray")) * 100
h = hclust(d, method = "ward.D2")
plot(h, main = "", sub = "", xlab="", ylab = "Bray-Curtis simmilarity", axes = FALSE, hang = -1)

Everything works perfect however, the above resulted in a dendrogram tree with 127 branches (one for each sample site). I want to rather group the 127 sample sites by 5 HABITATS these sites belong to. Then the dendrogram's branches would show a more understanding, 5-branched (habitats) dendrogram instead of sample sites. Thus, clustering must be performed on the habitats and weighted by sample sites.

I performed this analysis before in PC-ORD but this time it must be done in unforgiving R.

Aggregate your data.

If you want to cluster habitats, your data should be on habitats, not sites.

However, if the habitat structure does not emerge from the sites, the similarity of habitats may be not very substantial / well-supported by the data (or the data is not preprocessed well enough).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM