flex.zones {smerc} | R Documentation |
Determine zones for flexibly shaped spatial scan test
Description
flex.zones
determines the unique zones to consider
for the flexibly shaped spatial scan test of Tango and
Takahashi (2005). The algorithm uses a breadth-first
search to find all subgraphs connected to each vertex
(region) in the data set of size k
or less.
Usage
flex.zones(
coords,
w,
k = 10,
longlat = FALSE,
cl = NULL,
loop = FALSE,
verbose = FALSE,
pfreq = 1
)
Arguments
coords |
An |
w |
A binary spatial adjacency matrix for the regions. |
k |
An integer indicating the maximum number of regions to inclue in a potential cluster. Default is 10 |
longlat |
The default is |
cl |
A cluster object created by |
loop |
A logical value indicating whether a loop
should be used to implement the function instead of
|
verbose |
A logical value indicating whether
progress messages should be provided.
The default is |
pfreq |
The frequency that messages are reported
from the loop (if |
Value
Returns a list of zones to consider for clustering. Each element of the list contains a vector with the location ids of the regions in that zone.
Author(s)
Joshua French
References
Tango, T., & Takahashi, K. (2005). A flexibly shaped spatial scan statistic for detecting clusters. International journal of health geographics, 4(1), 11.
Examples
data(nydf)
data(nyw)
coords <- cbind(nydf$x, nydf$y)
zones <- flex.zones(coords, w = nyw, k = 3)
## Not run:
# see what happens when verbose = TRUE
zones <- flex.zones(coords, w = nyw, k = 3, verbose = TRUE)
## End(Not run)