diagnostic: Diagnostic of assessments in MSE: did Assess models converge...

View source: R/diagnostic.R

diagnosticR Documentation

Diagnostic of assessments in MSE: did Assess models converge during MSE?

Description

Diagnostic check for convergence of Assess models during closed-loop simulation. Use when the MP was created with make_MP with argument diagnostic = "min" or "full". This function summarizes and plots the diagnostic information.

Usage

diagnostic(MSE, MP, gradient_threshold = 0.1, figure = TRUE)

diagnostic_AM(...)

Arguments

MSE

An object of class MSE created by MSEtool::runMSE().

MP

Optional, a character vector of MPs that use assessment models.

gradient_threshold

The maximum magnitude (absolute value) desired for the gradient of the likelihood.

figure

Logical, whether a figure will be drawn.

...

Arguments to pass to diagnostic.

Value

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 positive-definite Hessian matrix was obtained), the optimizer reached pre-specified iteration limits (as passed to stats::nlminb()), and the maximum gradient of the likelihood in each assessment run. Also includes the number of optimization iterations function evaluations reported by stats::nlminb() for each application of the assessment model.

Author(s)

Q. Huynh

See Also

retrospective_AM

Examples


OM <- MSEtool::testOM; OM@proyears <- 20
myMSE <- runMSE(OM, MPs = "SCA_4010")
diagnostic(myMSE)

# How to get all the reporting
library(dplyr)
conv_statistics <- lapply(1:myMSE@nMPs, function(m) {
  lapply(1:myMSE@nsim, function(x) {
    myMSE@PPD[[m]]@Misc[[x]]$diagnostic %>%
      mutate(MP = myMSE@MPs[m], Simulation = x)
 }) %>% bind_rows()
}) %>% bind_rows()


SAMtool documentation built on Sept. 11, 2024, 8:07 p.m.