Skip to contents

Computes upper/lower outlier bounds for catch data (catch_kg) grouped by the interaction of gear and catch_taxon. This function uses LocScaleB with a (default) log transform to find outlier thresholds for each gear-taxont group, then exponentiates the upper bound.

Usage

get_catch_bounds_taxon(data, k)

Arguments

data

A data frame that includes the columns gear, catch_taxon, and catch_kg.

k

A numeric parameter passed to LocScaleB, controlling how "wide" the outlier threshold will be (often k = 3 or k = 2).

Value

A data frame with columns gear, catch_taxon, upper.up, and the bounds from LocScaleB. The lower.low column is dropped.

Details

  1. Filters to columns gear, catch_taxon, and catch_kg.

  2. Splits the data by the interaction of gear and catch_taxon.

  3. Runs LocScaleB on each subset (with logt = TRUE), retrieving the bounds.

  4. Binds the subset results, exponentiates the upper.up bound, then separates gear_taxon back into gear and catch_taxon.

See also

LocScaleB for outlier detection, validate_catch_taxa for usage of these bounds in a validation step.

Examples

if (FALSE) { # \dontrun{
data_bounds <- get_catch_bounds_taxon(data, k = 3)
head(data_bounds)
} # }