Skip to contents

Calls the sightability API to prepare survey data and return a named list compatible with SightabilityModel::Sight.Est(). Only works for classical (non-JAGS) models.

Usage

sight_prep_wong(
  species,
  spatial_focus,
  bio_year,
  analysis_unit,
  survey_type,
  model,
  ...
)

sight_prep_wong_id(
  species_id,
  spatial_focus,
  bio_year,
  analysis_unit_id,
  survey_type_id,
  model_id,
  dry_run = FALSE,
  ...
)

Arguments

species

Character. Species name.

spatial_focus

Character. One of "DAU", "GMU", or "SubUnit".

bio_year

Integer. Biological year.

analysis_unit

Character. Analysis unit name.

survey_type

Character. Survey type name.

model

Character. Model name.

...

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

species_id

Integer. Species identifier.

analysis_unit_id

Integer. Analysis unit identifier.

survey_type_id

Integer. Survey type identifier.

model_id

Integer. Sightability model identifier.

dry_run

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

Value

Named list with five elements for SightabilityModel::Sight.Est():

odat

data.frame with columns stratum, subunit, total, and one column per dummy-coded covariate.

sampinfo

data.frame with columns stratum, nh, Nh.

form

A formula of the form y ~ cov1 + cov2 + ....

bet

Numeric vector of beta coefficients (including intercept).

varbet

Variance-covariance matrix for the beta coefficients.

See also

Examples

if (FALSE) { # \dontrun{
# Using names
sm <- sight_prep_wong(
  species = "Mule Deer",
  spatial_focus = "DAU",
  bio_year = 2024,
  analysis_unit = "North Converse 755",
  survey_type = "Sightability",
  model = "Mule Deer"
)

# Using IDs
sm <- sight_prep_wong_id(
  species_id = 1,
  spatial_focus = "DAU",
  bio_year = 2024,
  analysis_unit_id = 355,
  survey_type_id = 9,
  model_id = 1
)

# Cross-validate with SightabilityModel
result <- SightabilityModel::Sight.Est(
  form = sm$form,
  odat = sm$odat,
  sampinfo = sm$sampinfo,
  method = "Wong",
  logCI = TRUE,
  bet = sm$bet,
  varbet = sm$varbet
)
} # }