aboutsummaryrefslogtreecommitdiff
path: root/R/anova.saem.mmkin.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/anova.saem.mmkin.R')
-rw-r--r--R/anova.saem.mmkin.R14
1 files changed, 10 insertions, 4 deletions
diff --git a/R/anova.saem.mmkin.R b/R/anova.saem.mmkin.R
index 00ddc0c3..7e5fc80a 100644
--- a/R/anova.saem.mmkin.R
+++ b/R/anova.saem.mmkin.R
@@ -56,13 +56,19 @@ anova.saem.mmkin <- function(object, ...,
model.names <- paste0("MODEL",seq_along(model.names))
}
names(mods) <- model.names
+ mods <- mods[successful]
- 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)
+ llks <- lapply(names(mods), function(x) {
+ llk <- try(logLik(mods[[x]], method = method), silent = TRUE)
+ if (inherits(llk, "try-error")) {
+ warning("Could not obtain log likelihood with '", method, "' method for ", x)
+ llk <- NA
+ }
return(llk)
})
+ available <- !sapply(llks, is.na)
+ llks <- llks[available]
+ mods <- mods[available]
# Order models by increasing degrees of freedom:
npar <- vapply(llks, attr, FUN.VALUE=numeric(1), "df")

Contact - Imprint