Description Usage Arguments Details Value References See Also Examples
Run hierarchical clustering on a set of crimes using the log Bayes Factor as the similarity metric.
1 2 | crimeClust_hier(crimedata, varlist, estimateBF, linkage = c("average",
"single", "complete"), ...)
|
crimedata |
data.frame of crime incidents. Must contain a column named
|
varlist |
a list of the variable names (columns of |
estimateBF |
function to estimate the log bayes factor from evidence variables |
linkage |
the type of linkage for hierarchical clustering
|
... |
other arguments passed to |
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.
An object of class hclust
(from hclust
).
Porter, M. D. (2014). A Statistical Approach to Crime Linkage. arXiv preprint arXiv:1410.2285.. http://arxiv.org/abs/1410.2285
1 2 3 4 5 6 7 8 9 10 | 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.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.