|
| 1 | +## ----load_base_om, eval=FALSE------------------------------------------------- |
| 2 | +# nyears <- 100 |
| 3 | +# |
| 4 | +# sable_om <- readRDS("data/sablefish_om_big.RDS") |
| 5 | +# |
| 6 | +# # Also load the historical recruitment timeseries |
| 7 | +# assessment <- dget("data/sablefish_assessment_2023.rdat") |
| 8 | +# hist_recruits <- assessment$natage.female[,1]*2 |
| 9 | + |
| 10 | +## ----om1, eval=FALSE---------------------------------------------------------- |
| 11 | +# om1 <- sable_om |
| 12 | +# om1$recruitment$func <- resample_recruits |
| 13 | +# om1$recruitment$pars <- list( |
| 14 | +# hist_recruits = hist_recruits, |
| 15 | +# nyears = nyears |
| 16 | +# ) |
| 17 | + |
| 18 | +## ----om2, eval=FALSE---------------------------------------------------------- |
| 19 | +# om2 <- sable_om |
| 20 | +# om2$recruitment$func <- resample_regime_recruits |
| 21 | +# om2$recruitment$pars <- list( |
| 22 | +# regime1_recruits = hist_recruits[hist_recruits <= 35], |
| 23 | +# regime2_recruits = hist_recruits[hist_recruits > 35], |
| 24 | +# nyears = 10*nyears, |
| 25 | +# regime_length = c(20, 5), |
| 26 | +# starting_regime = 0 |
| 27 | +# ) |
| 28 | + |
| 29 | +## ----om4, eval=FALSE---------------------------------------------------------- |
| 30 | +# om4 <- sable_om |
| 31 | +# om4$recruitment$func <- regime_recruits |
| 32 | +# om4$recruitment$pars <- list( |
| 33 | +# mus = c(mean(hist_recruits[hist_recruits <= 35])), |
| 34 | +# cvs = c(sd(hist_recruits[hist_recruits <= 35])/mean(hist_recruits[hist_recruits <= 35])), |
| 35 | +# nyears = 10*nyears, |
| 36 | +# regime_length = c(nyears*10), |
| 37 | +# starting_regime = 0 |
| 38 | +# ) |
| 39 | + |
| 40 | +## ----om5, eval=FALSE---------------------------------------------------------- |
| 41 | +# om6 <- sable_om |
| 42 | +# om6$recruitment$func <- recruits_crash |
| 43 | +# om6$recruitment$pars <- list( |
| 44 | +# crash_start_year = 1, |
| 45 | +# crash_length = 10, |
| 46 | +# crash_value = 0, |
| 47 | +# hist_recruits = hist_recruits, |
| 48 | +# nyears = 10*nyears |
| 49 | +# ) |
| 50 | + |
| 51 | +## ----om_list, eval=FALSE------------------------------------------------------ |
| 52 | +# om_list <- listN(om1, om2, om3, om4, om6) |
| 53 | + |
| 54 | +## ----setup_mp_options, eval=FALSE--------------------------------------------- |
| 55 | +# mp_base <- setup_mp_options() |
| 56 | + |
| 57 | +## ----atainment_function, eval=FALSE------------------------------------------- |
| 58 | +# mp_base$management$tac_land_reduction <- list( |
| 59 | +# func = stairstep_attainment, |
| 60 | +# pars = list( |
| 61 | +# breakpoints = c(20, 30), |
| 62 | +# levels = c(0.874, 0.786, 0.647), |
| 63 | +# phase_ins = 0 |
| 64 | +# ) |
| 65 | +# ) |
| 66 | + |
| 67 | +## ----mp1, eval=FALSE---------------------------------------------------------- |
| 68 | +# mp1 <- mp_base |
| 69 | +# mp1$hcr <- list( |
| 70 | +# func = tier3, |
| 71 | +# extra_pars = NA, |
| 72 | +# extra_options = list( |
| 73 | +# max_stability = NA, |
| 74 | +# harvest_cap = NA |
| 75 | +# ), |
| 76 | +# units = "F" |
| 77 | +# ) |
| 78 | + |
| 79 | +## ----mp234, eval=FALSE-------------------------------------------------------- |
| 80 | +# mp2 <- mp_base |
| 81 | +# mp2$hcr <- list( |
| 82 | +# func = tier3, |
| 83 | +# extra_pars = NA, |
| 84 | +# extra_options = list( |
| 85 | +# max_stability = 0.10, |
| 86 | +# harvest_cap = NA |
| 87 | +# ), |
| 88 | +# units = "F" |
| 89 | +# ) |
| 90 | +# |
| 91 | +# mp3 <- mp_base |
| 92 | +# mp3$hcr <- list( |
| 93 | +# func = tier3, |
| 94 | +# extra_pars = NA, |
| 95 | +# extra_options = list( |
| 96 | +# max_stability = 0.15, |
| 97 | +# harvest_cap = NA |
| 98 | +# ), |
| 99 | +# units = "F" |
| 100 | +# ) |
| 101 | +# |
| 102 | +# mp4 <- mp_base |
| 103 | +# mp4$hcr <- list( |
| 104 | +# func = tier3, |
| 105 | +# extra_pars = NA, |
| 106 | +# extra_options = list( |
| 107 | +# max_stability = 0.25, |
| 108 | +# harvest_cap = NA |
| 109 | +# ), |
| 110 | +# units = "F" |
| 111 | +# ) |
| 112 | + |
| 113 | +## ----mp5, eval=FALSE---------------------------------------------------------- |
| 114 | +# mp5 <- mp_base |
| 115 | +# mp5$ref_points$spr_target <- 0.50 |
| 116 | +# mp5$hcr <- list( |
| 117 | +# func = tier3, |
| 118 | +# extra_pars = NA, |
| 119 | +# extra_options = list( |
| 120 | +# max_stability = NA, |
| 121 | +# harvest_cap = NA |
| 122 | +# ), |
| 123 | +# units = "F" |
| 124 | +# ) |
| 125 | + |
| 126 | +## ----mp67, eval=FALSE--------------------------------------------------------- |
| 127 | +# mp6 <- mp_base |
| 128 | +# mp6$hcr <- list( |
| 129 | +# func = tier3, |
| 130 | +# extra_pars = list(cutoff_age = 7), |
| 131 | +# extra_options = list( |
| 132 | +# max_stability = NA, |
| 133 | +# harvest_cap = NA |
| 134 | +# ), |
| 135 | +# units = "F" |
| 136 | +# ) |
| 137 | +# |
| 138 | +# mp7 <- mp_base |
| 139 | +# mp7$hcr <- list( |
| 140 | +# func = tier3, |
| 141 | +# extra_pars = list(cutoff_age = 14), |
| 142 | +# extra_options = list( |
| 143 | +# max_stability = NA, |
| 144 | +# harvest_cap = NA |
| 145 | +# ), |
| 146 | +# units = "F" |
| 147 | +# ) |
| 148 | + |
| 149 | +## ----mp8, eval=FALSE---------------------------------------------------------- |
| 150 | +# mp8 <- mp_base |
| 151 | +# mp8$ref_points$spr_target <- 0.45 |
| 152 | +# mp8$hcr <- list( |
| 153 | +# func = pfmc4010, |
| 154 | +# extra_pars = NA, |
| 155 | +# extra_options = list( |
| 156 | +# max_stability = NA, |
| 157 | +# harvest_cap = NA |
| 158 | +# ), |
| 159 | +# units = "TAC" |
| 160 | +# ) |
| 161 | + |
| 162 | +## ----mp91011, eval=FALSE------------------------------------------------------ |
| 163 | +# mp9 <- mp_base |
| 164 | +# mp9$hcr <- list( |
| 165 | +# func = tier3, |
| 166 | +# extra_pars = NA, |
| 167 | +# extra_options = list( |
| 168 | +# max_stability = NA, |
| 169 | +# harvest_cap = 15 |
| 170 | +# ), |
| 171 | +# units = "F" |
| 172 | +# ) |
| 173 | +# |
| 174 | +# mp10 <- mp_base |
| 175 | +# mp10$hcr <- list( |
| 176 | +# func = tier3, |
| 177 | +# extra_pars = NA, |
| 178 | +# extra_options = list( |
| 179 | +# max_stability = NA, |
| 180 | +# harvest_cap = 20 |
| 181 | +# ), |
| 182 | +# units = "F" |
| 183 | +# ) |
| 184 | +# |
| 185 | +# mp11 <- mp_base |
| 186 | +# mp11$hcr <- list( |
| 187 | +# func = tier3, |
| 188 | +# extra_pars = NA, |
| 189 | +# extra_options = list( |
| 190 | +# max_stability = NA, |
| 191 | +# harvest_cap = 25 |
| 192 | +# ), |
| 193 | +# units = "F" |
| 194 | +# ) |
| 195 | + |
| 196 | +## ----mp_list, eval=FALSE------------------------------------------------------ |
| 197 | +# mp_list <- listN(mp1, mp2, mp, mp4, mp5, mp6, mp7, mp8, mp9, mp10, mp11) |
| 198 | + |
| 199 | +## ----mse_options, eval=FALSE-------------------------------------------------- |
| 200 | +# mse_options <- setup_mse_options() |
| 201 | + |
| 202 | +## ----run_mse, eval=FALSE------------------------------------------------------ |
| 203 | +# nsims <- 9 |
| 204 | +# seed_list <- sample(1:(1000*nsims), nsims) |
| 205 | +# model_runs <- run_mse_multiple( |
| 206 | +# om_list, |
| 207 | +# hcr_list, |
| 208 | +# seed_list, |
| 209 | +# nyears=nyears, |
| 210 | +# mse_options_list=mse_options_list |
| 211 | +# ) |
| 212 | + |
| 213 | +## ----extra_columns, eval=FALSE------------------------------------------------ |
| 214 | +# om_names <- c("Random Recruitment", "Cyclic Recruitment", "Beverton-Holt Recruitment", "Low Recruitment", "Recruitment Crash") |
| 215 | +# hcr_names <- c("F40", "F40 +/-10%", "F40 +/-15%", "F40 +/-25%", "F50", "F40 >7yo", "F40 >14yo", "PFMC 40-10", "F40 15k Cap", "F40 20k Cap", "F40 25k Cap") |
| 216 | +# |
| 217 | +# extra_columns <- expand.grid( |
| 218 | +# om = om_names, |
| 219 | +# hcr = hcr_names |
| 220 | +# ) |
| 221 | + |
| 222 | +## ----data_processing, eval=FALSE---------------------------------------------- |
| 223 | +# ssb_data <- get_ssb_biomass(model_runs, extra_columns2, sable_om$dem_params) |
| 224 | +# f_data <- get_fishing_mortalities(model_runs, extra_columns2) |
| 225 | +# r_data <- get_recruits(model_runs, extra_columns2) |
| 226 | +# abctac <- get_management_quantities(model_runs, extra_columns2) |
| 227 | +# catch_data <- get_landed_catch(model_runs, extra_columns2) |
| 228 | + |
| 229 | +## ----plotting, eval=FALSE----------------------------------------------------- |
| 230 | +# plot_ssb(ssb_data, v1="hcr", v2="om") |
| 231 | +# plot_fishing_mortalities(f_data, v1="hcr", v2="om") |
| 232 | +# plot_recruitment(r_data, v1="hcr", v2="om") |
| 233 | +# plot_abc_tac(abctac, v1="hcr", v2="om") |
| 234 | +# plot_landed_catch(catch_data, v1="hcr", v2="om") |
| 235 | + |
| 236 | +## ----performance_metrics, eval=FALSE------------------------------------------ |
| 237 | +# performance_metrics <- performance_metric_summary( |
| 238 | +# model_runs, |
| 239 | +# extra_columns2, |
| 240 | +# sable_om$dem_params, |
| 241 | +# ) |
| 242 | +# |
| 243 | +# perf_data <- performance_metrics$perf_data |
| 244 | +# plot_performance_metric_summary(perf_data) |
| 245 | +# |
| 246 | + |
0 commit comments