View source: R/generate_example_data.R
| generate_example_data | R Documentation |
Creates a synthetic dataset for demonstrating and testing the tree-spatial
scan statistic. Returns parallel vectors (cases, population,
region_id, x, y, node_id) and a tree,
matching the input format expected by treespatial_scan.
generate_example_data(
n_regions = 50L,
pop_per_region = 1000,
cluster_regions = 1:7,
cluster_leaves = c(3, 4),
rr = 2,
Cg = 200L,
seed = NULL
)
n_regions |
Integer. Default 50. |
pop_per_region |
Numeric. Default 1000. |
cluster_regions |
Integer vector. Default |
cluster_leaves |
Integer vector. Default |
rr |
Numeric. Relative risk. Default 2.0. |
Cg |
Integer. Cases per branch. Default 200. |
seed |
Integer or |
A list with vector components ready to feed into
treespatial_scan: cases, population,
region_id, x, y, node_id, plus the
tree (data.frame) and a true_cluster list describing the
injected cluster.
ex <- generate_example_data(seed = 42)
result <- treespatial_scan(
cases = ex$cases,
population = ex$population,
region_id = ex$region_id,
x = ex$x,
y = ex$y,
node_id = ex$node_id,
tree = ex$tree,
nsim = 99
)
print(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.