% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/generate_example_data.R
\name{generate_example_data}
\alias{generate_example_data}
\title{Generate Example Data for Tree-Spatial Scan}
\usage{
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
)
}
\arguments{
\item{n_regions}{Integer. Default 50.}

\item{pop_per_region}{Numeric. Default 1000.}

\item{cluster_regions}{Integer vector. Default \code{1:7}.}

\item{cluster_leaves}{Integer vector. Default \code{c(3, 4)}.}

\item{rr}{Numeric. Relative risk. Default 2.0.}

\item{Cg}{Integer. Cases per branch. Default 200.}

\item{seed}{Integer or \code{NULL}. Random seed. When non-\code{NULL},
the user's pre-existing RNG state is saved on entry and restored on
exit, so the \code{seed} argument affects only the result of the
call. Default \code{NULL} (the user's session-level RNG state is
used as-is and is not modified by the function).}
}
\value{
A list with vector components ready to feed into
  \code{\link{treespatial_scan}}: \code{cases}, \code{population},
  \code{region_id}, \code{x}, \code{y}, \code{node_id}, plus the
  \code{tree} (data.frame) and a \code{true_cluster} list describing the
  injected cluster.
}
\description{
Creates a synthetic dataset for demonstrating and testing the tree-spatial
scan statistic. Returns parallel vectors (\code{cases}, \code{population},
\code{region_id}, \code{x}, \code{y}, \code{node_id}) and a \code{tree},
matching the input format expected by \code{\link{treespatial_scan}}.
}
\examples{
ex <- generate_example_data(seed = 42)
dat <- data.frame(
  cases = ex$cases, population = ex$population, region_id = ex$region_id,
  x = ex$x, y = ex$y, node_id = ex$node_id
)
result <- treespatial_scan(
  dat,
  cases       = cases,
  population  = population,
  region_id   = region_id,
  x           = x,
  y           = y,
  node_id     = node_id,
  tree        = ex$tree,
  nsim        = 99
)
print(result)
}
