The R package spmR was developed for doing stock projections for
groundfish at the AFSC. The model was coded using Automatic
Differentiation Model Builder (ADMB).
The main projection model is inst/admb/spm.tpl. A
model run requires spm.dat, tacpar.dat, and a species-specific file
containing assessment outputs. The examples directory
contains complete example inputs and outputs. ADMB 13.0 or newer is
required to compile the model.
spm.tpl was updated between 2021 and 2024 such that for sex-specific models, average recruitment is assumed to be input for a single sex, and is then multiplied by 2 within the code. Previous versions of spm.tpl (including main.tpl and proj.tpl) assume that recruitment is added across sexes for model inputs. Here is the change:
if (nsexes(ispp)==1)
AMeanRec(ispp) = mean(R(ispp)); // Arithmetic mean
else
AMeanRec(ispp) = 2.*mean(R(ispp)); // Arithmetic mean, converted to
females (half) later
// AMeanRec(ispp) = mean(R(ispp)); // Arithmetic mean, converted to
females (half) later
The supported exported functions are:
dat2list()list2dat()as_spm_result()runSPM()plotSPM()plotSPMx()tier3_scenario_table()
The R package spmR lives on a public 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:
git clone https://github.com/afsc-assessments/spmRThere are several options for installing the spmR R package.
The spmR package can be installed from within R using:
devtools::install_github(repo = "afsc-assessments/spmR", dependencies = TRUE,
build_vignettes = TRUE, auth_token = "your_PAT")The GitHub repository can be cloned to your computer and the package installed from the command line. From Linux this would involve:
git clone https://github.com/afsc-assessments/spmR
R CMD INSTALL spmRThis time from within R using:
devtools::install("spmR")Help for all spmR 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:
?runSPM
?plotSPM
?dat2listAlternatively, to see a list of all available functions and data sets use:
help(package = "spmR")The package vignettes are a great place to see what spmR can do. You
can view the package vignettes from within R using:
browseVignettes(package = "spmR")
vignette(topic = "spm_example", package = "spmR")All of the vignettes and the help pages for each function are bundled together and published on the website https://afsc-assessments.github.io/spmR/.
Developers will want to do things slightly differently. See the
Model development vignette.
NOAA: National Oceanic and Atmospheric Administration
NMFS: National Marine Fisheries Service
AFSC: Alaska Fisheries Science Center
REFM: Resource and Ecology and Fisheries Management
This repository is a software product and is not official communication of the National Oceanic and Atmospheric Administration (NOAA), or the United States Department of Commerce (DOC). All NOAA GitHub project code is provided on an ‘as is’ basis and the user assumes responsibility for its use. Any claims against the DOC or DOC bureaus stemming from the use of this GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation, or favoring by the DOC. The DOC seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by the DOC or the United States Government.