| tree_scan | R Documentation |
Performs the tree-based scan statistic for detecting clusters in hierarchical data. Uses a Poisson or binomial model with Monte Carlo simulation (implemented in C++ via Rcpp) for significance testing.
tree_scan(
tree = NULL,
cases,
population = NULL,
nsim = 999L,
alpha = 0.05,
model = c("poisson", "binomial"),
seed = NULL,
n_cores = 1L,
tree_node_id = NULL,
tree_parent_id = NULL
)
tree |
A |
cases |
A numeric vector of case counts at the leaf level. |
population |
A numeric vector of population at the leaf level, or a
single value. For the binomial model, |
nsim |
Integer. Number of Monte Carlo simulations. Default is
|
alpha |
Numeric. Significance level. Default is |
model |
Character. Likelihood model: either |
seed |
Integer or |
n_cores |
Integer. Number of OpenMP threads for the Monte Carlo
loop. Default is |
tree_node_id, tree_parent_id |
Optional parallel vectors describing
the tree as an alternative to the |
An object of class "tree_scan" (see package help for
details).
Kulldorff, M., Fang, Z., & Walsh, S. J. (2003). A tree-based scan statistic for database disease surveillance. Biometrics, 59(2), 323–331.
circular_scan, treespatial_scan,
aggregate_tree
tree <- data.frame(
node_id = c(1, 2, 3, 4, 5, 6, 7, 8),
parent_id = c(NA, 1, 1, 2, 2, 3, 3, 3)
)
cases <- c(50, 5, 3, 2, 4)
pop <- c(100, 100, 100, 100, 100)
result <- tree_scan(tree, cases, population = pop, nsim = 99)
print(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.