diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2022-09-26 12:46:21 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2022-09-26 12:46:21 +0200 |
commit | 75f361bed527b91bec205c5452add13247760d61 (patch) | |
tree | dc08c00f37d36a4d81d78d7f258f00fb40f66ca6 /R | |
parent | 486550c5feba7eba472a99bf501dd2496301e0ee (diff) |
Make BIC.mhmkin work with failed fits
Diffstat (limited to 'R')
-rw-r--r-- | R/mhmkin.R | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -177,7 +177,10 @@ AIC.mhmkin <- function(object, ..., k = 2) { #' @export BIC.mhmkin <- function(object, ...) { - res <- sapply(object, function(x) BIC(x$so)) + res <- sapply(object, function(x) { + if (inherits(x, "try-error")) return(NA) + else return(BIC(x$so, k = k)) + }) dim(res) <- dim(object) dimnames(res) <- dimnames(object) return(res) |