FIMS is an R package for fitting integrated statistical population-dynamics models to fishery data. The back end is written in C++, and the use of Rcpp allows users to easily interact with the models using R. The package is unique because it includes multiple model types, e.g., surplus production and catch-at-age models. This reduces the burden of learning a new framework when exploring major changes in model structure. Stay tuned for the addition of even more model types.
If you are new to FIMS, the best place to start is the “Introducing FIMS” vignette.
Installation
A precompiled version of the latest release is available from the instance of R universe hosted by NOAA Fisheries Integrated Toolbox. You can install the latest version from GitHub.
# Install the pre-compiled version of the latest release
install.packages(
"FIMS",
repos = c(
"https://noaa-fisheries-integrated-toolbox.r-universe.dev",
"https://cloud.r-project.org"
)
)
# Compile and install it yourself, where you can specify the branch
pak::pak("NOAA-FIMS/FIMS@main")Expand this section if you want to use load_all()
Developers who are interested in building FIMS can clone this repository, e.g., git clone https://github.com/NOAA-FIMS/FIMS.git and build it with devtools::install(), which builds the package from the cloned files and installs the R library. Installing with devtools::load_all() is not recommended because it uses shim files for things like system.file(), which can cause FIMS to not function as expected. For example, if you try to optimize the same model twice, you will more than likely not get estimates of uncertainty from the second model run. Additionally, devtools::load_all() adds the debugger flag -O0 -g which leads to Windows users seeing Fatal error: can't write <xxx> bytes to section .text of FIMS.o: 'file too big. Thus, Windows users need to run withr::local_options(pkg.build_extra_flags = FALSE) at the beginning of every R session before calling devtools::load_all(). If you want to compile FIMS with the debugger turned on you will need to run the {withr} function in addition to manually modifying the call to PKG_CXXFLAGS in the src/Makevars.win file to include -O1 -g.
Usage
library(FIMS)
# Load sample data
data("data1")
# Prepare data for FIMS model
data_4_model <- FIMSFrame(data1)
# Create parameters
parameters <- data_4_model |>
create_default_configurations() |>
create_default_parameters(data = data_4_model)
# Run the model with optimization
fit <- parameters |>
initialize_fims(data = data_4_model) |>
fit_fims(optimize = TRUE)
# Clear memory post-run
clear()Troubleshooting
If you encounter a 🐛, please file an Issue with a minimal reproducible example on GitHub.
If you are uncertain that you have actually encountered a 🐛, are looking for more information, or want to talk about some new ideas please use the Discussion Board to post your thoughts. Anyone interested in our project is welcome to join the discussions, this is a place for all members of the assessment and open-source software community to ask and answer questions, share updates, have open-ended conversations, and follow along. Please introduce yourself 👋 on the Introduction Discussion.
More information can be found on the NOAA-FIMS website, particularly on our blog.
Contributors
All contributions to this project are gratefully acknowledged using the allcontributors package following the all-contributors specification. Contributions of any kind are welcome!
Code
Issue Authors
|
Cole-Monnahan-NOAA |
Andrea-Havron |
Ovec8hkin |
cmlegault |
arni-magnusson |
Schiano-NOAA |
NOAA Disclaimer
This repository is a scientific product and is not official communication of the National Oceanic and Atmospheric Administration, or the United States Department of Commerce. All NOAA GitHub project code is provided on an ‘as is’ basis and the user assumes responsibility for its use. Any claims against the Department of Commerce or Department of Commerce 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 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.
Software code created by U.S. Government employees is not subject to copyright in the United States (17 U.S.C. section 105). The United States/Department of Commerce reserve all rights to seek and obtain copyright protection in countries other than the United States for Software authored in its entirety by the Department of Commerce. To this end, the Department of Commerce hereby grants to Recipient a royalty-free, nonexclusive license to use, copy, and create derivative works of the Software outside of the United States.

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