Setup

knitr::opts_chunk$set(
  echo = TRUE,
  warning = FALSE,
  message = FALSE,
  fig.width = 8,
  fig.height = 6
)

library(FLCore)
library(FLBRP)
library(FLasher)
library(ggplot2)
library(plyr)
library(dplyr)

Methods

Age-Structured Model

The FLBRP rebuild method projects population recovery from different initial depletion levels:

# Load stock assessment data
load("data/icesdata.RData")

# Fit stock-recruitment relationships
eql <- function(x, model="bevholt") {
  sr <- fmle(as.FLSR(x, model=model))
  brp(FLBRP(x, sr=list(model=model, params=params(sr))))
}

# Calculate rebuilding trajectories
stks <- names(icesdata)
bh <- dlply(stks, function(id) {
  eq <- eql(icesdata[[id]])
  rebuildTime(rebuild(eq))
})

Biomass Dynamic Model

The biodyn rebuild method provides an alternative approach:

# Setup parameters
priors <- data.frame(
  r = c(0.5),
  k = c(1000),
  p = c(1)
)

# Project rebuilding
bds <- dlply(priors, function(x) {
  bd <- biodyn(params=FLPar(r=x$r, k=x$k, p=x$p))
  rebuild(bd)
})

Results Visualization

Compare rebuilding trajectories across methods:

ggplot(rbind(
    cbind(Method="Age-structured", ldply(bh)),
    cbind(Method="Biomass dynamic", ldply(bds)))) +
  geom_line(aes(initial, year, color=Method)) +
  labs(x="Initial Depletion (B/BMSY)", 
       y="Years to Recovery",
       title="Stock Rebuilding Trajectories") +
  theme_minimal()

Discussion

The two methods provide complementary approaches for estimating rebuilding times:

  1. The age-structured approach accounts for population demographics
  2. The biomass dynamic model offers a simpler alternative when age data is limited

Both methods demonstrate how initial depletion level affects recovery time, with implications for management strategy evaluation. ```

Implementation Notes

  1. The code has been reorganized for clarity and reproducibility
  2. Documentation follows scientific publication standards
  3. Methods are presented with sufficient detail for replication
  4. Results visualization focuses on key comparisons
  5. Discussion provides context for method selection and application


laurieKell/FLCandy documentation built on April 17, 2025, 5:23 p.m.