Skip to contents

Introduction

This vignette provides the minimal steps needed to run a Fisheries Integrated Modeling System (FIMS) model.

Setup

Load the FIMS package and clear memory:

library(FIMS)

# clear memory
clear()

Data and parameters

First, load the available data and create a FIMS data frame to create a model with. Then create a set of default parameters.

# 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)

Initialize and Fit

Initialize the FIMS modules and fit the model.

# Run the  model with optimization
fit <- parameters |>
  initialize_fims(data = data_4_model) |>
  fit_fims(optimize = TRUE)
##  Starting optimization ...
##  Restarting optimizer 3 times to improve gradient.
##  Maximum gradient went from 0.00915 to 0.00057 after 3 steps.
##  Finished optimization
##  Finished sdreport
##  FIMS model version: 0.7
##  Total run time was 6.45911 seconds
##  Number of parameters: fixed_effects=77, random_effects=0, and total=77
##  Maximum gradient= 0.00057
##  Negative log likelihood (NLL):
##  Marginal NLL= 3240.1261
##  Total NLL= 3240.1261
##  Terminal SB= 1803.27839
# Clear memory post-run
clear()