Elsevier

Fisheries Research

Volume 239, July 2021, 105924
Fisheries Research

Beyond visualizing catch-at-age models: Lessons learned from the r4ss package about software to support stock assessments

https://doi.org/10.1016/j.fishres.2021.105924Get rights and content

Abstract

Stock assessment analysts are exploring an increasingly diverse and complex range of models while also facing higher expectations for consistency, documentation, and transparency in reports and management advice, all within a tight timeline. Meeting these goals requires increased efficiency at all steps in the assessment process from data processing, through model development and selection, to report writing and review. Here, we describe one widely used tool that has proven successful in increasing the efficiency of the assessment process: the r4ss package, which supports the use of the Stock Synthesis modeling framework. What began 15 years ago as a tool to provide simple model diagnostics, including plots showing data and model results, has grown into a large collection of R functions to support many aspects of the assessment process. We provide an overview of the r4ss features and illustrate its utility with examples from recent applications. Finally, we discuss lessons learned from the ongoing development of r4ss that can be applied to similar efforts associated with the next generation of stock assessment packages.

Introduction

Assessment of fish stocks (hereafter referred to as “stocks”) is a necessary task, largely because of mandates by federal and regional governing bodies to provide information about stock status and apply harvest control rules to inform catch limits under harvest policies. While incorporating disparate data sources into a single population model (integrated analysis) to determine stock status is routine, understanding the fit to each data set and its associated influence on the model results can be challenging (Maunder and Punt, 2013; Maunder and Piner, 2015). A standardized set of visualization tools is key to providing understanding and transparency throughout this process for stock assessment analysts, reviewers, stakeholders, and managers. For example, standardized tools allow analysts to quickly understand model results and explore new model configurations during the model development and peer review processes; reviewers scrutinize the analyses and investigate other alternatives with the aid of visualization tools, ultimately deciding if the assessment results are appropriate for use by management; and lastly, stakeholders and managers need to understand the model results, and hence, need intuitive visualization tools to inform the range of management options and decide on which management measures to take.

Visualization tools can aid analysts throughout the assessment process. For example, Richards et al. (1997) found while developing a stock assessment for Pacific ocean perch (Sebastes alutus) that visualization tools allowed them to better understand their data sets and pinpoint data features that needed to be accommodated, develop a statistical catch-at-age model well suited to the data sets, and evaluate model output more thoroughly. Stock assessments often require hundreds of model runs. Tools for quickly visualizing model results allow analysts to more efficiently select among them. As an illustration of the power of automated workflows and visualization tools, calculating residuals by hand would take hours, while visualizing patterns in residuals already plotted can take just minutes. Visualization tools can also relieve the feeling of being time-poor when conducting stock assessments (Bentley, 2015). Aside from efficiency, a thorough and standardized set of tools for visualizing model output can help catch errors such as misspecified models and aid in the report writing process, as most stock assessment reports require numerous figures and tables.

The peer review process for stock assessments (e.g., Brown et al., 2020), to determine if assessment results can be used by management bodies for decision making, benefits from visualization tools. For example, Regular et al. (2020) found that interactive data and model dashboards improved their ability to communicate with stakeholders during the stock assessment review process for a northern cod stock in the northwest Atlantic. Producing standardized figures across assessments increases ease of understanding for readers and simplifies comparisons across assessments. Often, peer reviewers are tasked with evaluating modeling decisions and model results, ultimately deciding if the assessment results are appropriate for use by management. Requests for visualizations made during assessment review processes are often expected in subsequent reviews, especially if the same reviewers may be engaged in the future, and should be added to assessment analyst toolboxes, such that they can be better prepared for future reviews. Thus, this toolbox grows with each review and helps facilitate efficient reviews, because analysts are able to quickly produce desired output before it is asked for.

The Terms of Reference (ToR) for stock assessment reviews have also coevolved with visualization tools, increasing the value of standardization. For instance, 10 years ago the ToR for groundfish stock assessments conducted for the Pacific Fishery Management Council (PFMC, 2009) had an eight-point bulleted list of general stock assessment team deliverables, while the ToR used in 2019 (PFMC 2019) had a checklist of 74 elements within 18 sections with more specificity. These ToR changes have been driven in part by feedback from reviewers seeing the benefit of new visualizations and diagnostics for individual assessments as described above. The ToR changes, in turn, lead to wider adoption of the new approaches for analysts working to meet them, a shift which is easier when the analysts can use shared tools to meet the new standards.

Effectively translating complicated assessment models and results into an easily digestible form for fishery managers and stakeholders can be challenging, especially when presenting information across a large range of stocks (Dichmont et al., 2016). Presenting assessment results in a consistent manner across stocks can lessen the communication challenge, allowing for improved discussions between analysts, stakeholders, and managers. The development and application of an assessment toolbox for use by analysts facilitates this process without creating additional workload.

Communication methods for stock assessment results are not a frequent topic in fisheries science journals, but it is an area where new ideas are rapidly developing and which deserves greater prominence in the literature. The widespread adoption of the generalized integrated analysis platform Stock Synthesis (SS, Methot and Wetzel, 2013) provided an opportunity to develop a standardized set of visualization and automation tools, given a larger pool of potential applications, users, and contributors (Punt and Maunder, 2013). Here, we discuss how r4ss, an R package containing tools for working with SS models, has improved the stock assessment development and review processes for individual analysts, reviewers, and managers over its 15 years of active development. We also highlight lessons learned from developing and using r4ss that could be applied when developing new visualization tools for a new stock assessment modeling platform.

The r4ss package grew organically from a single code script written by a single author in 2005 for use in the R statistical programming language (R Core Team, 2020) to a large open-source R package with many contributors. Before r4ss was developed, the typical workflow for SS users was examining the output text files directly or importing them into Excel where figures were generated using Visual Basic scripts or created manually for each model. The figures were time-consuming to create, had limited reproducibility, and did not provide reviewers and managers with a consistent product with which they could become familiar as modifications for an individual model were rarely generalized for the benefit of other models. The original r4ss R script became widely used by the stock assessment team at the National Oceanic and Atmospheric Administration (NOAA) Northwest Fisheries Science Center (NWFSC) and grew in complexity as members of the assessment team provided suggestions for additions. The increase in use also increased the burden associated with maintaining the code, and in 2008 the lead developer role was shifted to a postdoctoral researcher which allowed for more directed development, facilitating the growth and use of the code to function across SS-assessed stocks. Shortly thereafter, the code was put under version control and released as open source to facilitate distribution and development, to increase transparency, and to reduce the burden of maintenance on any individual developer.

Although, in the early years of its development, most of the code was written by just two people, feedback from users was essential to improving the package. In particular, conversations with participants at the annual Inter-American Tropical Tuna Commission (IATTC) Stock Assessment Workshop series (since succeeded by the Center for the Advancement of Population Assessment Methodology workshops) led to significant steps forward in the project. The initial public release of r4ss took place during the 2008 IATTC workshop (Maunder, 2008); discussions at the 2009 workshop inspired the conversion of the script into a formal R package available on the Comprehensive R Archive Network (CRAN); and a demonstration of the Javascript viewer for Multifan-CL (SPC, 2010) associated with the 2011 workshop led to the development of an HTML viewer for r4ss plots. Formatting the r4ss script as an R package brought the benefits of structured documentation for each function; making the r4ss package available on CRAN made it easier to find and install (as CRAN is the first source most users will look to for R packages). The number of authors, all of whom have made substantial code contributions, has also grown from five in 2009 to 29 in 2020. The methods used to incorporate code into the r4ss codebase have also evolved from contributors emailing files to the lead developer, to GitHub pull requests that get automatically checked and manually reviewed before merging. Although the development workflow has grown more sophisticated, the organic evolution of r4ss leaves many legacy aspects of the code and package structure, which are typical of research software (Ram et al., 2019), but would be designed differently if starting from scratch today.

The r4ss package (github.com/r4ss/r4ss) includes functions designed to work with SS input and output files (Supplement 1). The main types of functions in the package are: 1) functions to read and plot information from SS output files to visualize model results; 2) functions to automate tasks associated with SS models that are routinely performed; and 3) functions to read, create or modify SS input files. In the examples, we will focus on functions to visualize model results and automate routine tasks.

Section snippets

Multimodel management (Pacific halibut)

The Pacific halibut (Hippoglossus stenolepis) stock assessment comprises four individual models which are used to create an ensemble for management use by the International Pacific Halibut Commission (IPHC; Stewart and Martell, 2015; Stewart and Hicks, 2018). Each of the models represent a different hypothesis regarding the best approach for modeling the stock dynamics. The four models vary in the length of the modeled period, the level of data aggregation, and data-weighting, among other

Collective experience of the authors

In addition to the examples above, r4ss has facilitated the formalization of many assessment authors’ “tips and tricks” for efficiently building, diagnosing, and reporting stock assessment models. Sharing of collective experience reduces the learning curve for new assessment authors and also provides structure to remind experienced authors of perennial pitfalls. This section reports a series of problems that we the authors have collectively encountered across a large number of individual stock

Discussion

Software packages are often described as black boxes (Dichmont et al., 2016) and fitting models to data has previously been described as an art rather than a science because of numerous non-trivial choices in the model development process (e.g., how to specify the model, how to weight the data). Fortunately, stock assessment scientists are formally trained in at least either model development or model fitting, helping to ensure that results fulfill mandates to provide the best available

CRediT authorship contribution statement

Ian G. Taylor: Conceptualization, Software, Writing - original draft, Writing - review & editing. Kathryn L. Doering: Conceptualization, Software, Writing - original draft, Writing - review & editing. Kelli F. Johnson: Conceptualization, Software, Writing - original draft, Writing - review & editing. Chantel R. Wetzel: Conceptualization, Software, Writing - original draft, Writing - review & editing. Ian J. Stewart: Conceptualization, Software, Writing - original draft, Writing - review &

Declaration of Competing Interest

The authors report no declarations of interest.

Acknowledgements

We thank Mark Maunder and Simon Hoyle for their role in organizing the IATTC and CAPAM workshops that have led to so much development of r4ss as well as our co-authors of the r4ss package: Z. Teresa A'mar, Sean C. Anderson, Andrew B. Cooper, LaTreese S. Denson, Robbie L. Emmet, Tommy M. Garrison, Andrea M. Havron, Allan C. Hicks, Watal M. Iwasaki, Neil L. Klaer, Gwladys I. Lambert, Carey R. McGilliard, Cole C. Monnahan, Iago Mosqueira, Kotaro Ono, André E. Punt, Megan M. Stachura, Christine C.

References (52)

  • S.C. Anderson et al.

    ss3sim: an R package for fisheries stock assessment simulation with Stock Synthesis

    PLoS One

    (2014)
  • S.C. Anderson et al.

    Reproducible visualization of raw fisheries data for 113 species improves transparency, assessment efficiency, and monitoring

    Fisheries

    (2020)
  • N. Bentley

    Data and time poverty in fisheries estimation: potential approaches and solutions

    ICES J. Mar. Sci.

    (2015)
  • E. Bocher et al.

    Geospatial Free and Open Source Software in the 21st Century

    (2012)
  • C. Boettiger et al.

    Building software, building community: lessons from the rOpenSci project

    J. Open Res. Softw.

    (2015)
  • L.D. Brown et al.

    Interval estimation for a binomial proportion

    Stat. Sci.

    (2001)
  • Carvalho, F., Winker, H., Courtney, D., Kapur, M., Kell, L., Cardinale, M., Schirripa, M., Kitakado, T., Yemane, D.,...
  • B. Fischhoff

    The sciences of science communication

    Proc. Natl. Acad. Sci. U.S.A.

    (2013)
  • D.A. Fournier et al.

    AD Model Builder: using automatic differentiation for statistical inference of highly parameterized complex nonlinear models

    Optim. Methods Softw.

    (2012)
  • R.C. Francis

    Data weighting in statistical fisheries stock assessment models

    Can. J. Fish. Aquat. Sci.

    (2011)
  • C.J. Grandin et al.

    Status of the Pacific Hake (whiting) Stock in U.S. And Canadian Waters in 2020

    (2020)
  • J. Hester

    Devtools 2.0.0

    (2018)
  • S. Hoyle et al.

    Status of yellowfin tuna in the eastern Pacific Ocean in 2004 and outlook for 2005

    Inter-American Tropical Tuna Commission Stock Assessment Report

    (2006)
  • W. Huber et al.

    Orchestrating high-throughput genomic analysis with Bioconductor

    Nat. Methods

    (2015)
  • IPHC

    Stock Assessment

    (2020)
  • S. Killcoyne et al.

    Managing chaos: lessons learned developing software in the life sciences

    Comput. Sci. Eng.

    (2009)
  • Cited by (11)

    • Implications of the maximum modelled age on the estimation of natural mortality when using a meta-analytic prior: The example of eastern Australian orange roughy (Hoplostethus atlanticus)

      2023, Fisheries Research
      Citation Excerpt :

      MCMC convergence was assessed by (i) examination of trace plots to identify autocorrelation and slow mixing, (ii) assessment of the stationarity of the chain using the Geweke statistic (Gelman et al., 2013) and (iii) determining whether the Heidelberger and Welch test (Heidelberger and Welch, 1981, 1983; Gelman et al., 2013) was passed or not. The R packages coda (Plummer et al., 2006) and r4ss (Taylor et al., 2021) were used to produce the plots and statistics. Eastern Australian orange roughy is managed by the Australian Fisheries Management Authority (AFMA) as a Tier 1 stock within the Australian Federal Government’s Southern and Eastern Scalefish and Shark Fishery (SESSF; Smith et al., 2008).

    • Investigating trends in process error as a diagnostic for integrated fisheries stock assessments

      2022, Fisheries Research
      Citation Excerpt :

      Our analysis on the Indian Ocean yellowfin is shown throughout the main manuscript and we also provide an overview of trends in recruitment deviates from all tropical tuna stocks in a summarized way in the main text and for each stock as Supplementary material. The recruitment deviates were extracted from Stock Synthesis files using r4ss (Taylor et al., 2021) a package that contains a collection of R functions (R Core Team, 2021) for interacting with Stock Synthesis. In the stock assessment, the recruitment deviates were estimated from the first quarter of 1972 to the last quarter of 2018 (the time from when the CPUE series starts to two years before the final year of the assessment).

    • A cookbook for using model diagnostics in integrated stock assessments

      2021, Fisheries Research
      Citation Excerpt :

      Similarly, there has been a recent increase in the use of Stock Synthesis for benchmark assessments in Europe in place of the conventionally used VPA with extended survivor analysis or the state-space catch-at-age models such as SAM (ICES, 2019). The visualization of model outputs and implementation of diagnostics for Stock Synthesis is facilitated by the R package r4ss (Taylor et al., 2021; github.com/r4ss/r4ss). For each technique, we point readers to relevant citations or source code.

    View all citing articles on Scopus
    View full text