Description Usage Arguments Details Value References See Also Examples
View source: R/SpatialClustering.R
SpatialClustering
allows the detection of clusters of points in a bi-dimensional space. A covariate can be accounted for in the clustering.
1 |
data |
A nx2 |
window |
A object of class |
metric |
A character vector containing the name of the distance used to compute the nearest-neighbours. This must be one of "euclidean", "maximum", "manhattan", "canberra", "binary" or "minkowski" as proposed in the |
Homogeneous |
A logical flag indicating whether a covariate is used to estimate clusters |
Z |
A object of |
B |
An |
method.cut |
A character vector 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 |
SpatialClustering
is an implementation of the statistical procedure proposed in Bar-Hen et al. (2015). The SpatialClustering method proposes a classification of a set of bi-dimensional points given in the data
object and located in the window
object. Clusters are estimated by cutting a dendrogamm computed based on a dissimilarity proposed in Bar-Hen et al. (2015). The dissimilarity aims at comparing the points inter-distances to a Poisson process, that be either homogenenous (Homogeneous=TRUE
) or inhomogeneous (Homogeneous=FALSE
) when a covariate is accounted for. To cut the dendrogramm, two main methods are implemented: the gap statistics (method="gap"
- Tibshirani, 2001) or the longest branh of the dendrogamm (method="tree"
). The dendrogramm can also be cut by provided the height of cut (method="none"
and !is.null(h)
) of the number of desired clusters (method="none"
and !is.null(k)
).
An object of class SpatClust
, i.e. a list containing the following components:
data |
A nx2 |
window |
A object of class |
TandP |
A list with three elements. The first element is the list of trajectories, the second element is the list of pairwise probability matrix and the third element is the vector of starting points used to initialize each trajectory. More details can be found in Bar-Hen et al. (2015) |
MatDist |
A matrix of size nxn, containing the pairwiser dissimilarity measure as detailed in Bar-Hen et al. (2015) |
hh |
An object of class |
group |
A vector of size n containing the estimated group memberships |
ngroup |
The estimated number of groups |
Homogeneous |
A logical flag indicating whether a covariate is used to estimate clusters |
Z |
A object of |
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
, getClusters
, getMatDist
, plot.SpatClust
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 | ## Example of a study of tree location
data(dataExample)
## Extraction of the data and the window
dDicor <- dataExample$data
w0 <- dataExample$w0
#######
## Identification of the clusters estimated with SpatialClustering in the Homogeneous case
#######
set.seed(123)
res <- SpatialClustering(data=dDicor,window=w0)
## The group memberships
res$group
## Various plotting possibilities
plot(res)
plot(res,plot.dendro=FALSE)
plot(res,method="Seg",plot.dendro=FALSE)
plot(res,method="Seg",plot.dendro=TRUE)
#######
## Identification of the clusters estimated with SpatialClustering in the Inhomogeneous case
#######
## Extraction of the covariate
Z.Pente <- dataExample$Z.Pente
## Estimation of the cluster
set.seed(345)
res.I <- SpatialClustering(data=dDicor,window=w0,Homogeneous=FALSE,Z=Z.Pente)
plot(res.I)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.