getHotspots: find spatial clusters using supervised learning methods

Description Usage Arguments Value Author(s) Examples

Description

Here we consider one fixed rotation of the data and

seek hot spots using a classification tree

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
getHotspots(formula = violent ~ X + Y, rotX, NullClass = "0", 


    minsize = 200, minArea = 20, maxArea = 250, ORfilter = list(OR = TRUE, 


        OR1 = 1.8, OR2 = 0.1), TreeAlgorithm = c("rpart", "ctree")[1], 


    verbose = 1, ...)

Arguments

formula

A formula expression. The left-hand-side (response) should be either a numerical vector when a regression tree will be fitted or a factor, when a classification tree is produced. The right-hand-side should be a series of numeric or factor variables separated by +; there should be no interaction terms. Both . and - are allowed: regression trees can have offset terms.

rotX

data, possibly already rotated

NullClass

if y is a factor, this is the category used for the background

minsize

minimum number of points inside a cluster

minArea

minimum area of a cluster, units: lat*lon

maxArea

maximum area of a cluster, units: lat*lon

ORfilter

filter on minimum and maximum odds ratios (OR)

TreeAlgorithm

which tree algorithm to choose

verbose

level of verbosity

...

further arguments to tree

Value

identified clusters (if any)

Author(s)

Markus Loecher

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
#examples to come


data("drugCrimes", envir = environment())


drugCrimes$MATCH = factor(drugCrimes$MATCH)


spot1 = getHotspots(MATCH ~ X+Y,drugCrimes, minArea=20/10^6,maxArea=250/10^6, 


                    ORfilter=list(OR=FALSE,OR1=0.8,OR2=0.1))


suppressWarnings(suppressMessages(library("PBSmapping")))


PBSmapping::plotPolys(spot1[1:5,],density=NULL,xlim=range(drugCrimes$X),ylim=range(drugCrimes$Y),


          border="blue",lwd=2)


ranRows=sample(1:nrow(drugCrimes), 5000)


points(Y~X,data=drugCrimes[ranRows,],col=RgoogleMaps::AddAlpha(4-as.numeric(MATCH)),pch=20,cex=0.6)

TreeHotspots documentation built on May 2, 2019, 5:17 p.m.