From 904ba9668eb76eaae4960e2188134e8c88da07ee Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 7 Dec 2022 16:19:54 +0100 Subject: Fix parplot for the case of failed multistart runs --- NEWS.md | 2 ++ R/parms.R | 2 +- R/parplot.R | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 1931142c..4540b517 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,8 @@ - 'R/illparms.R': Also check if confidence intervals for slope parameters in covariate models include zero. Only implemented for fits obtained with the saemix backend. +- 'R/parplot.R': Make the function work also in the case that some of the multistart runs failed. + # mkin 1.2.1 (2022-11-19) - '{data,R}/ds_mixed.rda': Include the test data in the package instead of generating it in 'tests/testthat/setup_script.R'. Refactor the generating code to make it consistent and update tests. diff --git a/R/parms.R b/R/parms.R index bd4e479b..bb04a570 100644 --- a/R/parms.R +++ b/R/parms.R @@ -77,6 +77,6 @@ parms.multistart <- function(object, exclude_failed = TRUE, ...) { successful <- which(!is.na(res[, 1])) first_success <- successful[1] colnames(res) <- names(parms(object[[first_success]])) - if (exclude_failed) res <- res[successful, ] + if (exclude_failed[1]) res <- res[successful, ] return(res) } diff --git a/R/parplot.R b/R/parplot.R index 63306ac2..e9c18947 100644 --- a/R/parplot.R +++ b/R/parplot.R @@ -41,7 +41,7 @@ parplot.multistart.saem.mmkin <- function(object, llmin = -Inf, llquant = NA, orig <- attr(object, "orig") orig_parms <- parms(orig) start_degparms <- orig$mean_dp_start - all_parms <- parms(object) + all_parms <- parms(object, exclude_failed = FALSE) if (inherits(object, "multistart.saem.mmkin")) { llfunc <- function(object) { -- cgit v1.2.1