View source: R/circular_scan.R
| circular_scan | R Documentation |
Performs Kulldorff's circular spatial scan statistic for detecting spatial clusters. Inputs are passed as parallel vectors with one entry per region (cases must already be aggregated to the region level).
circular_scan(
cases,
population,
region_id,
x,
y,
max_pop_pct = 0.5,
nsim = 999L,
alpha = 0.05,
n_secondary = 1000L,
model = c("poisson", "binomial"),
seed = NULL,
n_cores = 1L
)
cases |
Numeric vector of length |
population |
Numeric vector of length |
region_id |
Vector of region identifiers, length |
x, y |
Numeric vectors of region centroid coordinates, length |
max_pop_pct |
Numeric. Default |
nsim |
Integer. Number of MC simulations. Default |
alpha |
Numeric. Significance level. Default |
n_secondary |
Integer. Default |
model |
Character. |
seed |
Integer or |
n_cores |
Integer. OpenMP threads. |
An object of class "circular_scan".
Kulldorff, M. (1997). A spatial scan statistic. Communications in Statistics - Theory and Methods, 26(6), 1481-1496.
filter_clusters, tree_scan,
treespatial_scan, get_cluster_regions,
iterative_scan
set.seed(42)
n <- 20
cases <- rpois(n, lambda = 10)
cases[1:5] <- rpois(5, lambda = 30)
result <- circular_scan(
cases = cases,
population = rep(1000, n),
region_id = 1:n,
x = runif(n, 0, 10),
y = runif(n, 0, 10),
nsim = 99
)
print(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.