apply_error_to_spp_occupancy_data: Apply error to species occupancy data.

apply_error_to_spp_occupancy_dataR Documentation

Apply error to species occupancy data.

Description

Walk through the occupancy matrix (PU vs spp) and randomly choose to flip some of the TPs to FNs and TNs to FPs based on the given FP and FN error rates. Update the occupancy matrix (bpm) as you go along, but don't update the PU_spp_pair_indices until you know all locations that have flipped. Update PU_spp_pair_indices at the end so that you don't have to constantly resize this big array as you go along.

Usage

apply_error_to_spp_occupancy_data(
  bpm,
  FP_rates,
  FN_rates,
  num_PUs,
  num_spp,
  random_values,
  no_empty_spp_allowed = TRUE,
  min_allowed_num_occ_per_spp = 1
)

Arguments

bpm

bipartite matrix; integer matrix with one row for each species and one column for each planning unit. Each matrix entry specifies whether that species occupies that planning unit; 1 indicates the species does occupy the planning unit and 0 indicates it does not. Same as occ_matrix.

FP_rates

numeric vector

FN_rates

numeric vector

num_PUs

integer number of planning units

num_spp

integer number of species in the problem

random_values

numeric vector

no_empty_spp_allowed

boolean

min_allowed_num_occ_per_spp

integer

Value

Returns bpm matrix


langfob/bdpg documentation built on Dec. 8, 2022, 5:33 a.m.