From e6f9e9ca89e35e610d9895b979f1351a47451db0 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 29 May 2020 16:05:11 +0200 Subject: Improve handling of warnings, reorganize tests --- R/summary.mkinfit.R | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'R/summary.mkinfit.R') diff --git a/R/summary.mkinfit.R b/R/summary.mkinfit.R index 2c291ffd..f9858c32 100644 --- a/R/summary.mkinfit.R +++ b/R/summary.mkinfit.R @@ -122,7 +122,7 @@ summary.mkinfit <- function(object, data = TRUE, distimes = TRUE, alpha = 0.05, date.fit = object$date, date.summary = date(), solution_type = object$solution_type, - warning = object$warning, + warnings = object$summary_warnings, use_of_ff = object$mkinmod$use_of_ff, error_model_algorithm = object$error_model_algorithm, df = c(p, rdf), @@ -190,8 +190,6 @@ print.summary.mkinfit <- function(x, digits = max(3, getOption("digits") - 3), . cat("Date of fit: ", x$date.fit, "\n") cat("Date of summary:", x$date.summary, "\n") - if (!is.null(x$warning)) cat("\n\nWarning:", x$warning, "\n\n") - cat("\nEquations:\n") nice_diffs <- gsub("^(d.*) =", "\\1/dt =", x[["diffs"]]) writeLines(strwrap(nice_diffs, exdent = 11)) @@ -223,16 +221,20 @@ print.summary.mkinfit <- function(x, digits = max(3, getOption("digits") - 3), . if(length(x$fixed$value) == 0) cat("None\n") else print(x$fixed) + # We used to only have one warning - show this for summarising old objects + if (!is.null(x[["warning"]])) cat("\n\nWarning:", x$warning, "\n\n") + + if (length(x$warnings) > 0) { + cat("\n\nWarning(s):", "\n") + cat(x$warnings, sep = "\n") + } + if (!is.null(x$AIC)) { cat("\nResults:\n\n") print(data.frame(AIC = x$AIC, BIC = x$BIC, logLik = x$logLik, row.names = " ")) } - if (!is.null(x$shapiro.p) && x$shapiro.p < 0.05) { - warning("The p-value for the Shapiro-Wilk test of normality on standardized residuals is < 0.05") - } - cat("\nOptimised, transformed parameters with symmetric confidence intervals:\n") print(signif(x$par, digits = digits)) -- cgit v1.2.1