# Assessment emulator as a shortcut to model fitting in closed-loop simulation

Source:`R/assess_shortcut.R`

`Shortcut.Rd`

Functions (class Assessment) that emulate a stock assessment by sampling the operating model biomass, abundance, and
fishing mortality (with observation error, autocorrelation, and bias) instead of fitting a model. This output can then
be passed onto a harvest control rule (HCR function). `Shortcut`

is the base function that samples the OM with an error
distribution. `Shortcut2`

, the more preferable option, fits SCA in the last historical year of the operating
model, estimates the error parameters using a vector autoregressive model of the residuals, and then generates model "estimates"
using predict.varest. `Perfect`

assumes no error in the assessment model and is useful for comparing the behavior of
different harvest control rules. To utilize the shortcut method in closed-loop simulation, use make_MP with these functions as
the Assessment model. **N.B. the functions do not work with** `runMSE(parallel = TRUE)`

for MSEtool v3.4.0 and earlier.

## Arguments

- x
An index for the objects in

`Data`

when running in runMSE. Otherwise, equals to 1 When running an assessment interactively.- Data
An object of class Data.

- method
Indicates where the error in the OM is located. For "B", OM biomass is directly sampled with error. For "N", OM abundance-at-age is sampled and biomass subsequently calculated. For "RF", recruitment and F are sampled to calculate abundance and biomass. There is no error in biological parameters for "N" and "RF". By default, "B" is used for

`Shortcut`

and "N" for`Shortcut2`

.- B_err
If

`method = "B"`

, a vector of length three that specifies the standard deviation (in logspace), autocorrelation, and bias (1 = unbiased) for biomass.- N_err
Same as B_err, but for abundance when

`method = "N"`

.- R_err
Same as B_err, but for recruitment when

`method = "RF"`

.- F_err
Same as B_err. Always used regardless of

`method`

to report F and selectivity for HCR.- VAR_model
An object returned by VAR to generate emulated assessment error. Used by

`Shortcut2`

.- ...
Other arguments (not currently used).

- SCA_args
Additional arguments to pass to SCA. Currently, arguments

`SR`

and`vulnerability`

are obtained from the operating model.- VAR_args
Additional arguments to pass to VAR. By default, argument

`type = "none"`

(stationary time series with mean zero is assumed).

## Value

An object of class Assessment.

## Details

Currently there is no error in FMSY (frequently the target F in the HCR).

See Wiedenmann et al. (2015) for guidance on the magnitude of error for the shortcut emulator.

## References

Wiedenmann, J., Wilberg, M.J., Sylvia, A., and Miller, T.J. 2015. Autocorrelated error in stock assessment estimates: Implications for management strategy evaluation. Fisheries Research 172: 325-334.

## Examples

```
Shortcut_4010 <- make_MP(Shortcut, HCR40_10)
Shortcut_Nerr <- make_MP(Shortcut, HCR40_10, method = "N", N_err = c(0.1, 0.1, 1)) # Highly precise!
# Fits SCA first and then emulate it in the projection period
Shortcut2_4010 <- make_MP(Shortcut2, HCR40_10)
# \donttest{
# Compare the shortcut method vs. fitting an SCA model with a 40-10 control rule
MSE <- runMSE(testOM, MPs = c("Shortcut_4010", "SCA_4010"))
#> ℹ Checking OM for completeness
#> ✔ Loading operating model
#> ✔ Optimizing for user-specified movement
#> ✔ Calculating MSY reference points for each year
#> ✔ Optimizing for user-specified depletion in last historical year
#> ✔ Calculating historical stock and fishing dynamics
#> ✔ Calculating per-recruit reference points
#> ✔ Calculating B-low reference points
#> ✔ Calculating reference yield - best fixed F strategy
#> ✔ Simulating observed data
#> ✔ Running forward projections
#> ✔ 1 / 2 Running MSE for Shortcut_4010
#> Warning: Method Shortcut_4010 failed with error: Error in Assessment@N_at_age[, 1] : subscript out of bounds
#> ✔ The following error occured when running the forward projections: Error in MPRecs$TAC: $ operator is invalid for atomic vectors
#>
#> ✔ Returning the historical simulations (class `Hist`). To avoid re-running spool up, the forward projections can be run with `runMSE(Hist, MPs, ...)`
# }
# Compare the performance of three HCRs
Perfect_4010 <- make_MP(Perfect, HCR40_10)
Perfect_6020 <- make_MP(Perfect, HCR60_20)
Perfect_8040MSY <- make_MP(Perfect, HCR_ramp, OCP_type = "SSB_SSBMSY", TOCP = 0.8, LOCP = 0.4)
# \donttest{
MSE <- runMSE(testOM, MPs = c("Perfect_4010", "Perfect_6020", "Perfect_8040MSY"))
#> ℹ Checking OM for completeness
#> ✔ Loading operating model
#> ✔ Optimizing for user-specified movement
#> ✔ Calculating MSY reference points for each year
#> ✔ Optimizing for user-specified depletion in last historical year
#> ✔ Calculating historical stock and fishing dynamics
#> ✔ Calculating per-recruit reference points
#> ✔ Calculating B-low reference points
#> ✔ Calculating reference yield - best fixed F strategy
#> ✔ Simulating observed data
#> ✔ Running forward projections
#> ✔ 1 / 3 Running MSE for Perfect_4010
#>
|== | 2 % ~02s
|=== | 4 % ~01s
|==== | 6 % ~01s
|===== | 8 % ~01s
|====== | 10% ~01s
|======= | 12% ~01s
|======== | 14% ~01s
|========= | 16% ~01s
|========== | 18% ~01s
|=========== | 20% ~01s
|============ | 22% ~01s
|============= | 24% ~01s
|============== | 27% ~01s
|=============== | 29% ~01s
|================ | 31% ~00s
|================= | 33% ~00s
|================== | 35% ~01s
|=================== | 37% ~00s
|==================== | 39% ~00s
|===================== | 41% ~00s
|====================== | 43% ~00s
|======================= | 45% ~00s
|======================== | 47% ~00s
|========================= | 49% ~00s
|========================== | 51% ~00s
|=========================== | 53% ~00s
|============================ | 55% ~00s
|============================= | 57% ~00s
|============================== | 59% ~00s
|=============================== | 61% ~00s
|================================ | 63% ~00s
|================================= | 65% ~00s
|================================== | 67% ~00s
|=================================== | 69% ~00s
|==================================== | 71% ~00s
|===================================== | 73% ~00s
|====================================== | 76% ~00s
|======================================= | 78% ~00s
|======================================== | 80% ~00s
|========================================= | 82% ~00s
|========================================== | 84% ~00s
|=========================================== | 86% ~00s
|============================================ | 88% ~00s
|============================================= | 90% ~00s
|============================================== | 92% ~00s
|=============================================== | 94% ~00s
|================================================ | 96% ~00s
|================================================= | 98% ~00s
|==================================================| 100% elapsed=01s
#>
#> ✔ 2 / 3 Running MSE for Perfect_6020
#>
|== | 2 % ~01s
|=== | 4 % ~01s
|==== | 6 % ~00s
|===== | 8 % ~00s
|====== | 10% ~01s
|======= | 12% ~01s
|======== | 14% ~01s
|========= | 16% ~00s
|========== | 18% ~01s
|=========== | 20% ~01s
|============ | 22% ~01s
|============= | 24% ~00s
|============== | 27% ~01s
|=============== | 29% ~01s
|================ | 31% ~00s
|================= | 33% ~00s
|================== | 35% ~01s
|=================== | 37% ~00s
|==================== | 39% ~00s
|===================== | 41% ~00s
|====================== | 43% ~00s
|======================= | 45% ~00s
|======================== | 47% ~00s
|========================= | 49% ~00s
|========================== | 51% ~00s
|=========================== | 53% ~00s
|============================ | 55% ~00s
|============================= | 57% ~00s
|============================== | 59% ~00s
|=============================== | 61% ~00s
|================================ | 63% ~00s
|================================= | 65% ~00s
|================================== | 67% ~00s
|=================================== | 69% ~00s
|==================================== | 71% ~00s
|===================================== | 73% ~00s
|====================================== | 76% ~00s
|======================================= | 78% ~00s
|======================================== | 80% ~00s
|========================================= | 82% ~00s
|========================================== | 84% ~00s
|=========================================== | 86% ~00s
|============================================ | 88% ~00s
|============================================= | 90% ~00s
|============================================== | 92% ~00s
|=============================================== | 94% ~00s
|================================================ | 96% ~00s
|================================================= | 98% ~00s
|==================================================| 100% elapsed=01s
#>
#> ✔ 3 / 3 Running MSE for Perfect_8040MSY
#>
|== | 2 % ~01s
|=== | 4 % ~01s
|==== | 6 % ~00s
|===== | 8 % ~00s
|====== | 10% ~01s
|======= | 12% ~01s
|======== | 14% ~01s
|========= | 16% ~00s
|========== | 18% ~01s
|=========== | 20% ~01s
|============ | 22% ~01s
|============= | 24% ~00s
|============== | 27% ~01s
|=============== | 29% ~00s
|================ | 31% ~00s
|================= | 33% ~00s
|================== | 35% ~00s
|=================== | 37% ~00s
|==================== | 39% ~00s
|===================== | 41% ~00s
|====================== | 43% ~00s
|======================= | 45% ~00s
|======================== | 47% ~00s
|========================= | 49% ~00s
|========================== | 51% ~00s
|=========================== | 53% ~00s
|============================ | 55% ~00s
|============================= | 57% ~00s
|============================== | 59% ~00s
|=============================== | 61% ~00s
|================================ | 63% ~00s
|================================= | 65% ~00s
|================================== | 67% ~00s
|=================================== | 69% ~00s
|==================================== | 71% ~00s
|===================================== | 73% ~00s
|====================================== | 76% ~00s
|======================================= | 78% ~00s
|======================================== | 80% ~00s
|========================================= | 82% ~00s
|========================================== | 84% ~00s
|=========================================== | 86% ~00s
|============================================ | 88% ~00s
|============================================= | 90% ~00s
|============================================== | 92% ~00s
|=============================================== | 94% ~00s
|================================================ | 96% ~00s
|================================================= | 98% ~00s
|==================================================| 100% elapsed=01s
#>
# }
```