aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-09-26 12:46:21 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2022-09-26 12:46:21 +0200
commit75f361bed527b91bec205c5452add13247760d61 (patch)
treedc08c00f37d36a4d81d78d7f258f00fb40f66ca6 /R
parent486550c5feba7eba472a99bf501dd2496301e0ee (diff)
Make BIC.mhmkin work with failed fits
Diffstat (limited to 'R')
-rw-r--r--R/mhmkin.R5
1 files changed, 4 insertions, 1 deletions
diff --git a/R/mhmkin.R b/R/mhmkin.R
index 61d67204..b72ae318 100644
--- a/R/mhmkin.R
+++ b/R/mhmkin.R
@@ -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)

Contact - Imprint