Calculate stratum-level standard deviation from historical entries
Source:R/sight_calc_stratum_sd.R
sight_calc_stratum_sd.RdLoads historical entries for a species/analysis_unit (optionally filtered by survey type) and calculates the standard deviation of subunit totals within each stratum. This is used for Neyman allocation in survey optimization.
Usage
sight_calc_stratum_sd(species, analysis_unit, survey_type = NULL)
sight_calc_stratum_sd_id(species_id, analysis_unit_id, survey_type_id = NULL)Arguments
- species
Character. Species name.
- analysis_unit
Character. Analysis unit name.
- survey_type
Character. Optional survey type name to filter entries.
- species_id
Integer. Species identifier.
- analysis_unit_id
Integer. Analysis unit identifier.
- survey_type_id
Integer. Optional survey type ID to filter entries. Recommended to ensure methodological consistency (e.g., don't mix sightability and composition surveys).
Value
Tibble with columns:
- stratum_id
Integer. Stratum identifier.
- pop_sd
Numeric. Standard deviation of subunit totals within stratum.
Details
The function first sums observation totals to the subunit level within each survey year, then averages across years per subunit, and finally calculates the standard deviation of those mean subunit totals within each stratum. Averaging across years prevents subunits surveyed in multiple years from having inflated totals relative to those surveyed once, which would conflate survey effort with spatial heterogeneity.
Stratum ID 0 (opportunistic observations) is excluded from the calculation.
Filtering by survey_type is recommended because different survey methods (sightability vs composition) have different search intensities that affect observed counts.
Examples
if (FALSE) { # \dontrun{
# Using names - filter to sightability surveys only
sight_calc_stratum_sd(
species = "Elk",
analysis_unit = "Beaverhead",
survey_type = "Sightability-Abundance"
)
# Using IDs
sight_calc_stratum_sd_id(
species_id = 2,
analysis_unit_id = 305,
survey_type_id = 7
)
} # }