Southern bluefin roam,
Data rich as ocean tides—
Code unlocks their truth.
Introduction
The R package sbt was developed for doing stock assessments of southern bluefin tuna (SBT) for the Commission for the Conservation of Southern Bluefin Tuna (CCSBT).
The sbt model was coded using the RTMB package which provides an R interface (R Core Team 2024) for Template Model Builder (TMB), avoiding the need to code in C++ (Kristensen et al. 2016). The sbt model is bespoke to SBT: it is age structured, with two seasons per year, and one region. Six fisheries are defined using an area as fleets approach and time varying selectivity is defined for some of these fisheries.
Frequentist inference can be done using the R package nlminb and Bayesian inference can be done using the R package SparseNUTS (Monnahan et al. 2026). The help pages for the sbt package can be found on the sbt website (https://www.quantifish.co.nz/sbt/). The Get started and Articles tabs on the website are the best place to see what sbt can do.
The fish in the sbt logo was painted by Joanne Webber (https://www.joannewebber.co.nz).
Installation
There are several options for installing the sbt R package. The GitHub repository is private, so you need GitHub access to quantifish/sbt and a personal access token (PAT) stored in your Git credentials before installing directly from GitHub.
Option 1: install from GitHub
Set up GitHub credentials once:
install.packages(c("remotes", "usethis", "gitcreds"))
usethis::create_github_token()
gitcreds::gitcreds_set()Then install sbt from within R:
remotes::install_github(repo = "quantifish/sbt", dependencies = TRUE)Do not paste a PAT directly into analysis scripts. Storing it once with gitcreds::gitcreds_set() lets remotes, git, and RStudio use the same credential without exposing it in code.
Option 2: clone then install
The sbt package is available in a private GitHub repository. The repository can be cloned to your computer from the command line or using a user interface. From the command line using Linux, the repository can be cloned using:
After cloning the repository, the sbt package can be installed from within R using:
devtools::install("sbt")or from the command line using:
Option 3: install from a local source file
If you have the sbt package downloaded on your local machine as a zip or tar.gz file, you can install it using the install.packages() function passing in the path where the zip file is saved, setting repos = NULL and type = source. For example:
install.packages("sbt_1.0.0_R_x86_64-pc-linux-gnu.tar.gz", repos = NULL,
type = "source")Help
Help for all sbt functions and data sets can be found on the R help pages associated with each function and data set. Help for a specific function can be viewed using ?function_name, for example:
?get_weight_at_age
?plot_cpueAlternatively, to see a list of all available functions and data sets use:
help(package = "sbt")