flex.zones | R Documentation |
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.
flex.zones( coords, w, k = 10, longlat = FALSE, cl = NULL, loop = FALSE, verbose = FALSE, pfreq = 1 )
coords |
An n \times 2 matrix of centroid coordinates for the regions in the form (x, y) or (longitude, latitude) is using great circle distance. |
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 |
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.
Joshua French
Tango, T., & Takahashi, K. (2005). A flexibly shaped spatial scan statistic for detecting clusters. International journal of health geographics, 4(1), 11.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.