Samplers
SimpleRandom
BiodiversityObservationNetworks.SimpleRandom Type
SimpleRandom <: BONSamplerSimple random sampling (or weighted random sampling when inclusion weights are non-uniform). Selects n candidates without replacement.
BalancedAcceptance
BiodiversityObservationNetworks.BalancedAcceptance Type
BalancedAcceptance <: BONSamplerBalanced Acceptance Sampling (BAS) using Halton sequences, proposed by (Robertson et al., 2025).
Generates spatially balanced samples by mapping Halton sequences to the candidate coordinate space. When inclusion weights are non-uniform, a third Halton dimension acts as a threshold for acceptance, preferentially selecting higher-weighted candidates.
Fields
n::Int: number of sites to select (default 50)
GRTS
BiodiversityObservationNetworks.GRTS Type
GRTS <: BONSamplerGeneralized Random Tessellation Stratified (GRTS) sampling.
GRTS produces spatially balanced samples by recursively partitioning the domain into quadrants, assigning each cell a hierarchical address. The recursive tessellation ensures spatial spread without requiring distance computations.
Originally proposed by (Stevens and Olsen, 2004).
Fields
n::Int: number of sites to select (default 50)
CubeSampling
BiodiversityObservationNetworks.CubeSampling Type
CubeSampling <: BONSamplerBalanced sampling with respect to auxiliary variables, using the Cube method from (Deville and Tillé, 2022).
Selects a sample whose Horvitz–Thompson estimates of auxiliary variables match the population as closely as possible. The algorithm runs in two phases:
Flight phase: a random walk on inclusion probabilities that preserves balance constraints while driving inclusion probabilities toward 0 or 1.
Landing phase: uses integer programming (via the JuMP + HiGHS packages) to resolve any remaining fractional probabilities once the flight phase terminates.
Requires a CandidatePool with features; pass a vector of matrices or construct a pool with explicit features.
Fields
n::Int: number of sites to select (default 50)
AdaptiveHotspot
BiodiversityObservationNetworks.AdaptiveHotspot Type
AdaptiveHotspot <: BONSamplerSampling for hotspots. Takes an auxiliary variable (e.g. uncertainty) to target samples toward. Proposed by (Andrade-Pacheco et al., 2022).
Starts at the global maximum of the target/uncertainty surface. Subsequent points are chosen to maximize a trade-off between the target value and spatial diversity (measured via the determinant of a kernel matrix).
Requires a CandidatePool with features. The first feature row is used as the target/uncertainty surface; subsequent rows are ignored.
Fields
n::Int: number of sites to select (default 50)scale: Matérn kernel range parameter ρ (default 1.0)smoothness: Matérn kernel smoothness ν (default 0.5, equivalent to an exponential kernel)
Stratified
BiodiversityObservationNetworks.Stratified Type
Stratified <: BONSamplerStratified sampling. The first feature row of the CandidatePool is treated as a discrete stratum label. Draws are allocated across strata via a Multinomial draw on the stratum weights; within each stratum, sites are drawn without replacement.
Recommended usage is to pass a single matrix/SDMLayer of discrete integer stratum labels.
Fields
n::Int: number of sites to selectweights::Union{Vector, Missing}: per-stratum weights. Index corresponds to label.missing(default) uses weights proportional to area.
Notes
Does not guarantee exactly n selected sites when a Multinomial draw allocates more draws to a stratum than it has candidates. In that case the stratum is exhausted and the total falls short.
Usage
weights = [0.1, 0.2, 0.5, 0.1, 0.1]
domain = rand(1:5, (30, 30))
sample(Stratified(weights = weights), domain)Pivotal
BiodiversityObservationNetworks.Pivotal Type
Pivotal <: BONSamplerLocal Pivotal Method (LPM) for spatially balanced sampling.
Iteratively pairs nearby candidates and updates their inclusion probabilities so that one tends toward selection and the other toward exclusion. Repeating over the domain produces a spatially balanced sample that respects per-unit inclusion probabilities.
Proposed in (Grafström et al., 2022).
Fields
n::Int: number of sites to select (default 50)
SpatiallyCorrelatedPoisson
BiodiversityObservationNetworks.SpatiallyCorrelatedPoisson Type
SpatiallyCorrelatedPoisson <: BONSamplerImplements Spatially Correlated Poisson Sampling (SCPS) from (Grafström, 2025).
Fields
n::Int: expected number of sites to select (default 50)
Description
Iterates through units, selecting them based on inclusion probabilities, and dynamically adjusting the probabilities of neighboring units to maintain spatial balance.
source