Learn R Programming

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

r4ss

R code for Stock Synthesis

Stock Synthesis is a fisheries stock assessment model written in ADMB by Dr. Rick Methot at the NOAA Northwest Fisheries Science Center. The R code in the r4ss package is based on the original work of Dr. Ian Stewart begun around 2005 and released as an open source R package on CRAN in 2009. The package has benefited from contributions, suggestions, and bug reports from many collaborators and users.

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 latest r4ss version on CRAN can be installed using a command like

install.packages("r4ss")

To get notifications about r4ss, you can watch this GitHub project and/or join the r4ss email list: https://groups.google.com/forum/#!forum/r4ss

Additional information about r4ss at the old Google Code page, https://code.google.com/p/r4ss/, will be migrated over to GitHub in the future.

More frequent enhancements and bug fixes are posted to this GitHub project. The latest version of r4ss can be installed directly from Github at any time via the devtools package in R with the following commands:

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

Note: devtools will 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.

Once you have installed the r4ss package, it can be loaded in the regular manner:

library(r4ss)

Changes

See NEWS.md for log of changes, starting with v1.24.0.

On January 15th, 2015 and included in CRAN submission of v1.24.0, a variety of changes that were in a branch on this GitHub site have now been merged into the main code. If anything doesn't work for you, you can install an earlier version from GitHub using the devtools command:

devtools::install_github("r4ss/r4ss", ref="v1.22.1")

Changes include

  • new growth plots that facilitate comparison of mean growth to variability in growth and mean growth with maturity
  • new composition plots that show females, males, and unsexed fish in the same plot
  • automatic generation of data-weighting plots contributed by Chris Francis
  • a variety of other minor refinements

Some of these things surely won't work right for any particular model configuration. If so, please email Ian Taylor or post an "issue" on this GitHub site at https://github.com/r4ss/r4ss/issues

Copy Link

Version

Install

install.packages('r4ss')

Monthly Downloads

342

Version

1.24.0

License

GPL-3

Maintainer

Ian Taylor

Last Published

December 23rd, 2015

Functions in r4ss (1.24.0)

SSplotComps

Plot composition data and fits.
SS_readdat

read data file
SS_makedatlist

make a list for SS data
SS_fitbiasramp

Estimate bias adjustment for recruitment deviates
SS_readctl

read control file
SS_write_length.fit

Write length.fit file to be used by the MFCL length-comp viewer.
SSplotMovementMap

Show movement rates on a map.
SSplotMnwt

Plot mean weight data and fits.
SSplotProfile

Plot likelihood profile results
SS_output

A function to create a list object for the output from Stock Synthesis
read.admbFit

Read ADMB .par and .cor files.
SSplotRecdevs

Plot recruitment deviations
make_multifig

Create multi-figure plots.
PinerPlot

Make plot of likelihood contributions by fleet
SSplotTimeseries

Plot timeseries data
rich.colors.short

Make a vector of colors.
SS_profile

Run a likelihood profile in Stock Synthesis.
SS_changepars

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

visualize parameterization of cubic spline selectivity in SS
SS_doRetro

Run retrospective analyses
SS_readstarter

read starter file
SSplotMCMC_ExtraSelex

Plot uncertainty around chosen selectivity ogive from MCMC.
SS_writectl

write control file
movepars

Explore movement parameterizations in a GUI
r4ss-package

R tools for Stock Synthesis
SS_RunJitter

Iteratively apply the jitter option in SS
SSplotData

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

Make plots from Rebuilder program
SSsummarize

Summarize the output from multiple Stock Synthesis models.
SSplotBiology

Plot biology related quantities.
r4ss_logo

Make a simple logo for r4ss organization on GitHub
SSMethod.TA1.8

Apply Francis composition weighting method TA1.8
SS_splitdat

Split apart bootstrap data to make input file.
SSplotSpawnrecruit

Plot spawner-recruit curve.
mcmc.out

Summarize, analyze and plot key MCMC output.
SStableComparisons

make table comparing quantities across models
sel.line

a function for drawing selecitivity curves
SSgetoutput

Get output from multiple Stock Synthesis models.
SSplotSelex

Plot selectivity
SSplotDiscard

Plot fit to discard fraction.
SSplotPars

Plot distributions of priors, posteriors, and estimates.
SS_recdevs

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

Plot catch related quantities.
SS_writestarter

write starter file
SSplotCohorts

Plot cumulative catch by cohort.
stackpoly

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

plot model comparisons
SSplotIndices

Plot indices of abundance and associated quantities.
mountains

Make shaded polygons with a mountain-like appearance
getADMBHessian

Read admodel.hes file
selfit

A function to visual parameterization of double normal and double logistic selectivity in Stock Synthesis
SSplotSummaryF

Plot the summary F (or harvest rate).
SS_plots

plot many quantities related to output from Stock Synthesis
SS_parlines

Get parameter lines from Stock Synthesis control file
plotCI

Plot points with confidence intervals.
SSplotMovementRates

Plot movement rates from model output
addSSsummarize

Add a model to the list of models to compare
SSplotRecdist

Plot of recruitment distribution among areas and seasons
SSplotYield

Plot yield and surplus production.
SSplotTags

Plot tagging data and fits
bubble3

Create a bubble plot.
TSCplot

Create a plot for the TSC report
SSplotSPR

Plot SPR quantities.
SS_writeforecast

write forecast file
SS_readforecast

read forecast file
mcmc.nuisance

Summarize nuisance MCMC output
update_r4ss_files

Old function to updates r4ss files, deprecated in favor of devtools method
SSmakeMmatrix

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

Read MCMC output.
SSbootstrap

Fit models to parametric bootstraps
SSplotRetroRecruits

Make squid plot of retrospectives of recruitment deviations.
IOTCmove

Make a map of movement for a 5-area Indian Ocean model
SSMethod.Cond.TA1.8

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

Create HTML files to view figures in browser.
SSFishGraph

A function for converting Stock Synthesis output to the format used by FishGraph
SS_varadjust

Modify variance and sample size adjustments in the control file
SS_writedat

write data file
SS_ForeCatch

Create table of fixed forecast catches
SSplotNumbers

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

Perform SS implementation of Laplace Approximation