Implements a buffer harvest control rule (HCR) that adjusts management output according to the recent value of a stock or index metric relative to a set of threshold reference points.

Tools for visualizing a buffer-based harvest control rule (HCR), including the HCR curve itself and optional shaded management-tier bands.

buffer.hcr(
  stk,
  ind,
  metric = "wmean",
  target = 1,
  width = 0.5,
  lim = max(target * 0.1, target - 2 * width),
  bufflow = max(lim * 1.5, target - width),
  buffupp = target + width,
  sloperatio = 0.15,
  initial,
  nyears = 4,
  dupp = NULL,
  dlow = NULL,
  all = TRUE,
  scale = FALSE,
  ...,
  args,
  tracking
)

plot_buffer.hcr(
  args,
  obs = "missing",
  alpha = 0.3,
  labels = c(lim = "Limit", bufflow = "Lower~buffer", buffupp = "Upper~buffer", metric =
    metric, output = output),
  metric = args$metric,
  output = "multiplier",
  xlim = buffupp * 1.5,
  ylim = scale * 1.5
)

buffer_bands(x)

Arguments

stk

A stock object, typically an FLStock, used together with ind to compute the HCR metric.

ind

An index object used when computing the selected metric.

metric

Character string giving the metric used for the x-axis and, when obs is an FLStock, the variable extracted from FLCore::metrics().

target

Numeric. Target value of the metric.

width

Numeric. Half-width of the buffer around target.

lim

Numeric. Lower limit reference point for the metric.

bufflow

Numeric. Lower bound of the buffer zone.

buffupp

Numeric. Upper bound of the buffer zone.

sloperatio

Numeric. Controls the slope of output increases above buffupp.

initial

Initial output value used when no previous output is available.

nyears

Number of recent years over which the metric is averaged.

dupp

Optional upper bound on proportional increase in output.

dlow

Optional lower bound on proportional decrease in output.

all

Logical. If TRUE, change limits are always applied.

scale

Logical. If TRUE, do not recover previous output from tracking.

...

Additional arguments passed to mse::selectMetric().

args

A list of arguments defining the buffer HCR. Typically includes values such as lim, bufflow, buffupp, sloperatio, and optionally other elements used by the plotting method. If an object of class mseCtrl is supplied to plot_buffer.hcr(), its arguments are extracted using args().

tracking

A tracking object updated with metric, decision, tier, and output values.

obs

Optional observed values to overlay on the HCR plot. Can be:

  • an FLStock object, in which case metric and output are extracted and plotted;

  • a numeric value, in which case a single point is added on the HCR curve;

  • omitted, in which case no observations are added.

alpha

Numeric. Alpha transparency used for observed points and paths.

labels

Labels for plot annotations. A named vector or list with names among lim, bufflow, buffupp, metric, and output. Supplied values override the defaults.

output

Character string giving the output used for the y-axis and, when obs is an FLStock, the variable extracted from FLCore::metrics().

xlim

Numeric. Maximum x-axis value for the HCR plot. By default set to buffupp * 1.5.

ylim

Numeric. Maximum y-axis value for the HCR plot.

x

An object for which args() returns a list containing at least the buffer-HCR parameters lim, bufflow, and buffupp.

Value

For buffer.hcr(), a list with components ctrl and tracking.

For buffer_bands(), a list of ggplot2 layers for shading HCR zones.

For plot_buffer.hcr(), a ggplot2 object.

For buffer_bands(), a list of ggplot2 components:

Details

buffer.hcr() computes a piecewise decision multiplier from the selected metric and applies it to the previous output value.

buffer_bands() creates shaded ggplot2 rectangles marking the critical, recovery, buffer, and above-target zones implied by the same thresholds.

plot_buffer.hcr() draws the HCR curve implied by the buffer rule and can optionally overlay observed values.

buffer_bands() returns ggplot2 layers that shade the management tiers defined by the HCR thresholds.

The buffer harvest control rule is defined by threshold values that partition the x-axis metric into zones:

  • below lim: critical zone;

  • between lim and bufflow: recovery zone;

  • between bufflow and buffupp: buffer zone;

  • above buffupp: above-target zone.

plot_buffer.hcr() evaluates the implied HCR multiplier across a sequence of metric values and draws the resulting curve, including annotations for the key thresholds.

buffer_bands() constructs semi-transparent shaded rectangles spanning these threshold intervals to support interpretation of HCR plots.

plot_buffer.hcr

plot_buffer.hcr() computes the HCR response curve from the supplied buffer rule parameters and returns a ggplot object. The plot includes:

  • the HCR line;

  • vertical reference markers for lim, bufflow, and buffupp;

  • labels for the threshold points;

  • optional observed points or trajectories.

If obs is an FLStock object, the function extracts the chosen metric and output values using FLCore::metrics() and overlays them on the HCR curve. If there is a single iteration, both points and a path are added, and first/last years are labelled.

If obs is numeric, a single red point is placed at the corresponding location on the HCR curve.

buffer_bands

buffer_bands() extracts lim, bufflow, and buffupp from args(x) and defines four contiguous x-axis intervals. A fourth threshold, target = 1.5 * buffupp, is used as the upper bound for the final tier.

The returned rectangles extend from y = 0 to y = Inf, so they occupy the full vertical plotting range.

Assumptions and caveats

  • Thresholds are assumed to satisfy 0 <= lim <= bufflow <= buffupp.

  • buffer_bands() adds a fill scale and may therefore override an existing fill scale in a ggplot object.

  • In plot_buffer.hcr(), default values such as xlim and ylim depend on objects created after argument expansion and may rely on the surrounding evaluation framework.

  • plot_buffer.hcr() currently uses internal helper functions such as FLCore::spread(), args(), and FLCore::metrics(), and assumes these are available.

Author

Iago Mosqueira, WMR; Richard Hillary, CSIRO

Examples

if (FALSE) { # \dontrun{
args <- list(lim = 0.4, bufflow = 1, buffupp = 2, sloperatio = 0.2)

# Plot the HCR curve
plot_buffer.hcr(args, labels = list(metric = "CPUE", output = "C~mult"))

# Add buffer bands to a custom ggplot
layers <- buffer_bands(hcr)
p <- ggplot(dat, aes(x = biomass, y = harvest)) + geom_line()
for (ly in layers) p <- p + ly
p
} # }