diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2020-04-17 11:21:32 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-04-17 11:21:32 +0200 |
commit | 3e601788eb7393d233d19328a11845130b5b29e5 (patch) | |
tree | 872284a38605dfc8ad94680be0ee9f43590a5fa7 /R | |
parent | 9aa5920aa3942b7843e357ab5163fa86de05f999 (diff) |
Fix summarizing old objects
Diffstat (limited to 'R')
-rw-r--r-- | R/summary.mkinfit.R | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/R/summary.mkinfit.R b/R/summary.mkinfit.R index 246bc41d..a67f17ee 100644 --- a/R/summary.mkinfit.R +++ b/R/summary.mkinfit.R @@ -125,9 +125,6 @@ summary.mkinfit <- function(object, data = TRUE, distimes = TRUE, alpha = 0.05, warning = object$warning, use_of_ff = object$mkinmod$use_of_ff, error_model_algorithm = object$error_model_algorithm, - AIC = AIC(object), - BIC = BIC(object), - logLik = logLik(object), df = c(p, rdf), covar = covar, covar_notrans = covar_notrans, @@ -142,6 +139,13 @@ summary.mkinfit <- function(object, data = TRUE, distimes = TRUE, alpha = 0.05, ans$fit_version <- object$version ans$fit_Rversion <- object$Rversion } + + AIC <- try(AIC(object)) + if (!inherits(AIC, "try-error")) { + ans$AIC = AIC(object) + ans$BIC = BIC(object) + ans$logLik = logLik(object) + } ans$diffs <- object$mkinmod$diffs if(data) ans$data <- object$data @@ -220,9 +224,11 @@ print.summary.mkinfit <- function(x, digits = max(3, getOption("digits") - 3), . if(length(x$fixed$value) == 0) cat("None\n") else print(x$fixed) - cat("\nResults:\n\n") - print(data.frame(AIC = x$AIC, BIC = x$BIC, logLik = x$logLik, - row.names = " ")) + if (!is.null(x$AIC)) { + cat("\nResults:\n\n") + print(data.frame(AIC = x$AIC, BIC = x$BIC, logLik = x$logLik, + row.names = " ")) + } cat("\nOptimised, transformed parameters with symmetric confidence intervals:\n") print(signif(x$par, digits = digits)) |