crimeClust_hier {crimelinkage}R Documentation

Agglomerative Hierarchical Crime Series Clustering

Description

Run hierarchical clustering on a set of crimes using the log Bayes Factor as the similarity metric.

Usage

crimeClust_hier(crimedata, varlist, estimateBF, linkage = c("average",
  "single", "complete"), ...)

Arguments

crimedata

data.frame of crime incidents. Must contain a column named crimeID.

varlist

a list of the variable names (columns of crimedata) used to create evidence variables with compareCrimes.

estimateBF

function to estimate the log bayes factor from evidence variables

linkage

the type of linkage for hierarchical clustering

  • “average” uses the average bayes factor

  • “single” uses the largest bayes factor (most similar)

  • “complete” uses the smallest bayes factor (least similar)

...

other arguments passed to compareCrimes

Details

This function first compares all crime pairs using compareCrimes, then uses estimateBF to estimate the log Bayes factor for every pair. Next, it passes this information into hclust to carry out the agglomerative hierarchical clustering. Because hclust requires a dissimilarity, this uses the negative log Bayes factor.

The input varlist is a list with elements named: crimeID, spatial, temporal, categorical, and numerical. Each element should be a vector of the column names of crimedata corresponding to that feature. See compareCrimes for more details.

Value

An object of class hclust (from hclust).

References

Porter, M. D. (2014). A Statistical Approach to Crime Linkage. arXiv preprint arXiv:1410.2285.. http://arxiv.org/abs/1410.2285

See Also

clusterPath, plot_hcc

Examples

data(crimes)
 #- cluster the first 10 crime incidents
 crimedata = crimes[1:10,]
 varlist = list(spatial = c("X", "Y"), temporal = c("DT.FROM","DT.TO"),
     categorical = c("MO1",  "MO2", "MO3"))
 estimateBF <- function(X) rnorm(NROW(X))   # random estimation of log Bayes Factor
 HC = crimeClust_hier(crimedata,varlist,estimateBF)
 plot_hcc(HC,yticks=-2:2)

 # See vignette: "Crime Series Identification and Clustering" for more examples.

[Package crimelinkage version 0.0.4 Index]