Skip to contents

A step-by-step Shiny app for stock assessment with JABBA3, the Bayesian state-space surplus production model (https://github.com/Henning-Winker/JABBA3). Load catch and abundance indices, derive the priors and the production lag from life history, explore index agreement, fit and check the model, compare runs and ensembles, and project the stock with Kobe II matrices and harvest control rules. The app calls the JABBA3 functions, so every step can be repeated in a script.

Website: https://henning-winker.github.io/JABBA3App/

The JABBA3 workflow: inputs, the three model components of jabba3() and outputs.
The JABBA3 workflow: inputs, the three model components of jabba3() and outputs.

Install

install.packages(c("remotes", "shiny", "shinydashboard", "commonmark", "patchwork"))
remotes::install_github("Henning-Winker/JABBA3App")   # also installs JABBA3

JABBA3 needs RTMB, which compiles C++ code: Rtools on Windows, the Xcode command-line tools on macOS.

Start

JABBA3App::run_app()

The app opens on Start here: what JABBA3 does, links, the workflow diagram and the steps of the app. The steps in the left panel are:

Step What happens
1 Data * load catch and indices, with a preview of each
2 Explore data data plots, common trend across indices, joint index
3 Model setup * Priors: life history → shape (Bmsy/K) → r → Hmsy → process error; K, starting biomass, status priors. Settings: starting point, lag, persistence, catch and observation error. Summary of the next run
Run model fit and save the run (up to six)
4 Model results * JABBA3 summary plot, fits, tables
5 Check the fit convergence, residuals, prior vs posterior, retrospective, hindcast
6 Compare runs runs side by side; ensembles
7 Stock status advice trajectories with Bthr and Blim; Kobe plot or biplot
8 Forecast projections, Kobe II matrix, harvest control rule and catch advice

jabba3app_templates("my_folder") copies the data and life-history templates, with Atlantic bigeye tuna example files.

Guides

Example data

Atlantic bigeye tuna (ICCAT), from the iccat dataset in JABBA3. Life-history values are the approximate bigeye biology given in the JABBA3 user guide (Selex chapter), which the guide describes as illustrative.

Files

  • R/: the package functions, run_app() and jabba3app_templates().
  • inst/app/app.R: the app’s entry point; inst/app/R/ one file per step (ui.R, helpers.R, guide.R, setup.R, explore.R, priors.R, model.R (Model setup), run.R, results.R, checks.R, compare.R, status.R, forecast.R).
  • inst/app/guide/app-guide.md: the app’s guide, also the article How the app works.
  • inst/app/templates/: data and life-history templates.
  • vignettes/, _pkgdown.yml, pkgdown/: the website; build with source("dev/build_site.R").