Description Usage Arguments Details Value References See Also Examples
getClusters
allows the estimation of the cluster of points obtained from dissimilarity matrix between the 2-dimensional points of the studied dataset.
1 |
MatDist |
A nxn dissimilarity matrix. Typically output of |
data |
A nx2 |
B |
An |
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 |
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).
A list with three objects:
hh |
An object of class |
group |
A vector of size n containing the estimated group memberships |
ngroup |
The estimated number of groups |
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.
generateListTandP
, SpatialClustering
, getMatDist
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.