Skip to contents

Wrapper function that calculate species sensitivity using attribute_score and apply_logic_rule for individual attributes and apply logic rule to calculate total sensitivity. The option to perform bootstrapping is provided. Based on code from the Southeast Fisheries Science Center (SEFSC)

Usage

calculate_sensitivity(species_attributes, bootstrap = TRUE, samples = 10000)

Arguments

species_attributes

a list of data frames, with each data frame corresponding to all of the expert scores for one species. See example for how to generate this list from the FCVA output.

bootstrap

binary TRUE/FALSE to turn on/off bootstrapping of sensitivity scores. Will impact outputs.

samples

number of samples to run for bootstrapping. Default is 10,000.

Value

a data.frame where each row is a species, and columns represent attribute scores, as well as the Total Sensitivity score column returned by the logic rule

Examples

if (FALSE) { # \dontrun{
data <-utils::read.csv('expert_scores.csv') #sensitivity data from FSCVA Portal
species.data.list <- split(data, data$Stock.Name)
species.sensitivity <- lapply(species.data.list, calculate.sensitivity, bootstrap = F)
speciesDF <- do.call(rbind, species.sensitivity)
sensitivity.bootstrap <- lapply(species.data.list, calculate.sensitivity, bootstrap = T)
sensitivity.certainty <- mapply(bootstrap.certainty, sensitivity.bootstrap,
 species.sensitivity, SIMPLIFY = F)
#note the use of mapply rather than lapply here since both inputs are lists
sensitivityDF <- do.call(rbind, sensitivity.certainty)
#this combines the list of vectors into a data.frame
} # }