From 050b4176073298bdb176511e3a3dd29414635e33 Mon Sep 17 00:00:00 2001 From: kellijohnson-NOAA Date: Fri, 15 Apr 2022 06:11:31 -0700 Subject: [PATCH] feat: Saves model object if no standard errors are available Before, if there were no standard errors the model would continue instead of entering the early return. Errors/Warnings would arise because in the plotting of the index the standard errors are needed. We should not be doing diagnostics on models without inverted hessian matrices; so, now `VAST_do()` will exit early if the model did not converge rather than erroring out. --- R/VAST_do.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/VAST_do.R b/R/VAST_do.R index da47721..c3c3231 100644 --- a/R/VAST_do.R +++ b/R/VAST_do.R @@ -130,7 +130,8 @@ VAST_do <- function(Database, settings, conditiondir, compiledir, model_args = list(CompileDir = compiledir), silent = TRUE, run_model = TRUE), error = function(e) e) - if ("simpleError" %in% class(out)) { + if ("simpleError" %in% class(out) | + is.null(out$parameter_estimates$SD)) { save(out, file = file.path(conditiondir, "Error.RData")) save(list = ls(all.names = TRUE), file = file.path(conditiondir, "Save.RData")) return(out)