getClusters: Estimation of clusters of points

Description Usage Arguments Details Value References See Also Examples

View source: R/getClusters.R

Description

getClusters allows the estimation of the cluster of points obtained from dissimilarity matrix between the 2-dimensional points of the studied dataset.

Usage

1
	getClusters(MatDist,data=NULL,B=500,method=c("gap","tree","none"),h=NULL,k=NULL)

Arguments

MatDist

A nxn dissimilarity matrix. Typically output of getMatDist function.

data

A nx2 data.frame. Names of the column should be x and y. Argument data is used only when method="gap" is used.

B

An integer that indicates the number of Monte Carlo (<e2><80><9c>bootstrap<e2><80><9d>) samples when using the gap method for estimating the number of clusters. Argument B is used only when method="gap" is used.

method.cut

An string containing the name of the method used to estimate the number of clusters.

h

The height used for cutting the dendrogram. Optional

k

The number of clusters. Optional

Details

getClusters proposes an implementation of the detection of clusters of points based on a dissimilarity matrix. In a first step, getClusters uses the dissimilarity to perform a hierarchical clustering with the single-linkage criterion. The hierarchical clustering tree is next cut to estimate the number of clusters and the cluster memberships. Cutting the tree can be performed either by using the gap statistics (method.cut="gap" - Tibshirani et al., 2001) or by detecting the longest branch in the tree (method.cut="tree") or by choosing an a priori height h (method.cut="none" and h=h) or by defining an a priori number of clusters k (method.cut="none" and k=k). More details can be found in Bar-Hen et al. (2015).

Value

A list with three objects:

hh

An object of class hclust containing the hierarchical clustering tree

group

A vector of size n containing the estimated group memberships

ngroup

The estimated number of groups

References

A. Bar-Hen, M. Emily and N. Picard. (2015) Spatial Cluster Detection Using Nearest Neighbour Distance, Spatial Statistics, Vol. 14, pages 400-411.
R. Tibshirani, G. Walther and T. Hastie (2001) Estimating the number of data clusters via the gap statistic. J. Roy. Stat. Soc. B 63, 411<e2><80><93>423.

See Also

generateListTandP, SpatialClustering, getMatDist

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Example of a study of tree location 
data(dataExample)


## Extraction of the data and the window
dDicor <- dataExample$data
w0 <- dataExample$w0

## the Homogeneous case

List.Dicor.H <- generateListTandP(dDicor,w0,Homogeneous=TRUE)
MatDist.Dicor.H <- getMatDist(List.Dicor.H$Probabilities,List.Dicor.H$Trajectories) 
set.seed(123)
res.Cluster <- getClusters(MatDist=MatDist.Dicor.H,data=dDicor)

res2 <- list(data=dDicor,window=w0,TandP=List.Dicor.H,MatDist=MatDist.Dicor.H,hh=res.Cluster$hh,group=res.Cluster$group,ngroup=res.Cluster$ngroup,Homogeneous=TRUE,Z=NULL)
class(res2) <- "SpatClust"

## Equivalent to 
res <- SpatialClustering(data=dDicor,window=w0)

## the Inhomogeneous case

## Extraction of the covariate
Z.Pente <- dataExample$Z.Pente

List.Dicor.I <- generateListTandP(dDicor,w0=w0,Homogeneous=FALSE,Z=Z.Pente)
MatDist.Dicor.I <- getMatDist(List.Dicor.I$Probabilities,List.Dicor.I$Trajectories)
set.seed(345)
res.Cluster.I <- getClusters(MatDist=MatDist.Dicor.I,data=dDicor)
res2.I <- list(data=dDicor,window=w0,TandP=List.Dicor.I,MatDist=MatDist.Dicor.I,hh=res.Cluster.I$hh,group=res.Cluster.I$group,ngroup=res.Cluster.I$ngroup,Homogeneous=FALSE,Z=Z.Pente)
class(res2.I) <- "SpatClust"

## Equivalent to
set.seed(345)
res.I <- SpatialClustering(data=dDicor,window=w0,Homogeneous=FALSE,Z=Z.Pente)

MathieuEmily/SpatialClustering documentation built on May 7, 2019, 4:33 p.m.