Subsample simulation for completed surveys
Source:R/sight_subsample_survey.R
sight_subsample_survey.Rdsight_subsample_survey() resolves names to IDs then calls the
sightability API. sight_subsample_survey_id() calls the API directly
using integer IDs.
Usage
sight_subsample_survey(
species,
spatial_focus,
bio_year,
analysis_unit,
survey_type,
model,
proportions,
iterations = 25L,
seed = NULL,
...
)
sight_subsample_survey_id(
species_id,
spatial_focus,
bio_year,
analysis_unit_id,
survey_type_id,
model_id,
proportions,
iterations = 25L,
seed = NULL,
dry_run = FALSE,
...
)Arguments
- species
Character. Species name (name-based variant only).
- spatial_focus
Character. One of
"DAU","GMU", or"SubUnit".- bio_year
Integer. Biological year.
- analysis_unit
Character. Analysis unit name (name-based variant only).
- survey_type
Character. Survey type name (name-based variant only).
- model
Character. Model name (name-based variant only).
- proportions
A data.frame with columns
stratum_id(integer) andproportion(numeric, 0 < p <= 1), or a list of lists with those keys. Strata not listed default to 1.0 (fully retained).- iterations
Integer. Number of subsample iterations (1–200, default 25).
- seed
Integer or
NULL. Random seed for reproducibility.- ...
Additional arguments passed to the underlying spdgt.auth function (e.g.,
verbosity,timeout).- species_id
Integer. Species identifier (ID-based variant only).
- analysis_unit_id
Integer. Analysis unit identifier (ID-based variant only).
- survey_type_id
Integer. Survey type identifier (ID-based variant only).
- model_id
Integer. Sightability model identifier.
- dry_run
If
TRUE, print the HTTP request without sending it and return the request object invisibly.
Value
A named list with four elements:
- original
Tibble of full-data estimates.
- simulations
Tibble with one row per iteration x Demographic.
- summary
Per-Demographic summary statistics.
- metadata
List with simulation parameters and subunit counts.
Details
Runs a stratified subunit-level subsampling simulation on a completed survey. For each iteration, a random subset of surveyed subunits is retained per stratum and the sightability model is re-fit on the server. Returns the full-data estimate alongside iteration-level results and summary statistics.
See also
sight_fit_model() for fitting without subsampling
Examples
if (FALSE) { # \dontrun{
# Using names
sight_subsample_survey(
species = "Mule Deer",
spatial_focus = "DAU",
bio_year = 2024,
analysis_unit = "North Converse 755",
survey_type = "Sightability",
model = "Mule Deer",
proportions = data.frame(stratum_id = c(1L, 2L),
proportion = c(0.5, 0.75)),
iterations = 25L
)
# Using IDs
sight_subsample_survey_id(
species_id = 1,
spatial_focus = "DAU",
bio_year = 2024,
analysis_unit_id = 272,
survey_type_id = 3,
model_id = 1,
proportions = data.frame(stratum_id = c(1L, 2L),
proportion = c(0.5, 0.75)),
iterations = 25L,
seed = 42L
)
} # }