# Source additional functions that will be used later in this
# chapter. Our scripts assume that files to be read are in
# the working directory.
source("drawmap.R")
source("drawmap3.R")
source("hcoplot.R")
source("test.a.R")
source("coldiss.R")
source("bartlett.perm.R")
source("boxplerk.R")
source("boxplert.R")
# Function to compute a binary dissimilarity matrix from clusters
grpdist <- function(X) {
require(cluster)
gr <- as.data.frame(as.factor(X))
distgr <- daisy(gr, "gower")
distgr
}
# Load the data
# File Doubs.Rdata is assumed to be in the working directory
load("Doubs.Rdata")
# Remove empty site 8
spe <- spe[-8, ]
env <- env[-8, ]
spa <- spa[-8, ]
latlong <- latlong[-8, ]
4.3 Hierarchical Clustering Based on Links
4.3.1 Single Linkage Agglomerative Clustering
Also called nearest neighbour sorting, this method agglomerates objects on the basis
of their shortest pairwise dissimilarities (or greatest similarities): the fusion of an
object (or a group) with a group at a given similarity (or dissimilarity) level only
requires that one object of each of the two groups about to agglomerate be linked to
one another at that level. Two groups agglomerate at the dissimilarity separating the
closest pair of their members. This makes agglomeration easy. Consequently, the
dendrogram resulting of a single linkage clustering often shows chaining of objects:
a pair is linked to a third object, which in turn is linked with another one, and so
on. The result may therefore be difficult to interpret in terms of partitions, but
gradients are revealed quite clearly. The list of the first connections making an
object member of a cluster, or allowing two clusters to fuse, is called the chain of
primary connections; this chain forms the minimum spanning tree (MST). This
entity is presented here and will be used in later analyses (Chap. 7).
62
4 Cluster Analysis
# chapter. Our scripts assume that files to be read are in
# the working directory.
source("drawmap.R")
source("drawmap3.R")
source("hcoplot.R")
source("test.a.R")
source("coldiss.R")
source("bartlett.perm.R")
source("boxplerk.R")
source("boxplert.R")
# Function to compute a binary dissimilarity matrix from clusters
grpdist <- function(X) {
require(cluster)
gr <- as.data.frame(as.factor(X))
distgr <- daisy(gr, "gower")
distgr
}
# Load the data
# File Doubs.Rdata is assumed to be in the working directory
load("Doubs.Rdata")
# Remove empty site 8
spe <- spe[-8, ]
env <- env[-8, ]
spa <- spa[-8, ]
latlong <- latlong[-8, ]
4.3 Hierarchical Clustering Based on Links
4.3.1 Single Linkage Agglomerative Clustering
Also called nearest neighbour sorting, this method agglomerates objects on the basis
of their shortest pairwise dissimilarities (or greatest similarities): the fusion of an
object (or a group) with a group at a given similarity (or dissimilarity) level only
requires that one object of each of the two groups about to agglomerate be linked to
one another at that level. Two groups agglomerate at the dissimilarity separating the
closest pair of their members. This makes agglomeration easy. Consequently, the
dendrogram resulting of a single linkage clustering often shows chaining of objects:
a pair is linked to a third object, which in turn is linked with another one, and so
on. The result may therefore be difficult to interpret in terms of partitions, but
gradients are revealed quite clearly. The list of the first connections making an
object member of a cluster, or allowing two clusters to fuse, is called the chain of
primary connections; this chain forms the minimum spanning tree (MST). This
entity is presented here and will be used in later analyses (Chap. 7).
62
4 Cluster Analysis
