R/diagnostic.R
diagnostic.Rd
Diagnostic check for convergence of Assess models during closedloop simulation. Use when the MP was
created with make_MP with argument diagnostic = "min"
or "full"
.
This function summarizes and plots the diagnostic information.
diagnostic(MSE, MP, gradient_threshold = 0.1, figure = TRUE)
diagnostic_AM(...)
An object of class MSE created by runMSE
.
Optional, a character vector of MPs that use assessment models.
The maximum magnitude (absolute value) desired for the gradient of the likelihood.
Logical, whether a figure will be drawn.
Arguments to pass to diagnostic
.
A matrix with diagnostic performance of assessment models in the MSE. If figure = TRUE
,
a set of figures: traffic light (red/green) plots indicating whether the model converged (defined if a positivedefinite
Hessian matrix was obtained), the optimizer reached prespecified iteration limits (as passed to nlminb
),
and the maximum gradient of the likelihood in each assessment run. Also includes the number of optimization iterations
function evaluations reported by nlminb
for each application of the assessment model.
# \donttest{
OM < MSEtool::testOM; OM@proyears < 20
myMSE < runMSE(OM, MPs = "SCA_4010")
#> ✔ Checking MPs
#> ℹ Checking OM for completeness
#> ✔ Loading operating model
#> ✔ Optimizing for userspecified movement
#> ✔ Calculating MSY reference points for each year
#> ✔ Optimizing for userspecified depletion in last historical year
#> ✔ Calculating historical stock and fishing dynamics
#> ✔ Calculating perrecruit reference points
#> ✔ Calculating Blow reference points
#> ✔ Calculating reference yield  best fixed F strategy
#> ✔ Simulating observed data
#> ✔ Running forward projections
#> ✔ 1 / 1 Running MSE for SCA_4010
#>

===  5%

=====  11%

========  16%

===========  21%

=============  26%

================  32%

==================  37%

=====================  42%

========================  47%

==========================  53%

=============================  58%

================================  63%

==================================  68%

=====================================  74%

=======================================  79%

==========================================  84%

=============================================  89%

===============================================  95%

================================================== 100%
#>
diagnostic(myMSE)
#> ✔ Creating plots for MP:
#> SCA_4010
#> SCA_4010
#> Percent positivedefinite Hessian 100.00
#> Percent iteration limit reached 0.00
#> Percent max. gradient < 0.1 86.67
#> Median iterations 772.00
#> Median function evaluations 1119.00
# }