SpatialClustering: Detection of clusters of point in a 2-dimensional space.

Description Usage Arguments Details Value References See Also Examples

View source: R/SpatialClustering.R

Description

SpatialClustering allows the detection of clusters of points in a bi-dimensional space. A covariate can be accounted for in the clustering.

Usage

1
	SpatialClustering(data,window,metric="euclidean",Homogeneous=TRUE,Z=NULL,B=500,method.cut=c("gap","tree","none"),h=NULL,k=NULL)

Arguments

data

A nx2 data.frame. Names of the column should be x and y

window

A object of class owin that gives the window of study

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 dist function.

Homogeneous

A logical flag indicating whether a covariate is used to estimate clusters

Z

A object of im containing the value of the covariate

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

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

Details

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)).

Value

An object of class SpatClust, i.e. a list containing the following components:

data

A nx2 data.frame

window

A object of class owin that gives the window of study

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 hclust containing the hierarchical clustering tree

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 im containing the value of the covariate. NULL if not provided.

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, getClusters, getMatDist, plot.SpatClust

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
## 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)

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