Skip to contents

Different fishing gears remove different parts of a shared population. When the fleet mix changes, the age pattern of total fishing mortality can change too. This guide compares a fit to individual fleet catches with a fit to their sum. Both fits use the same survey indices and population biology.

The simulated cod stock declines over 20 years. Trawl fishing drops to a low bycatch level from year 11, while gillnet and longline fishing continue. Two survey programs represent an offshore research-vessel survey and a coastal Sentinel gillnet survey. The example uses SimSurvey. The dataset help describes the 3Ps cod inspiration, simulation and generating values.

Inspect the input keys

dat <- sim_cod_obs
check_tam_data(dat)
#> ✔ Input data passed validation.
#> ℹ Years 1-20; ages 1-20; fleets: 3; surveys: 2.
head(dat$catch)
#>   year age   fleet      obs          unit
#> 1    1   1 Gillnet  99.5060 thousand fish
#> 2    1   2 Gillnet 186.4795 thousand fish
#> 3    1   3 Gillnet 269.6940 thousand fish
#> 4    1   4 Gillnet 289.4023 thousand fish
#> 5    1   5 Gillnet 266.2264 thousand fish
#> 6    1   6 Gillnet 212.3006 thousand fish
head(dat$index)
#>   year age survey      obs samp_time          unit
#> 1    1   1     RV  2537.22         0 thousand fish
#> 2    1   2     RV 10267.62         0 thousand fish
#> 3    1   3     RV 16939.46         0 thousand fish
#> 4    1   4     RV 18784.20         0 thousand fish
#> 5    1   5     RV 12665.79         0 thousand fish
#> 6    1   6     RV 10732.58         0 thousand fish

Catch has a complete year–age grid within each fleet, with NA for unavailable observations. Each index row identifies survey and samp_time. Both surveys sample at the start of each year (samp_time = 0).

The Sentinel-like survey samples a coastal band more densely than the RV-like survey samples offshore. Its normal selectivity curve is shared with the gillnet fishery. RV selectivity rises with age. Both use swept-area sampling, so the Sentinel-like program approximates the footprint and selectivity of a gillnet survey.

Survey footprints on the synthetic grid. The northern edge represents the coast; grey cells are outside each survey's footprint.

Survey footprints on the synthetic grid. The northern edge represents the coast; grey cells are outside each survey’s footprint.

SimSurvey’s run_catch() uses sampled fish ages and reported annual fleet totals to estimate catch numbers at age before fitting. It also estimates catch weights. The tinyAM inputs use stock weights where a fleet has no catch weight estimate. The fit takes stock weights and maturity from the simulated population. run_strat() estimates abundance within each survey’s footprint. The input tables retain zero estimates, which the lognormal likelihood excludes. The simulation uses a fixed spatial pattern on a 20-by-20 grid, so the share of the population available to each survey is approximately constant.

See how fishing changes

Each fleet’s reference F at full selectivity follows its own log-scale random walk. From year 11, the trawl rate is 20% of what its random walk would otherwise produce. Gillnet and longline follow their own paths through the change.

Fleet targets at full selectivity. The vertical line marks the trawl reduction between years 10 and 11.

Fleet targets at full selectivity. The vertical line marks the trawl reduction between years 10 and 11.

Realized F also depends on which ages the fleets catch. The trawl’s average realized F over ages 5–10 falls from 0.057 to 0.020 per year between the two periods. The simulation draws reference M independently of the fishing targets. Realized M is the part of Z that remains after accounting for actual fleet catches. Recruitment also varies substantially through the decline.

Describe each fleet within one formula

for_fleet() gives each fleet its own scale and curve. Inner formulas include intercepts, so use outer ~ 0 + to avoid an extra common baseline.

fleet_dat <- dat
fleet_dat$catch <- transform(dat$catch, trawl_low = year >= 11)
fishing <- ~ 0 +
  for_fleet("Trawl", ~ logistic(age) + trawl_low) +
  for_fleet("Longline", ~ logistic(age)) +
  for_fleet("Gillnet", ~ normal(age))

Trawl and longline selectivity rise with age. Gillnet selectivity peaks at an intermediate age and falls symmetrically on either side. The trawl_low term lets the trawl scale shift in year 11 while keeping its selectivity curve. The fit estimates the size of the shift.

Generating selectivity curves. Dashed lines identify surveys; solid lines identify fisheries.

Generating selectivity curves. Dashed lines identify surveys; solid lines identify fisheries.

The normal curve estimates two shape parameters, the peak age and the width. The curve reaches one at the peak, so the fleet intercept sets peak mean F. See fleet formulas and catchability and selectivity curves.

Give surveys their own relationships

catchability <- ~ 0 +
  for_survey("RV", ~ logistic(age)) +
  for_survey("Sentinel", ~ normal(age))

Each survey has a separate q scale and shape. The Sentinel curve uses the same form as the Gillnet curve and estimates its own peak and width. Survey q also includes the fraction of the stock inside the survey footprint.

Fit the fleet and aggregate models

Both models use deterministic cohort survival, random-walk recruitment and an AR1 process for M around a reference value of 0.3 per year. The M process correlates deviations across ages and years. In the simulation, realized M over ages 5–10 averages 0.295 before and 0.319 after the trawl reduction. Fitting ages = 1:14 pools catches and survey indices from ages 14–20 while retaining age-specific weights and maturity for biomass and SSB.

multifleet <- fit_tam(
  fleet_dat, ages = 1:14,
  N_settings = list(process = "off", init = "exp"),
  R_settings = list(process = "rw"),
  F_settings = list(process = "ar1", mu_form = fishing,
                    sd_form = ~ 1, mean_ages = 5:10),
  M_settings = list(process = "ar1", mu_supplied = ~ I(0.3), mean_ages = 5:10),
  catch_settings = list(sd_form = ~ 0 + fleet),
  index_settings = list(q_form = catchability, sd_form = ~ 0 + survey)
)

Within a fleet, F deviations from the mean curve are correlated across ages and years. The fleets share process parameters and have separate catch observation SDs. Each survey also has its own observation SD. Each fleet’s Baranov catch prediction uses its own F and the common total mortality \(Z = M + \sum_f F_f\).

For the aggregate model, sum catch numbers across fleets within each year and age. This gives one catch number for each year and age before plus-group pooling. A missing fleet catch makes the sum missing. Compute a mean catch weight at age weighted by each fleet’s catch numbers so the pooled data give the same observed yield before plus-group pooling. Use the stock weight where the summed catch at age is zero or missing.

stock_weight <- subset(dat$weight, type == "stock")
fleet_weights <- subset(dat$weight, type == "catch", select = c(year, age, fleet, obs))
names(fleet_weights)[names(fleet_weights) == "obs"] <- "weight"
fleet_catch <- merge(dat$catch, fleet_weights, by = c("year", "age", "fleet"))
fleet_catch$yield <- fleet_catch$obs * fleet_catch$weight
totals <- aggregate(fleet_catch[c("obs", "yield")], fleet_catch[c("year", "age")], sum)

aggregate_dat <- dat
aggregate_dat$catch <- transform(totals[c("year", "age", "obs")],
  unit = unique(dat$catch$unit))
pooled_weight <- merge(totals, stock_weight[c("year", "age", "obs", "unit")],
  by = c("year", "age"), suffixes = c("", "_stock"))
pooled_weight <- transform(pooled_weight,
  obs = ifelse(!is.na(obs) & obs > 0, yield / obs, obs_stock),
  type = "catch", fleet = NA_character_)
aggregate_dat$weight <- rbind(stock_weight, pooled_weight[names(stock_weight)])

The aggregate model uses an AR1 process around a logistic mean F curve. Departures from the mean are correlated across years and neighboring ages. The model learns the timing of changes from the pooled catches and survey indices.

aggregate_fit <- fit_tam(
  aggregate_dat, ages = 1:14,
  N_settings = list(process = "off", init = "exp"),
  R_settings = list(process = "rw"),
  F_settings = list(process = "ar1", mu_form = ~ logistic(age), mean_ages = 5:10),
  M_settings = list(process = "ar1", mu_supplied = ~ I(0.3), mean_ages = 5:10),
  index_settings = list(q_form = catchability, sd_form = ~ 0 + survey)
)
check_tam(multifleet, aggregate_fit)
#> 
#> ── multifleet ──────────────────────────────────────────────────────────────────
#> ✔ Numerical convergence: passed
#> ✔ Optimizer: 0 (relative convergence (4))
#> ✔ Max |gradient|: 3.83e-05 adjusted; 3.83e-05 raw (tolerance 0.01)
#> ✔ Positive-definite Hessian: yes
#> ✔ Model structure: no redundant model terms detected
#> 
#> Advisory findings (4):
#> ℹ Some age/series groups have mean standardized residuals outside -0.5 to 0.5.
#> ℹ Some age/series groups have standardized residual SDs outside 0.5 to 1.5;
#>   fitted-state shrinkage also affects spread.
#> ℹ Some standardized residuals exceed three SDs in absolute value.
#> ℹ Some age/series groups have absolute adjacent-year residual correlation above
#>   0.5.
#> 
#> 
#> ── aggregate_fit ───────────────────────────────────────────────────────────────
#> 
#> ✔ Numerical convergence: passed
#> ✔ Optimizer: 0 (relative convergence (4))
#> ✔ Max |gradient|: 2.4e-05 adjusted; 2.4e-05 raw (tolerance 0.01)
#> ✔ Positive-definite Hessian: yes
#> ✔ Model structure: no redundant model terms detected
#> 
#> Advisory findings (4):
#> ℹ Some age/series groups have mean standardized residuals outside -0.5 to 0.5.
#> ℹ Some age/series groups have standardized residual SDs outside 0.5 to 1.5;
#>   fitted-state shrinkage also affects spread.
#> ℹ Some standardized residuals exceed three SDs in absolute value.
#> ℹ Some age/series groups have absolute adjacent-year residual correlation above
#>   0.5.

The fitted plus group applies its modeled mortality rates to ages 14 and older. The generator drops surviving age-20 fish at the next year boundary. These survivors represent up to 0.082% of annual abundance and 1.33% of annual SSB at their age-20 weight and maturity.

Inspect fleets, surveys and the common population

vis_tam(MultiFleet = multifleet, Aggregate = aggregate_fit, open_file = FALSE)

Explore the simulated-cod dashboard to inspect the example fits and diagnostics.

Start with each fleet under Fisheries. Aggregate fishery shows total yield for both models and catch-at-age fits and residuals for the aggregate model. Both models appear under Surveys and Trends.

model_order <- c("MultiFleet", "Aggregate")
ssb <- get_ssb(MultiFleet = multifleet, Aggregate = aggregate_fit)
ssb$model <- factor(ssb$model, levels = model_order)
plot_trend(ssb, color = ~model, colors = tam_pal(2), ylab = "SSB (tonnes)",
           add_buttons = FALSE) |>
  plotly::add_lines(data = sim_cod_truth$annual, x = ~year, y = ~SSB,
    inherit = FALSE, name = "Generating SSB",
    line = list(color = "#333333", dash = "dot"),
    hovertemplate = "%{x}<br>%{y} tonnes<extra>Generating SSB</extra>") |>
  add_plot_buttons()

fbar <- get_fbar(MultiFleet = multifleet, Aggregate = aggregate_fit)
fbar$model <- factor(fbar$model, levels = model_order)
fbar_truth <- with(subset(sim_cod_truth$population, age %in% 5:10),
  annual_fbar(year, F, N))
plot_trend(fbar, color = ~model, colors = tam_pal(2), ylab = "Average F, ages 5–10 (per year)",
           add_buttons = FALSE) |>
  plotly::add_lines(data = fbar_truth, x = ~year, y = ~F,
    inherit = FALSE, name = "Generating F",
    line = list(color = "#333333", dash = "dot"),
    hovertemplate = "%{x}<br>%{y} per year<extra>Generating F</extra>") |>
  add_plot_buttons()

The dotted lines show generating SSB and abundance-weighted F over ages 5–10. The SSB errors are percentages of generating SSB in each year.

Model Mean SSB error (%) Mean absolute SSB error (%) Terminal SSB error (%) Mean absolute F error (per year) Change in F, years 10 to 11
MultiFleet -7.15 8.08 -18.07 0.007 -0.053
Aggregate -1.23 5.45 -14.38 0.004 -0.044

Generating F changes by -0.048 per year at the trawl reduction. Differences between the fits reflect how they use the catches and how they describe F, including the fleet model’s known timing of the trawl reduction. This example compares recovery against the generating values because the fits use different catch observations.