Skip to contents

Calls the sightability API to produce a planned survey design (sample allocation across strata) from an authoritative design supplied by the caller, rather than one looked up server-side.

Usage

sight_plan_id(
  method = "stratified",
  target = "precision",
  value,
  design = NULL,
  variance = NULL,
  confidence = 0.9,
  density = NULL,
  width_m = NULL,
  sides = NULL,
  mean_group_size = NULL,
  b = NULL,
  k = NULL,
  group_cv = NULL,
  area_km2 = NULL,
  dry_run = FALSE,
  ...
)

Arguments

method

Character. Survey method: "stratified" or "distance".

target

Character. Allocation target: "precision" (target error bound) or "fixed" (target sample size).

value

Numeric. For "precision": desired error bound. For "fixed": target sample size.

design

Data frame or list. Authoritative per-stratum design, e.g. with columns stratum_id, subunits_available, pop_sd, cost, and include. Stratified method only.

variance

List. Variance components with elements samp_var, sight_var, and mod_var. Stratified method only.

confidence

Numeric. Confidence level for the error bound (default 0.90 for 90% CI). Must be between 0 and 1.

density

Numeric. Expected population density. Distance method only.

width_m

Numeric. Transect half-width in meters. Distance method only.

sides

Numeric. Number of sides searched per transect (1 or 2). Distance method only.

mean_group_size

Numeric. Expected mean group size. Distance method only.

b

Numeric. Truncation distance parameter. Distance method only.

k

Numeric. Detection function shape parameter. Distance method only.

group_cv

Numeric. Coefficient of variation for group size. Distance method only.

area_km2

Numeric. Total survey area in square kilometers. Distance method only.

dry_run

If TRUE, print the HTTP request without sending it and return the request object invisibly. Useful for debugging.

...

Additional arguments passed to the underlying spdgt.auth function (e.g., verbosity, timeout).

Value

Tibble with the planned design, mirroring the input design with allocation columns (e.g. sample_proportion, n_samples, dau_proportion) added by the /plan endpoint.

Examples

if (FALSE) { # \dontrun{
sight_plan_id(
  method = "stratified",
  target = "fixed",
  value = 100,
  design = data.frame(
    stratum_id = c(1, 2),
    subunits_available = c(50, 80),
    pop_sd = c(5, 12),
    cost = c(1, 1),
    include = c(TRUE, TRUE)
  ),
  variance = list(samp_var = 15000, sight_var = 2000, mod_var = 800)
)
} # }