Calls the sightability API to determine optimal allocation of survey samples using Neyman allocation.
Usage
sight_optimize_design(
method,
value,
species,
survey_type,
analysis_unit,
bio_year,
samp_var = NULL,
sight_var = NULL,
mod_var = NULL,
confidence = 0.9,
design_overrides = NULL,
filter_species = TRUE,
filter_survey_type = TRUE,
...
)
sight_optimize_design_id(
method,
value,
species_id,
survey_type_id,
analysis_unit_id,
bio_year,
samp_var = NULL,
sight_var = NULL,
mod_var = NULL,
confidence = 0.9,
design_overrides = NULL,
dry_run = FALSE,
...
)Arguments
- method
Character. Optimization method:
"precision"(target error bound) or"fixed"(target sample size).- value
Numeric. For "precision": desired error bound. For "fixed": target sample size.
- species
Character. Species name, required for looking up survey_type or analysis_unit by name.
- survey_type
Character. Survey type name.
- analysis_unit
Character. Analysis unit name.
- bio_year
Integer. Biological year for the survey design.
- samp_var
Numeric. Optional sampling variance from a previous model fit.
- sight_var
Numeric. Optional sightability variance from a previous model fit.
- mod_var
Numeric. Optional model variance from a previous model fit.
- confidence
Numeric. Confidence level for the error bound (default 0.90 for 90% CI). Must be between 0 and 1.
- design_overrides
A list of per-stratum overrides. Each element is a list with
stratum_id(required) and optionalsubunits_available,pop_sd, and/orcostvalues.NULL(default) means no overrides.- filter_species
logical, if FALSE species is only used for lookup context and not passed as a filter (default TRUE)
- filter_survey_type
logical, if FALSE survey_type is only used for lookup context and not passed as a filter (default TRUE)
- ...
Additional arguments passed to the underlying spdgt.auth function (e.g.,
verbosity,timeout).- species_id
Integer. Species identifier.
- survey_type_id
Integer. Survey type identifier.
- analysis_unit_id
Integer. Analysis unit identifier.
- dry_run
If
TRUE, print the HTTP request without sending it and return the request object invisibly. Useful for debugging.
Value
Tibble with one row per stratum and the following columns:
- method
Character. The optimization method used (
"precision"or"fixed").- value
Integer. The input value (error bound for
"precision", sample size for"fixed").- species_id
Integer. Species identifier.
- survey_type_id
Integer. Survey type identifier.
- analysis_unit_id
Integer. Analysis unit identifier.
- bio_year
Integer. Biological year.
- stratum_id
Integer. Stratum identifier (excludes stratum 0 / "Other").
- subunits_available
Integer. Total subunits available in the stratum.
- pop_sd
Numeric. Population standard deviation for the stratum, estimated from historical survey data.
- cost
Integer. Cost per sample unit (typically 1).
- sample_proportion
Numeric. Optimal Neyman allocation proportion for this stratum (sums to 1 across included strata;
NAfor excluded strata).- n_samples
Integer. Number of subunits to sample in this stratum.
- dau_proportion
Numeric. Sampling intensity (
n_samples / subunits_available).- include
Logical. Whether the stratum was included in the optimization.
See also
lkup_species_id(), lkup_survey_type_id(), lkup_dau_id() for
converting names to IDs
Examples
if (FALSE) { # \dontrun{
# Using names
sight_optimize_design(
method = "fixed",
value = 100,
species = "Mule Deer",
survey_type = "Sightability-Abundance",
analysis_unit = "Bannock",
bio_year = 2024
)
# Using IDs with variance from previous model
sight_optimize_design_id(
method = "precision",
value = 500,
species_id = 1,
survey_type_id = 3,
analysis_unit_id = 272,
bio_year = 2024,
samp_var = 15000,
sight_var = 2000,
mod_var = 800
)
} # }