| build_zones | R Documentation |
Constructs the set of candidate spatial zones for the circular scan statistic. Each zone is defined by a circular window centered on a region's centroid, containing all regions whose centroids fall within the circle.
build_zones(regions, max_pop = NULL)
regions |
A |
max_pop |
A numeric value specifying the maximum population allowed
inside a zone. If |
For each region j, regions are sorted by distance from j. Regions
are added incrementally to the zone as long as the total population does
not exceed max_pop. This generates a nested set of circular windows
centered on each region.
A list of zones. Each zone is a list with elements:
Integer index of the center region.
Integer vector of region indices inside the zone.
Total population inside the zone.
Kulldorff, M. (1997). A spatial scan statistic. Communications in Statistics - Theory and Methods, 26(6), 1481–1496.
regions <- data.frame(
region_id = 1:5,
population = c(1000, 2000, 1500, 800, 1200),
x = c(0, 1, 2, 0.5, 1.5),
y = c(0, 0, 0, 1, 1)
)
zones <- build_zones(regions, max_pop = 3000)
length(zones) # number of candidate zones
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.