From 37bd36fe8a75163cbf0f97cb7a0e2f7466a53617 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 13 Oct 2022 03:48:54 +0200 Subject: Cope with failed FIM inversions --- R/mhmkin.R | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'R/mhmkin.R') diff --git a/R/mhmkin.R b/R/mhmkin.R index 15c92f3c..2cf9ba06 100644 --- a/R/mhmkin.R +++ b/R/mhmkin.R @@ -138,12 +138,19 @@ print.mhmkin <- function(x, ...) { #' @export convergence.mhmkin <- function(object, ...) { - all_summary_warnings <- character() - if (inherits(object[[1]], "saem.mmkin")) { test_func <- function(fit) { - if (inherits(fit$so, "try-error")) return("E") - else return("OK") + if (inherits(fit$so, "try-error")) { + return("E") + } else { + if (!is.null(fit$FIM_failed)) { + return_values <- c("fixed effects" = "Fth", + "random effects and error model parameters" = "FO") + return(paste(return_values[fit$FIM_failed], collapse = ", ")) + } else { + return("OK") + } + } } } else { stop("Only mhmkin objects containing saem.mmkin objects currently supported") @@ -163,6 +170,9 @@ print.convergence.mhmkin <- function(x, ...) { print(x, quote = FALSE) cat("\n") if (any(x == "OK")) cat("OK: Fit terminated successfully\n") + if (any(x == "Fth")) cat("Fth: Could not invert FIM for fixed effects\n") + if (any(x == "FO")) cat("FO: Could not invert FIM for random effects and error model parameters\n") + if (any(x == "Fth, FO")) cat("Fth, FO: Could not invert FIM for fixed effects, nor for random effects and error model parameters\n") if (any(x == "E")) cat("E: Error\n") } -- cgit v1.2.1