ss3sim

An R package for stock-assessment simulation with Stock Synthesis

https://github.com/ss3sim/ss3sim

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    13 of 24 committers (54.2%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.7%) to scientific vocabulary

Keywords

fisheries r r-package simulation stock-synthesis

Keywords from Contributors

fisheries-stock-assessment interpretability standardization animal hack autograder report
Last synced: 10 months ago · JSON representation

Repository

An R package for stock-assessment simulation with Stock Synthesis

Basic Info
Statistics
  • Stars: 39
  • Watchers: 14
  • Forks: 29
  • Open Issues: 46
  • Releases: 4
Topics
fisheries r r-package simulation stock-synthesis
Created over 13 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License Codeowners

README.md

ss3sim

ss3sim is an R package that simplifies the steps needed to generate beautiful simulation output from the widely-used Stock Synthesis (SS3) assessment framework. To learn more, read on or check out the Introduction vignette on the ss3sim website.

Table of contents

Installation

Below are instructions for installing ss3sim from GitHub, which is the preferred approach. Users can use remotes, devtools, or pak to do this, though the example below is for the latter. "main" is the default branch with the latest code, all developmental features will be in feature branches.

Install the GitHub version via {pak}:

``` r

install.packages("pak")

pak::pkg_install("ss3sim/ss3sim") ```

The CRAN version of ss3sim is not regularly updated, and thus, it is not recommended to install from CRAN. We suggest using the GitHub version because it comes with the SS3 executable/binary. If you are using the CRAN version, you will need to install the binary and place it in your system path. See the SS3 Release page for an executable that will work on your operating system and the SS3 documentation for how to place the executable in your path.

Once ss3sim is installed, you can read the help files and access the Introduction vignette for reproducible examples of ss3sim. See below for code how to do both.

r ?ss3sim browseVignettes("ss3sim") vignette("introduction", "ss3sim")

Simulation setup

An ss3sim simulation requires three types of input:

  1. a base model of the underlying truth (an SS3 operating model; OM),
  2. an SS3 estimation method (EM) to assess the current status, and
  3. a data frame specifying how you want to manipulate (1) and (2) from their status-quo configurations.

You can find examples of an OM and EM on GitHub or locally on your machine if you have installed ss3sim. To find the location of these files locally, run system.file("extdata", "models", package = "ss3sim"). Users often modify these files to create new life histories or modify their own files from a production stock assessment to work within ss3sim. See the vignettes on modifying models and making models for more information.

An example data frame for (3) is also available within the package via ss3sim::setup_scenarios_defaults(). This example is sufficient to run a single scenario using the OM and EM supplied in the package. Many more options (i.e., columns) are possible and users should take note that this example provided in the package represents a minimum viable setup. Users can either create their own data frame in R or augment this existing data frame to run a set of custom scenarios. Specifically, adding columns will enable the manipulation of additional components of the OM, sampling procedure, or the EM. Adding rows will lead to more scenarios, where a scenario is the result of the combination of specifications in that row, i.e., how you manipulate the OM and the EM.

ss3sim stores each scenario in its own directory. Inside the scenario directory will be one directory per iteration. Iterations within a scenario differ only by the seed used within R to define the randomness of that iteration. See the figure below for an example directory structure from a simulation with two scenarios and 3 iterations.

text ├📁 scenario 1 │ ├📁 1 │ │ ├📁 OM │ │ └📁 EM │ ├📁 2 │ │ ├📁 OM │ │ └📁 EM │ └📁 3 │ ├📁 OM │ └📁 EM └📁 scenario 2 ├📁 1 │ ├📁 OM │ └📁 EM ├📁 2 │ ├📁 OM │ └📁 EM └📁 3 ├📁 OM └📁 EM

How ss3sim works

ss3sim works by converting information stored in the columns of your data frame that stores your simulation specifications (e.g., example_df_configuration) into function arguments. Functions within the ss3sim package use these arguments to manipulate the associated OM and EM files such that the appropriate simulated data is generated and used to fit the EM. For example, the first row of the simulation argument for the observation error of the index might be equal to 0.4 if you want a noisy survey

r example_df_configuration <- ss3sim::setup_scenarios_defaults() example_df_configuration[1, "si.sds_obs.2"] <- 0.4

ss3sim functions are divided into the following three types of functions:

  1. change and sample functions that manipulate SS3 configuration files. These manipulations generate the underlying "truth" (OMs) and control the assessment of the truth (EMs).
  2. run functions that conduct simulations. These functions generate a folder structure, call manipulation functions, run SS3 as needed, and save the output.
  3. get functions that synthesize the output.

Example output from a simulation

r data("scalar_dat", package = "ss3sim") p <- scalar_dat |> dplyr::mutate( M = ifelse(NatM_p_1_Fem_GP_1 == 0.2, "M = 0.2", "M = Estimated") ) |> dplyr::filter(model_run == "em") |> ggplot2::ggplot(ggplot2::aes(x = LnQ_base_Survey_2, y = depletion)) + ggplot2::geom_point() + ggplot2::facet_grid("M") + ggplot2::xlab("Survey scalar (q)") + ggplot2::ylab("Depletion") print(p)

You can run the code below to visualize the results of a simulation with two scenarios, one that fixed natural mortality (M) at its true value from the OM (M = 0.2) and one that estimated M. The upper panel shows how the estimates depletion change as the estimate of q changes for when M is fixed at the truth and the lower panel shows the same relationship when M is estimated.

Citing ss3sim

If you use ss3sim in a publication, please cite it as shown by

r citation("ss3sim") toBibtex(citation("ss3sim"))

Contributing to ss3sim

Interested in contributing to ss3sim? We recognize and appreciate that contributions come in many forms, including but not limited to writing code, reporting issues, and creating examples and/or documentation.

We strive to follow the NMFS Fisheries Toolbox Contribution Guide. We also have included ss3sim-specific code contribution information in the Developers page of the ss3sim wiki. Note that these are guidelines, not rules, and we are open to collaborations in other ways that may work better for you. Please feel free to reach out to us by opening an issue in this repository or by emailing the maintainer (run maintainer("ss3sim") in R to view the current maintainer's name and email address).

Note that contributors are expected to uphold the code of conduct.

Code of conduct

This project and everyone participating in it is governed by the NMFS Fisheries Toolbox Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to fisheries.toolbox@noaa.gov. Note that the maintainers of ss3sim do not have access to this email account, so unacceptable behavior of maintainers can also be reported here.

Disclaimer

"The United States Department of Commerce (DOC) GitHub project code is provided on an 'as is' basis and the user assumes responsibility for its use. DOC has relinquished control of the information and no longer has responsibility to protect the integrity, confidentiality, or availability of the information. Any claims against the Department of Commerce stemming from the use of its 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 Department of Commerce. The Department of Commerce 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 DOC or the United States Government."

U.S. Department of Commerce | National Oceanographic and Atmospheric Administration | NOAA Fisheries

Owner

  • Name: ss3sim
  • Login: ss3sim
  • Kind: organization

GitHub Events

Total
  • Issues event: 6
  • Delete event: 2
  • Issue comment event: 42
  • Push event: 24
  • Pull request review event: 2
  • Pull request review comment event: 2
  • Pull request event: 4
  • Fork event: 4
  • Create event: 1
Last Year
  • Issues event: 6
  • Delete event: 2
  • Issue comment event: 42
  • Push event: 24
  • Pull request review event: 2
  • Pull request review comment event: 2
  • Pull request event: 4
  • Fork event: 4
  • Create event: 1

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 3,337
  • Total Committers: 24
  • Avg Commits per committer: 139.042
  • Development Distribution Score (DDS): 0.485
Past Year
  • Commits: 14
  • Committers: 6
  • Avg Commits per committer: 2.333
  • Development Distribution Score (DDS): 0.429
Top Committers
Name Email Commits
Sean Anderson g****b@s****a 1,719
kellijohnson k****n@g****m 712
k-doering k****g@n****v 261
colemonnahan m****c@u****u 171
Kotkot k****o@u****u 153
kellijohnson-NOAA k****n@n****v 122
murad17 m****7@u****u 80
cstawitz c****z@u****u 44
fhurtado f****o@u****u 22
mrudd m****d@g****m 15
github-actions[bot] 4****] 10
peterkuriyama p****m@u****u 9
okenk k****n@n****v 3
amazon-q-developer[bot] 2****] 2
Elizabeth Gugliotti e****i@n****v 2
unknown p****m@F****u 2
Sean Anderson s****n@S****l 2
Kelli.Johnson 1****0@m****l 2
Ian Taylor i****r@n****v 1
Robert Wildermuth r****m@u****u 1
careymcg c****g@u****u 1
juanlvalero j****o@g****m 1
Kelli.Johnson 1****2@m****l 1
kinmic 1****c 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 292
  • Total pull requests: 134
  • Average time to close issues: 5 months
  • Average time to close pull requests: 6 days
  • Total issue authors: 25
  • Total pull request authors: 19
  • Average comments per issue: 3.27
  • Average comments per pull request: 1.49
  • Merged pull requests: 117
  • Bot issues: 0
  • Bot pull requests: 31
Past Year
  • Issues: 4
  • Pull requests: 6
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 1 month
  • Issue authors: 2
  • Pull request authors: 5
  • Average comments per issue: 1.75
  • Average comments per pull request: 6.67
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 2
Top Authors
Issue Authors
  • seananderson (91)
  • kellijohnson-NOAA (80)
  • colemonnahan (51)
  • k-doering-NOAA (26)
  • ChristineStawitz-NOAA (7)
  • cstawitz (5)
  • iantaylor-NOAA (5)
  • fhurtado (4)
  • chamberlindw (3)
  • Kotkot (2)
  • kinmic (2)
  • peterkuriyama (2)
  • okenk (1)
  • sungli211 (1)
  • merrillrudd (1)
Pull Request Authors
  • github-actions[bot] (33)
  • kellijohnson-NOAA (28)
  • k-doering-NOAA (23)
  • colemonnahan (13)
  • seananderson (9)
  • Kotkot (7)
  • merrillrudd (6)
  • okenk (6)
  • cstawitz (4)
  • peterkuriyama (2)
  • ChristineStawitz-NOAA (2)
  • kinmic (2)
  • amazon-q-developer[bot] (2)
  • fhurtado (1)
  • careymcg (1)
Top Labels
Issue Labels
type: enhancement (45) scary: bug :lady_beetle: (29) topic: vignette (27) topic: documentation :book: (16) type: :grey_question: (15) type --- feature (12) type: refactor (11) type --- upkeep (10) type: development :building_construction: (9) scary: CRAN (7) topic: manuscript (7) topic: OM (7) topic: EM (7) status: low priority (6) status --- wip (5) topic: results (5) topic: ghaction (4) type --- documentation (4) topic --- Stock Synthesis (4) status --- low priority (4) status: high priority (4) status: in progress (4) topic --- EM (4) topic --- sampling (3) topic: sampling (3) topic: style (3) status --- high priority (2) topic --- ghaction (2) topic --- results (2) status --- good first issue (2)
Pull Request Labels
type: enhancement (2) topic --- results (2) type --- feature (2) topic: EM (1) topic: Stock Synthesis (1) topic: documentation :book: (1) topic: testing (1) type: refactor (1) topic --- sampling (1) topic --- ghaction (1) topic --- Stock Synthesis (1)

Packages

  • Total packages: 1
  • Total downloads:
    • cran 593 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 2
  • Total versions: 7
  • Total maintainers: 1
cran.r-project.org: ss3sim

Fisheries Stock Assessment Simulation Testing with Stock Synthesis

  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 2
  • Downloads: 593 Last month
Rankings
Forks count: 3.5%
Stargazers count: 8.0%
Average: 15.8%
Dependent repos count: 19.5%
Downloads: 20.4%
Dependent packages count: 27.8%
Maintainers (1)
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • R >= 4.0 depends
  • dplyr * imports
  • foreach * imports
  • ggplot2 * imports
  • grDevices * imports
  • graphics * imports
  • gtools * imports
  • lifecycle * imports
  • magrittr * imports
  • purrr * imports
  • r4ss >= 1.46.1 imports
  • rlang * imports
  • stats * imports
  • stringi * imports
  • tibble * imports
  • tidyr * imports
  • utils * imports
  • doParallel * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/call-doc-and-style-r.yml actions
.github/workflows/call-r-cmd-check.yml actions
.github/workflows/call-style.yml actions
.github/workflows/call-update-docs.yml actions
.github/workflows/call-update-pkgdown.yml actions
.github/workflows/call-update-ss3-version.yml actions
.github/workflows/update-ss3-version.yml actions
  • actions/checkout v3 composite
  • peter-evans/create-pull-request v3 composite