A simulated dataset of 50 counties with population and event counts. Some counties are designated as "hot spots" (higher than expected rates) and "cold spots" (lower than expected rates) for testing and examples.
Format
A data frame with 50 rows and 7 variables:
- county_id
Unique county identifier
- name
County name
- population
Population count
- events
Number of events (e.g., crimes, incidents)
- expected
Expected number of events based on population
- is_hotspot
Logical; TRUE if county has elevated rates
- is_coldspot
Logical; TRUE if county has suppressed rates
Examples
data(example_counties)
# Compute surprise
result <- auto_surprise(
observed = example_counties$events,
expected = example_counties$population
)
example_counties$surprise <- result$surprise
# Hot spots and cold spots should have higher surprise
with(example_counties, tapply(surprise, is_hotspot, mean))
#> FALSE TRUE
#> 0.5429603 0.6093564
with(example_counties, tapply(surprise, is_coldspot, mean))
#> FALSE TRUE
#> 0.5457317 0.5890325