diff --git a/README.Rmd b/README.Rmd index d1e5ff79..85ba70b6 100644 --- a/README.Rmd +++ b/README.Rmd @@ -143,9 +143,10 @@ run_SSMSE(scen_name_vec = c("H-ctl", "H-1"), # name of the scenario use_SS_boot_vec = c(TRUE, TRUE), # use the SS bootstrap module for sampling nyrs_vec = c(6, 6), # Years to project OM forward nyrs_assess_vec = c(3, 3), # Years between assessments - rec_dev_pattern = c("none", "none"), # Don't use recruitment deviations - impl_error_pattern = c("none", "none"), # Don't use implementation error - sample_struct_list = sample_struct_list) # How to sample data for running the EM. + rec_dev_pattern = c("none"), # Don't use recruitment deviations + impl_error_pattern = c("none"), # Don't use implementation error + sample_struct_list = sample_struct_list, # How to sample data for running the EM. + seed = 12345) #Set a fixed integer seed that allows replication ``` The function `SSMSE_summary_all` can be used to summarize the model results in a list of dataframes. Note that if you have issues, try reinstalling SSMSE using `remotes::install_github("nmfs-fish-tools/SSMSE")` and restarting your R session. Also, make sure you are using the development branch versions of [r4ss](https://github.com/r4ss/r4ss) and [ss3sim](https://github.com/ss3sim/ss3sim) (by installing `remotes::install_github("r4ss/r4ss@development")` and `remotes::install_github("ss3sim/ss3sim@development")`. These versions should be installed automatically when SSMSE is downloaded. diff --git a/README.md b/README.md index 9ccae99a..a378f5db 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ library(r4ss) #install using remotes::install_github("r4ss/r4ss@development) # Create a folder for the output in the working directory. run_SSMSE_dir <- file.path("run_SSMSE-ex") dir.create(run_SSMSE_dir) +## Warning in dir.create(run_SSMSE_dir): 'run_SSMSE-ex' already exists ``` The cod model with H = 0.65 is included as external package data. @@ -105,7 +106,10 @@ cod_mod_path <- system.file("extdata", "models", "cod", package = "SSMSE") file.copy(from = cod_mod_path, to = run_SSMSE_dir, recursive = TRUE) ## [1] TRUE file.rename(from = file.path(run_SSMSE_dir, "cod"), to = file.path(run_SSMSE_dir, "cod-1")) -## [1] TRUE +## Warning in file.rename(from = file.path(run_SSMSE_dir, "cod"), to = +## file.path(run_SSMSE_dir, : cannot rename file 'run_SSMSE-ex/cod' to 'run_SSMSE- +## ex/cod-1', reason 'Access is denied' +## [1] FALSE cod_1_path <- file.path(run_SSMSE_dir, "cod-1") # make model read initial values from control file and not ss.par start <- r4ss::SS_readstarter(file = file.path(cod_1_path, "starter.ss"), verbose = FALSE) @@ -118,14 +122,14 @@ r4ss::SS_changepars(dir = cod_1_path, ctlfile = "control.ss_new", ## [1] "SR_BH_steep" ## These are the ctl file lines as they currently exist: ## LO HI INIT PRIOR PR_SD PR_type PHASE env_var&link dev_link dev_minyr -## 107 0.2 1 0.65 0.7 0.05 0 -4 0 0 0 +## 107 0.2 1 1 0.7 0.05 0 -4 0 0 0 ## dev_maxyr dev_PH Block Block_Fxn Label Linenum ## 107 0 0 0 0 SR_BH_steep 107 ## line numbers in control file (n=1): ## 107 ## wrote new file to control_modified.ss with the following changes: ## oldvals newvals oldphase newphase oldlos newlos oldhis newhis oldprior -## 1 0.65 1 -4 -4 0.2 0.2 1 1 0.7 +## 1 1 1 -4 -4 0.2 0.2 1 1 0.7 ## newprior oldprsd newprsd oldprtype newprtype comment ## 1 0.7 0.05 0.05 0 0 # SR_BH_steep # remove files with M = 0.2 @@ -221,9 +225,10 @@ run_SSMSE(scen_name_vec = c("H-ctl", "H-1"), # name of the scenario use_SS_boot_vec = c(TRUE, TRUE), # use the SS bootstrap module for sampling nyrs_vec = c(6, 6), # Years to project OM forward nyrs_assess_vec = c(3, 3), # Years between assessments - rec_dev_pattern = c("none", "none"), # Don't use recruitment deviations - impl_error_pattern = c("none", "none"), # Don't use implementation error - sample_struct_list = sample_struct_list) # How to sample data for running the EM. + rec_dev_pattern = c("none"), # Don't use recruitment deviations + impl_error_pattern = c("none"), # Don't use implementation error + sample_struct_list = sample_struct_list, # How to sample data for running the EM. + seed = 12345) #Set a fixed integer seed that allows replication ``` The function `SSMSE_summary_all` can be used to summarize the model @@ -241,8 +246,12 @@ should be installed automatically when SSMSE is downloaded. # Summarize 1 iteration of output summary <- SSMSE_summary_all(normalizePath(run_res_path)) ## Extracting results from 2 scenarios -## Starting H-1 with 5 iterations -## Starting H-ctl with 5 iterations +## Warning in ss3sim::get_results_all(directory = dir, user_scenarios = scenarios): +## ss3sim_scalar.csv already exists and overwrite_files = FALSE, so a new file was +## not written +## Warning in ss3sim::get_results_all(directory = dir, user_scenarios = scenarios): +## ss3sim_ts.csv already exists and overwrite_files = FALSE, so a new file was not +## written ``` Plotting and data manipulation can then be done with these summaries. @@ -254,6 +263,7 @@ in year 103 (cod\_EM\_103), and the EM run with last year of data in 106 ``` r library(ggplot2) # use install.packages("ggplot2") to install package if needed +## Warning: package 'ggplot2' was built under R version 4.0.2 library(tidyr) # use install.packages("tidyr") to install package if needed ## ## Attaching package: 'tidyr'