HCV: Hierarchical Clustering from Vertex-links

View source: R/HCV.R

HCVR Documentation

Hierarchical Clustering from Vertex-links

Description

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.

Usage

HCV(
  geometry_domain,
  feature_domain,
  linkage = "ward",
  diss = "none",
  adjacency = FALSE,
  dist_method = "euclidean"
)

Arguments

geometry_domain

one of the three formats: (i) n by d matrix (NA not allowed), (ii) a SpatialPolygonsDataFrame object defining polygons, (iii) a matrix with 0-1 value adjacency (with adjacency=TRUE)

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 diss = 'precomputed')

linkage

the agglomeration method to be used, one of "ward", "single", "complete", "average" (= UPGMA), "weight" (= WPGMA), "median" (= WPGMC) or "centroid" (= UPGMC). Default is 'ward'.

diss

character indicating if feature_domain is a dissimilarity matrix: 'none' for not dissimilarity, and 'precomputed' for dissimilarity. Default is 'none'.

adjacency

logical indicating if geometry_domain is a adjacency matrix. Default is FALSE.

dist_method

the distance measure to be used when feature_domain is not a dissimilarity matrix (diss ='none'), one of "euclidean", "correlation", "abscor", "maximum", "manhattan", "canberra", "binary" or "minkowski". Default is 'euclidean'.

Details

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.

Value

An object of class hclust which describes the tree produced by the clustering process. See the documentation in hclust.

Author(s)

ShengLi Tzeng and Hao-Yun Hsu.

References

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.

See Also

hclust

Examples

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)


HCV documentation built on March 18, 2022, 6:01 p.m.

Related to HCV in HCV...