aboutsummaryrefslogtreecommitdiff
path: root/R/anova.saem.mmkin.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-11-04 10:54:43 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2022-11-04 10:54:43 +0100
commitce7a20e54d8005264f13d3e9fe0c99f84d20b85e (patch)
tree50e3ca40c5c13bb93495e4e1f2080e2e7db52439 /R/anova.saem.mmkin.R
parent0389d523f049945c85eba42d4a006523595043f0 (diff)
Make illparms.mhmkin and anova.saem.mmkin more robust
Diffstat (limited to 'R/anova.saem.mmkin.R')
-rw-r--r--R/anova.saem.mmkin.R5
1 files changed, 3 insertions, 2 deletions
diff --git a/R/anova.saem.mmkin.R b/R/anova.saem.mmkin.R
index e506fb8b..00ddc0c3 100644
--- a/R/anova.saem.mmkin.R
+++ b/R/anova.saem.mmkin.R
@@ -30,9 +30,10 @@ anova.saem.mmkin <- function(object, ...,
is_model <- sapply(dots, is, "saem.mmkin")
if (any(is_model)) {
mods <- c(list(object), dots[is_model])
+ successful <- sapply(mods, function(x) !inherits(x$so, "try-error"))
# Ensure same data, ignoring covariates
- same_data <- sapply(dots[is_model], function(x) {
+ same_data <- sapply(mods[successful], function(x) {
identical(object$data[c("ds", "name", "time", "value")],
x$data[c("ds", "name", "time", "value")])
})
@@ -56,7 +57,7 @@ anova.saem.mmkin <- function(object, ...,
}
names(mods) <- model.names
- llks <- lapply(model.names, function(x) {
+ llks <- lapply(model.names[successful], function(x) {
llk <- try(logLik(mods[[x]], method = method))
if (inherits(llk, "try-error"))
stop("Could not obtain log likelihood with '", method, "' method for ", x)

Contact - Imprint