aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to 'R')
-rw-r--r--R/mhmkin.R10
1 files changed, 8 insertions, 2 deletions
diff --git a/R/mhmkin.R b/R/mhmkin.R
index 17c8a1f7..15c92f3c 100644
--- a/R/mhmkin.R
+++ b/R/mhmkin.R
@@ -168,8 +168,11 @@ print.convergence.mhmkin <- function(x, ...) {
#' @export
AIC.mhmkin <- function(object, ..., k = 2) {
+ if (inherits(object[[1]], "saem.mmkin")) {
+ check_failed <- function(x) if (inherits(x$so, "try-error")) TRUE else FALSE
+ }
res <- sapply(object, function(x) {
- if (inherits(x, "try-error")) return(NA)
+ if (check_failed(x)) return(NA)
else return(AIC(x$so, k = k))
})
dim(res) <- dim(object)
@@ -179,8 +182,11 @@ AIC.mhmkin <- function(object, ..., k = 2) {
#' @export
BIC.mhmkin <- function(object, ...) {
+ if (inherits(object[[1]], "saem.mmkin")) {
+ check_failed <- function(x) if (inherits(x$so, "try-error")) TRUE else FALSE
+ }
res <- sapply(object, function(x) {
- if (inherits(x, "try-error")) return(NA)
+ if (check_failed(x)) return(NA)
else return(BIC(x$so))
})
dim(res) <- dim(object)

Contact - Imprint