aboutsummaryrefslogtreecommitdiff
path: root/R/saemix.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-11-10 05:14:57 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2020-11-10 05:14:57 +0100
commit606ef9ad6cae0ddfae6db6b90deb03f81140e46f (patch)
tree5a0a581a2251621efdcbd5a5c425cb04eca306f5 /R/saemix.R
parent96500fa127b59bddb2fcfe77b7b97415bd105f4a (diff)
Digits for summary methods, print.saem.mmkin
Diffstat (limited to 'R/saemix.R')
-rw-r--r--R/saemix.R30
1 files changed, 30 insertions, 0 deletions
diff --git a/R/saemix.R b/R/saemix.R
index 8955aa54..68bbd233 100644
--- a/R/saemix.R
+++ b/R/saemix.R
@@ -139,6 +139,36 @@ saem.mmkin <- function(object,
return(result)
}
+#' @export
+#' @rdname saem
+#' @param x An saem.mmkin object to print
+#' @param digits Number of digits to use for printing
+print.saem.mmkin <- function(x, digits = max(3, getOption("digits") - 3), ...) {
+ cat( "Kinetic nonlinear mixed-effects model fit by SAEM" )
+ cat("\nStructural model:\n")
+ diffs <- x$mmkin[[1]]$mkinmod$diffs
+ nice_diffs <- gsub("^(d.*) =", "\\1/dt =", diffs)
+ writeLines(strwrap(nice_diffs, exdent = 11))
+ cat("\nData:\n")
+ cat(nrow(x$data), "observations of",
+ length(unique(x$data$name)), "variable(s) grouped in",
+ length(unique(x$data$ds)), "datasets\n")
+
+ cat("\nLikelihood computed by importance sampling\n")
+ print(data.frame(
+ AIC = AIC(x$so, type = "is"),
+ BIC = BIC(x$so, type = "is"),
+ logLik = logLik(x$so, type = "is"),
+ row.names = " "), digits = digits)
+
+ cat("\nFitted parameters:\n")
+ conf.int <- x$so@results@conf.int[c("estimate", "lower", "upper")]
+ rownames(conf.int) <- x$so@results@conf.int[["name"]]
+ print(conf.int, digits = digits)
+
+ invisible(x)
+}
+
#' @rdname saem
#' @return An [saemix::SaemixModel] object.
#' @export

Contact - Imprint