HCV | R Documentation |
This function implements the hierarchical clustering for spatial data. It modified typically used hierarchical agglomerative clustering algorithms for introducing the spatial homogeneity, by considering geographical locations as vertices and converting spatial adjacency into whether a shared edge exists between a pair of vertices.
HCV( geometry_domain, feature_domain, linkage = "ward", diss = "none", adjacency = FALSE, dist_method = "euclidean" )
geometry_domain |
one of the three formats: (i) n by d matrix (NA not allowed), (ii) a |
feature_domain |
either (i) n by p matrix (NA allowed) for n samples with p attributes, or (ii) n by n matrix (NA not allowed) with dissimilarity between n samples (with |
linkage |
the agglomeration method to be used, one of "ward", "single", "complete", "average" (= UPGMA), "weight" (= WPGMA), "median" (= WPGMC) or "centroid" (= UPGMC). Default is |
diss |
character indicating if |
adjacency |
logical indicating if |
dist_method |
the distance measure to be used when |
geometry_domain
can be a user-specifid adjacency matrix, an n by d matrix with geographical coordinates for point-level data, or a SpatialPolygonsDataFrame
object defining polygons for areal data. If an adjacency matrix is given, the user should use adjacency=TRUE
.
An object of class hclust
which describes the tree produced by the clustering process. See the documentation in hclust
.
ShengLi Tzeng and Hao-Yun Hsu.
Carvalho, A. X. Y., Albuquerque, P. H. M., de Almeida Junior, G. R., and Guimaraes, R. D. (2009). Spatial hierarchical clustering. Revista Brasileira de Biometria, 27(3), 411-442.
hclust
set.seed(0) pcase <- synthetic_data(3,30,0.02,100,2,2) HCVobj <- HCV(pcase$geo, pcase$feat) smi <- getCluster(HCVobj,method="SMI") oldpar <- par(no.readonly = TRUE) par(mfrow=c(2,2)) labcolor <- (pcase$labels+1)%%3+1 plot(pcase$feat, col = labcolor, pch=19, xlab = 'First attribute', ylab = 'Second attribute', main = 'Feature domain') plot(pcase$geo, col = labcolor, pch=19, xlab = 'First attribute', ylab = 'Second attribute', main = 'Geometry domain') plot(pcase$feat, col=factor(smi),pch=19, xlab = 'First attribute', ylab = 'Second attribute',main = 'Feature domain') plot(pcase$geo, col=factor(smi),pch=19, xlab = 'First attribute', ylab = 'Second attribute',main = 'Geometry domain') par(oldpar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.