aboutsummaryrefslogtreecommitdiff
path: root/R/summary.mmkin.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/summary.mmkin.R')
-rw-r--r--R/summary.mmkin.R56
1 files changed, 56 insertions, 0 deletions
diff --git a/R/summary.mmkin.R b/R/summary.mmkin.R
new file mode 100644
index 00000000..5f4a048b
--- /dev/null
+++ b/R/summary.mmkin.R
@@ -0,0 +1,56 @@
+#' Summary method for class "mmkin"
+#'
+#' Shows convergence information on the [mkinfit] objects contained in the object
+#' and gives an overview of ill-defined parameters calculated by [illparms].
+#'
+#' @param object an object of class [mmkin]
+#' @param x an object of class \code{summary.mmkin}.
+#' @param conf.level confidence level for testing parameters
+#' @param digits number of digits to use for printing
+#' @param \dots optional arguments passed to methods like \code{print}.
+#' @examples
+#'
+#' fits <- mmkin(
+#' c("SFO", "FOMC"),
+#' list("FOCUS A" = FOCUS_2006_A,
+#' "FOCUS C" = FOCUS_2006_C),
+#' quiet = TRUE, cores = 1)
+#' summary(fits)
+#'
+#' @export
+summary.mmkin <- function(object, conf.level = 0.95, ...) {
+
+ ans <- list(
+ err_mod = object[[1, 1]]$err_mod,
+ time = attr(object, "time"),
+ illparms = illparms(object),
+ convergence = convergence(object)
+ )
+
+ class(ans) <- c("summary.mmkin")
+ return(ans)
+}
+
+#' @rdname summary.mmkin
+#' @export
+print.summary.mmkin <- function(x, digits = max(3, getOption("digits") - 3), ...) {
+ if (!is.null(x$err_mod)) {
+ cat("Error model: ")
+ cat(switch(x$err_mod,
+ const = "Constant variance",
+ obs = "Variance unique to each observed variable",
+ tc = "Two-component variance function"), "\n")
+ }
+ cat("Fitted in", x$time[["elapsed"]], "s\n")
+
+ cat("\nConvergence:\n")
+ print(x$convergence)
+
+ if (any(x$illparms != "")) {
+ cat("\nIll-defined parameters:\n")
+ print(x$illparms)
+ }
+
+ invisible(x)
+}
+

Contact - Imprint