Learn R Programming

⚠️There's a newer version (1.44.0) of this package.Take me there.

r4ss: R code for Stock Synthesis

(master) (development)

Stock Synthesis is a fisheries stock assessment model written in ADMB by Rick Methot. The Stock Synthesis software and many other associated materials are available on the NOAA Virtual Laboratory at https://vlab.ncep.noaa.gov/web/stock-synthesis/home. The r4ss package is a collection of R functions for interacting with Stock Synthesis. It is based on the original work of Ian Stewart begun around 2005 and released as an open source R package in 2009. The package has a long list of authors and has benefited from a large community of users making suggestions and reporting issues.

Code available on this website comes with no warranty or guarantee of accuracy. It merely represents an ongoing attempt to integrate output plotting, statistics and diagnostics. It is absolutely necessary that prior to use with a new application, the user checks the output manually to verify that there are no plotting or statistical bugs which could incorrectly represent the output files being analyzed.

Installation

The version of r4ss on CRAN is currently out of date. Therefore, installing directly from GitHub is recommended. This requires installing the devtools package first.

install.packages("devtools")
devtools::install_github("r4ss/r4ss")

Note: devtools may give this message: "WARNING: Rtools is required to build R packages, but is not currently installed." However, Rtools is NOT required for installing r4ss via devtools, so ignore the warning.

Ongoing development of r4ss has been mostly taking place in the "Development" branch on GitHub. That branch may be less stable, but can provide fixes, especially to issues related to beta releases of new SS versions. The development branch can be installed using the command:

devtools::install_github("r4ss/r4ss", ref="development")

Once you have installed the r4ss package, it can be loaded using:

library(r4ss)

To get notifications about r4ss, you can watch this GitHub project or follow messages on the forums on Stock Synthesis VLab (account required).

There is now a basic Vignette, which can be viewed at https://github.com/r4ss/r4ss/blob/master/vignettes/r4ss-intro-vignette.Rmd or built locally on your computer using this command to install the package:

devtools::install_github("r4ss/r4ss", build_vignettes = TRUE)

Changes

See NEWS.md for a (not very complete) log of changes to r4ss, starting with r4ss v1.24.0 from 2014. The list of commits at https://github.com/r4ss/r4ss/commits/master provides a much more detailed list.

Reporting problems

Please report any issues with this package by posting a new github issue at https://github.com/r4ss/r4ss/issues. You can also write to Ian.Taylor@noaa.gov.

Copy Link

Version

Install

install.packages('r4ss')

Monthly Downloads

342

Version

1.36.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Ian Taylor

Last Published

October 18th, 2019

Functions in r4ss (1.36.1)

PinerPlot

Make plot of likelihood contributions by fleet
SSMethod.Cond.TA1.8

Apply Francis composition weighting method TA1.8 for conditional age-at-length fits
SS_recdevs

Insert a vector of recruitment deviations into the control file.
SS_makeHTMLdiagnostictable

Make html diagnostic tables
SSexecutivesummary

A function to create a executive summary tables from an SS Report.sso file
SS_readwtatage

Read weight-at-age data file
SS_html

Create HTML files to view figures in browser.
SSgetMCMC

Read MCMC output.
SS_doRetro

Run retrospective analyses
SS_fitbiasramp

Estimate bias adjustment for recruitment deviates
SSplotComparisons

plot model comparisons
SSplotCohortCatch

Plot cumulative catch by cohort.
SS_readctl

read control file from SS
SS_RunJitter

Iteratively apply the jitter option in SS
SS_readdat_2.00

read data file from SS version 2.00
SS_readdat_3.00

read data file from SS version 3.00
SS_writedat_3.30

write data file for SS version 3.30
SS_writeforecast

write forecast file
SS_readctl_3.24

read control file from SS version 3.24
DoProjectPlots

Make plots from Rebuilder program
NegLogInt_Fn

Perform SS implementation of Laplace Approximation
SSplotMovementMap

Show movement rates on a map.
SS_ForeCatch

Create table of fixed forecast catches
SSMethod.TA1.8

Apply Francis composition weighting method TA1.8
SS_changepars

Change parameters, bounds, or phases in the control file.
SS_parlines

Get parameter lines from Stock Synthesis control file
SS_plots

plot many quantities related to output from Stock Synthesis
SS_readdat

read Stock Synthesis data file
SS_readctl_3.30

read control file from SS version 3.30
SS_read_summary

read ss_summary file
SS_profile

Run a likelihood profile in Stock Synthesis.
SSplotMovementRates

Plot movement rates from model output
SS_readdat_3.24

read data file from SS version 3.24
SS_makedatlist

make a list for SS data
SS_varadjust

Modify variance and sample size adjustments in the control file
SSplotAgeMatrix

Plot matrix of either length or observed age at true age
SSplotMCMC_ExtraSelex

Plot uncertainty around chosen selectivity ogive from MCMC.
SS_writectl

Srite Stock Synthesis control file
SSplotSPR

Plot SPR quantities.
SSmohnsrho

Calculate Mohn's Rho values for select quantities
SSplotSelex

Plot selectivity
SSplotMnwt

Plot mean weight data and fits.
SS_readdat_3.30

read data file from SS version 3.30
SS_splitdat

Split apart bootstrap data to make input file.
SSplotData

Timeline of presence/absence of data by type, year, and fleet.
SSplotComps

Plot composition data and fits.
SS_writectl_3.30

write control file for SS version 3.30
SS_writestarter

write starter file
SS_writewtatage

Write weight-at-age file
SS_writectl_3.24

write control file
SS_tune_comps

Calculate new tunings for length and age compositions
SSplotRecdist

Plot of recruitment distribution among areas and seasons
SSsummarize

Summarize the output from multiple Stock Synthesis models.
SSplotRetroRecruits

Make squid plot of retrospectives of recruitment deviations.
SSmakeMmatrix

Convert a matrix of natural mortality values into inputs for Stock Synthesis
SSgetoutput

Get output from multiple Stock Synthesis models.
plotCI

Plot points with confidence intervals.
r4ss-package

R tools for Stock Synthesis
SStimeseries

A function to create a time-series table from an SS Report.sso file
SStableComparisons

make table comparing quantities across models
SSunavailableSpawningOutput

Plot unavailable spawning output
SSplotBiology

Plot biology related quantities.
SSplotCatch

Plot catch related quantities.
SS_output

A function to create a list object for the output from Stock Synthesis
rich.colors.short

Make a vector of colors.
SS_readforecast

read forecast file
selShapes

A Shiny app that displays various selectivity curves given parameters that would be input into SS
SS_readstarter

read starter file
SSplotSexRatio

Plot sex-ratio data and fits for two sex models
SSplotSpawnrecruit

Plot spawner-recruit curve.
make_multifig

Create multi-figure plots.
SS_writedat_3.24

write data file for SS version 3.24
getADMBHessian

Read admodel.hes file
SS_writedat

write Stock Synthesis data file
SSbiologytables

A function to create a table of biology for assessment reporting: length, weight, % mature, fecundity, and selectivity
TSCplot

Create a plot for the TSC report
SSplotTimeseries

Plot timeseries data
SSplotPars

Plot distributions of priors, posteriors, and estimates.
SSplotYield

Plot yield and surplus production.
SSplotNumbers

Plot numbers-at-age related data and fits.
SSbootstrap

Fit models to parametric bootstraps
bubble3

Create a bubble plot.
mcmc.out

Summarize, analyze and plot key MCMC output.
SSplotIndices

Plot indices of abundance and associated quantities.
SSplotRecdevs

Plot recruitment deviations
SSplotDiscard

Plot fit to discard fraction.
SSplotSummaryF

Plot the summary F (or harvest rate).
SSplotProfile

Plot likelihood profile results
SSplotTags

Plot tagging data and fits
mountains

Make shaded polygons with a mountain-like appearance
stackpoly

modified from "stackpoly" by Jim Lemon from "plotrix" package
make_multifig_sexratio

Create multi-figure sex ratio plots.
mcmc.nuisance

Summarize nuisance MCMC output
read.admbFit

Read ADMB .par and .cor files.
r4ss_logo

Make a simple logo for r4ss organization on GitHub