Skip to contents

Runs occurrence_counts_sql() on con, judges every (species, zone) with region_effort_test() (alpha, ratio), then applies the overrides Tim White asked for (2026-10-21), each recorded in override so the report can say why a zone was kept:

  • "protected" – the species holds designated cells (critical habitat, core areas: the ch relation) inside the zone: never dropped;

  • "narrow range" – the species' modelled range has fewer than min_cells cells: a narrow-range species is never dropped by a record test (the test needs a stronghold to compare with);

  • "unsearched" – nobody looked (the test's own verdict): kept and flagged, since empty of observers is not empty of the species.

A zone is "dropped" only when it was searched, holds significantly and materially fewer records than the species' rate elsewhere, and no override applies; label says "documented occurrence only" where a dropped zone still has a record (the vagrant is on the record, the zone is not range). Zones with no present cell of the species get no row.

Usage

occurrence_rule(
  con,
  present = "occ_present",
  occ = "occ_records",
  effort = "occ_effort",
  region = "occ_region",
  region_rec = region,
  ch = NULL,
  nc = 7200L,
  block = 10L,
  alpha = 0.05,
  ratio = 0.25,
  min_cells = 20L,
  baseline = c("zones", "range")
)

Arguments

con

a DBI connection holding the relations.

present, occ, effort, region, region_rec

relation names.

ch

character or NULL; a relation (mdl_key, cell_id) of protected cells per model.

nc

integer; the grid's number of columns (7200 for global05).

block

integer; cells per block side (10 = 0.5 degrees).

alpha, ratio

passed to region_effort_test().

min_cells

integer; species with fewer present cells (worldwide) are never dropped.

baseline

what a zone is judged against: "zones" (default) – the species' record rate over the OTHER zones of the set (the study area's other ecoregions), the comparison Tim White's anchors need: the North Atlantic right whale's whole modelled range spans the North Atlantic, most of it unsurveyed in OBIS, so against the whole range (7,099 blocks, 352 with a record) its Gulf of America pairs are not significantly fewer (p 0.4), while against its other US ecoregions (41 % of blocks on the Northeast shelf) they are (p 1e-7); "range" – the whole modelled range, the original rule E, kept as the sensitivity.

Value

a data frame, one row per (model, zone): the counts, p_core, rate, n_min, p_value, verdict (kept | dropped | unsearched), label, override (NA | protected | narrow range), and verdict_raw (the test's verdict before overrides).