Vegetation plots, located at even distances along transects following the steep valley slopes of Vltava river valley, collected during 2001-2003. Each transect starts at the valley bottom and ends up at the upper part of the valley slope. Altogether 97 plots located in 27 transects were collected, each of the size 10x15 m. In each plot, all tree, shrub and herb species were recorded and their abundances were estimated using 9-degree ordinal Braun-Blanquette scale (these values were consequently transformed into percentage scale).
library("vegan")
## Loading required package: permute
v_url <- "https://bit.ly/vltava-spp"
vltava <- read.delim(url(v_url), row.names = 1)
head(vltava)
We fit 4 clustering methods:
vltava_sqrt <- sqrt(vltava)
# dis <- vegdist(decostand(vltava, method = "hellinger"),
# method = "euclidean")
dis <- vegdist(vltava, method = "hellinger")
dis_sqrt <- vegdist(vltava_sqrt, method = "euclidean")
cl_single <- hclust(dis, method = 'single')
cl_complete <- hclust(dis, 'complete')
cl_average <- hclust(dis, "average")
cl_ward <- hclust(dis, "ward.D2")
Plot the dendrograms
layout(matrix(1:4, ncol = 2))
plot(cl_single, hang = -0.1)
plot(cl_complete, hang = -0.1)
plot(cl_average, hang = -0.1)
plot(cl_ward, hang = -0.1)
layout(1)
Now look at k-means
set.seed(42)
vltava_hell <- decostand(vltava, method = "hellinger")
cas_km <- cascadeKM(vltava_hell, 1, 10)
set.seed(5698)
cas_km_2 <- cascadeKM(vltava_hell, 1, 10)
set.seed(42)
cas_km_sqrt <- cascadeKM(sqrt(vltava), 1, 10)
We can plot this
plot(cas_km)
The cophenetic distances can be computed from the dendrogram using
cophenetic(). Then we can compute the cophenetic
correlation, the correlation between the original dissimilarities and
the cophenetic distances using cor()
cop <- cophenetic(cl_ward)
cor(cop, dis)
## [1] 0.5546718
Refer back to the slides and compute the following diversity measure
Richness
Shannon-Wiener
Simpson’s
Hills N2