diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2022-10-30 18:01:04 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2022-10-30 18:01:04 +0100 |
commit | 4ad235a0e23718c9ad855b25e3a8e24971cc3ccc (patch) | |
tree | c71255f208ef1dde71a2d3e60c4a84989be8b7e6 | |
parent | 1aad99fea0070ab23b17acda618a08b12c273380 (diff) |
saem summary in case of non-invertible FIM parts
-rw-r--r-- | R/summary.saem.mmkin.R | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/R/summary.saem.mmkin.R b/R/summary.saem.mmkin.R index 651cc29e..ea2f02e2 100644 --- a/R/summary.saem.mmkin.R +++ b/R/summary.saem.mmkin.R @@ -136,12 +136,16 @@ summary.saem.mmkin <- function(object, data = FALSE, verbose = FALSE, distimes = } # Correlation of fixed effects (inspired by summary.nlme) - varFix <- vcov(object$so)[1:n_fixed, 1:n_fixed] - stdFix <- sqrt(diag(varFix)) - object$corFixed <- array( - t(varFix/stdFix)/stdFix, - dim(varFix), - list(names_fixed_effects, names_fixed_effects)) + varFix <- try(vcov(object$so)[1:n_fixed, 1:n_fixed]) + if (inherits(varFix, "try-error")) { + object$corFixed <- NA + } else { + stdFix <- sqrt(diag(varFix)) + object$corFixed <- array( + t(varFix/stdFix)/stdFix, + dim(varFix), + list(names_fixed_effects, names_fixed_effects)) + } # Random effects sdnames <- intersect(rownames(conf.int), paste0("SD.", pnames)) @@ -231,7 +235,9 @@ print.summary.saem.mmkin <- function(x, digits = max(3, getOption("digits") - 3) cat("\nOptimised parameters:\n") print(x$confint_trans, digits = digits) - if (nrow(x$confint_trans) > 1) { + if (identical(x$corFixed, NA)) { + cat("\nCorrelation is not available\n") + } else { corr <- x$corFixed class(corr) <- "correlation" print(corr, title = "\nCorrelation:", rdig = digits, ...) |