# Modifying the model included with ss3sim

#### 2019-11-08

# Modifying the OM and EM models included with ss3sim

ss3sim comes with a built-in Stock Synthesis (SS) operating model (OM) and estimation model (EM) for a cod-like (slow-growing and long-lived) species. This cod-like species is based on North Sea cod (Gadus morhua; R. Methot, pers. comm.). The original assessment model was simplified to make it more generic for simulation testing and structured to work with ss3sim. Previous ss3sim simulation studies also used flatfish-like (fast-growing and long-lived) and sardine-like (fast-growing and short-lived) model set ups. These model setups were based yellowtail flounder (Limanda ferruginea; R. Methot, pers. comm.) and Pacific sardine (Sardinops sagax caeruleus; Hill et al. 2012). The specific details (e.g., many fleets, tagging data, seasons, etc.) of the original model setups were not important and removed to produce a set of models generic enough to represent different life-history types. Further details on these models are available in Johnson et al. (2015) and Ono et al. (2015). While these model setups are generic and cover a wide range of life-history types, they may not be suitable for all users. Therefore, in this section, we outline strategies for modifying the existing SS model available within the ss3sim package.

ss3sim is not designed for testing properties of specific SS models, but rather properties of assessment models in general. Currently, there are many features of SS that cannot be manipulated by ss3sim. For example, seasons, hermaphrodism, multiple areas, movement, growth morphs, and platoons. All features that have been removed from the cod-like species if they were present in the original assessment. It is possible to create new models that will work within the ss3sim framework, but this task will be complicated and likely require extensive knowledge of SS3 and R. This process is described in more detail in Sections and . We recommend adapting the current built-in models to match your desired model setup because the configuration of this model has already been tested within ss3sim and is easily adaptable.

For example, youcan modify the cod OM and EM files to have a different maturity before exploring sampling schemes using the `sample_index`, `sample_lcomp`, and `sample_agecomp` functions. The following steps provide a basic guideline for how to accomplish this:

- Create case-argument files or list structures for your simulation and verify they run with the original cod model using the function `run_ss3sim` or `ss3sim_base`, respectively. It is probably best to do a shorter deterministic run (see the section on deterministic runs) rather than a run with process error. After running, read in the data and do visual checks for proper functionality.
- Locate the cod model OM and EM files using `system.file(file.path("extdata", "models"), package = "ss3sim")`.
- Copy the OM and EM folders and rename them as desired.
- Make a single change to either the `.dat` or `.ctl` files for the new model and run them manually with SS via the command line or a `system` call within R if there is any question if they might break the model.
- Rerun the model through `run_ss3sim` and verify it is still working.
- Repeat previous two steps with each small change you desire to make.
- Turn off deterministic runs and run the simulation stochastically.

Hill, K. T., P. R. Crone, N. C. H. Lo, D. A. Demer, J. P. Zwolinski, and B. J. Macewicz. 2012. “Assessment of the Pacific Sardine Resource in 2012 for U.S. Management in 2013.” 7700 NE Ambassador Place, Portland, OR 97220, USA: Pacific Fishery Management Council.

Johnson, Kelli F., Cole C. Monnahan, Carey R. McGilliard, Katyana A. Vert-pre, Sean C. Anderson, Curry J. Cunningham, Felipe Hurtado-Ferro, et al. 2015. “Time-Varying Natural Mortality in Fisheries Stock Assessment Models: Identifying a Default Approach.” ICES Journal of Marine Science: Journal Du Conseil 72 (1): 137–50. doi:10.1093/icesjms/fsu055.

Ono, Kotaro, Roberto Licandeo, Melissa L. Muradian, Curry J. Cunningham, Sean C. Anderson, Felipe Hurtado-Ferro, Kelli F. Johnson, et al. 2015. “The Importance of Length and Age Composition Data in Statistical Age-Structured Models for Marine Species.” ICES Journal of Marine Science: Journal Du Conseil 72 (1): 31–43. doi:10.1093/icesjms/fsu007.