Learn R Programming

sspm

The goal of sspm is to implement a gam-based spatial surplus production model, aimed at modeling northern shrimp population in Canada but potentially to any stock in any location. The package is opinionated in its implementation of SPMs as it internally makes the choice to use penalized spatial gams with time lags based on Pedersen et al. (2020). However, it also aims to provide options for the user to customize their model.

Installation

You can install the released version of sspm from CRAN with:

install.packages("sspm")

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("pedersen-fisheries-lab/sspm")
# if you wish to build the vignettes:
devtools::install_github("pedersen-fisheries-lab/sspm", build_vignettes = TRUE)

Purpose

The sspm package follows a strict workflow, where spatial boundaries need to be defined and discretized into patches, so that we can apply a spatial GAM to the data. You can either use of of our built in methods for discretization or implement your own. Below is an example of a discretized set of patches:

Then, we provide a framework to ingest trawling and fishing data, and smoothing the model spatially:

Finally, the package allows for calculating the surplus production on a yearly basis, and model the impact of different variables on that productivity. You can then produce one step ahead predictions for the biomass.

For an overview of the package design, please see our workflow diagram.

Getting started

See the example vignette for an introduction to the sspm workflow.

browseVignettes("sspm")

See also

sspm is opinionanted in its workflow and its use of GAMS, but other frameworks exist to make use of surplus production models (usually not in spatial capacity, however):

Issues and support

If you have found an issue with this package or are seeking support, open an issue on this repository describing the problem and including a minimal reproducible example.

Cite this package

You can cite this package like this “we ran a spatial surplus production model using the the R package sspm (Lucet & Pedersen 2022)”. Here is the full bibliographic reference to include in your reference list (publication pending, don’t forget to update the ‘last accessed’ date):

Lucet, V., E. Pedersen (2022). The sspm R package: spatial surplus production models for the management of northern shrimp fisheries. The Journal of Open Source Software (https://joss.theoj.org/papers/10.21105/joss.04724)

Or see the package citation page.

Code of Conduct

Please note that the sspm project is released with a Contributor Code of Conduct.](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html).) By contributing to this project, you agree to abide by its terms.

Copy Link

Version

Install

install.packages('sspm')

Monthly Downloads

138

Version

1.1.0

License

MIT + file LICENSE

Maintainer

Valentin Lucet

Last Published

December 3rd, 2025

Functions in sspm (1.1.0)

plot

Plot sspm objects
smooth_time

sspm Smoothing functions
spm

Fit an SPM model
map_formula

Map model formula onto a sspm_dataset object
spm_aggregate

Aggregate a dataset or fit data variable based on a boundary
spm_smooth_methods

Get the list of available smoothing methods
%>%

Pipe operator
sspm_discrete_boundary-class

sspm discrete boundary structure
sspm_fit-class

sspm fit
spm_split

Split data in test and train sets
spm_smooth

Smooth a variable in a sspm dataset
spm_methods

Get the list of available discretization methods
spm_lag

Create lagged columns in a sspm smoothed data slot
spm_discretize

Discretize a sspm model object
sspm-class

sspm model class
spm_name

Accessing OR replacing sspm model elements
sspm_dataset-class

sspm dataset structure
sspm_boundary-class

sspm boundary structure
spm_aggregate_catch

Update biomass value from catch adta
spm_as_boundary

Create a sspm_boundary object
sfa_boundaries

SFA boundaries data
spm_as_dataset

Create a sspm_dataset dataset structure
sspm_formula-class

sspm formula object
summary

Summarises sspm_fit objects
sspm-package

sspm: Spatial Surplus Production Model Framework for Northern Shrimp Populations
sspm

Create a sspm model object
triangulate_delaunay

Perform delaunay triangulation
tesselate_voronoi

Perform voronoi tesselation
spm_unique_ID,sspm_fit-method

Accessing OR replacing sspm_fit model elements
spm_data

Accessing OR replacing sspm_dataset model elements
spm_boundaries,sspm_boundary-method

Accessing OR replacing sspm_boundary model elements
discretization_method-class

sspm discretization method class
catch_simulated

Simulated catch data
method_func

Accessing OR replacing discretization_method model elements
$,sspm_boundary-method

Extract methods
raw_formula

Accessing OR replacing sspm_formula model elements
as_discretization_method

Cast into a discretization_method object
borealis_simulated

Simulated biomass data
fit_smooths

Fit the GAM part of a sspm model
predict

Predict with a SPM model
predict_intervals

GAM confidence and prediction intervals
predator_simulated

Simulated predator data