Skip to contents

Collects the automated detections, the verified detections, and the site table into one object that fp_occu() can fit. All tables are in long format, one row per occasion, which accommodates unequal numbers of occasions per site without padding. Use fp_data_wide() if your data are detection matrices, as in 'unmarked'.

Usage

fp_data(
  auto,
  sites,
  verified = NULL,
  site = "site",
  y = "y",
  recorder = NULL,
  confirmed = NULL
)

Arguments

auto

Data frame of the automated method (the one that can return false positives), one row per site and occasion. It needs a site column and a 0/1 detection column, and may hold observation covariates for the true-detection process and a recorder (or observer) identifier.

sites

Data frame with one row per site: the site identifier plus any site covariates used in the occupancy (occ) or false-positive (fp) formulas of fp_occu(). Sites with no automated occasions are allowed and contribute only through their verified data, if any.

verified

Optional data frame of the verified method (detections checked by an expert and therefore free of false positives), one row per site and occasion, with the same site and detection columns. Without it the false-positive rate is identified only by the priors, and fp_occu() warns about it.

site, y

Names of the site and detection columns, shared by all tables.

recorder

Optional name of a column of auto that identifies the recorder or observer, used for a random intercept on true detection.

confirmed

Optional names of two columns of auto holding, for the occasions whose observations were checked by an expert, the number of observations confirmed as the target species and the number confirmed as something else, in that order (the observation-confirmation design of Chambert et al. 2015). Use NA in both for occasions that were not checked. All observations of a checked occasion must have been checked, so an occasion with a detection has at least one confirmed observation, and one without has none. See Details of fp_occu().

Value

An object of class fp_data: a list with the three tables (rows with a missing detection dropped), the column names, and the vector known_present, which flags sites with at least one verified detection or confirmed true observation.

References

Chambert, T., Miller, D. A. W., & Nichols, J. D. (2015). Modeling false positive detections in species occurrence data under different study designs. Ecology, 96, 332–339. doi:10.1890/14-1507.1

Examples

sim <- simulate_fp(nsite = 50, nocc = 5, seed = 1)
sim$data
#> <fp_data>
#>   sites:                  50
#>   automated occasions:    250 (naive occupancy 0.68)
#>   verified sites:         18 (54 occasions, 10 with a confirmed detection)
#>   recorders:              5
#>   site covariates:        x, w 
#>   observation covariates: bio, aci 

# the same structure built by hand
d <- fp_data(auto = sim$data$auto, sites = sim$data$sites,
             verified = sim$data$verified, recorder = "recorder")
d
#> <fp_data>
#>   sites:                  50
#>   automated occasions:    250 (naive occupancy 0.68)
#>   verified sites:         18 (54 occasions, 10 with a confirmed detection)
#>   recorders:              5
#>   site covariates:        x, w 
#>   observation covariates: bio, aci