diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2022-10-21 16:25:32 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2022-10-21 16:26:29 +0200 |
commit | 1bd0e517fc58240c460a713d3bce2e1ca6dea9ec (patch) | |
tree | 089de12252d9dc14ef5677437ea191ecf47a8ea3 | |
parent | 32e38914d066c28db060e912b5df6c24470c9e14 (diff) |
Adapt summary.saem.mmkin to covariate models
Dissipation times are calculated for covariate values of zero currently,
which will usually not be very useful.
-rw-r--r-- | R/summary.saem.mmkin.R | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/R/summary.saem.mmkin.R b/R/summary.saem.mmkin.R index f41e7e20..c66294ab 100644 --- a/R/summary.saem.mmkin.R +++ b/R/summary.saem.mmkin.R @@ -87,18 +87,19 @@ summary.saem.mmkin <- function(object, data = FALSE, verbose = FALSE, distimes = mod_vars <- names(object$mkinmod$diffs) pnames <- names(object$mean_dp_start) - np <- length(pnames) + names_fixed_effects <- object$so@results@name.fixed + n_fixed <- length(names_fixed_effects) conf.int <- object$so@results@conf.int rownames(conf.int) <- conf.int$name - confint_trans <- as.matrix(conf.int[pnames, c("estimate", "lower", "upper")]) + confint_trans <- as.matrix(parms(object, ci = TRUE)) colnames(confint_trans)[1] <- "est." # In case objects were produced by earlier versions of saem if (is.null(object$transformations)) object$transformations <- "mkin" if (object$transformations == "mkin") { - bp <- backtransform_odeparms(confint_trans[, "est."], object$mkinmod, + bp <- backtransform_odeparms(confint_trans[pnames, "est."], object$mkinmod, object$transform_rates, object$transform_fractions) bpnames <- names(bp) @@ -135,12 +136,12 @@ summary.saem.mmkin <- function(object, data = FALSE, verbose = FALSE, distimes = } # Correlation of fixed effects (inspired by summary.nlme) - varFix <- vcov(object$so)[1:np, 1:np] + varFix <- vcov(object$so)[1:n_fixed, 1:n_fixed] stdFix <- sqrt(diag(varFix)) object$corFixed <- array( t(varFix/stdFix)/stdFix, dim(varFix), - list(pnames, pnames)) + list(names_fixed_effects, names_fixed_effects)) # Random effects sdnames <- intersect(rownames(conf.int), paste0("SD.", pnames)) @@ -152,7 +153,6 @@ summary.saem.mmkin <- function(object, data = FALSE, verbose = FALSE, distimes = confint_errmod <- as.matrix(conf.int[enames, c("estimate", "lower", "upper")]) colnames(confint_errmod)[1] <- "est." - object$confint_trans <- confint_trans object$confint_ranef <- confint_ranef object$confint_errmod <- confint_errmod @@ -210,7 +210,6 @@ print.summary.saem.mmkin <- function(x, digits = max(3, getOption("digits") - 3) cat("Using", paste(x$so@options$nbiter.saemix, collapse = ", "), "iterations and", x$so@options$nb.chains, "chains\n") - cat("\nVariance model: ") cat(switch(x$err_mod, const = "Constant variance", obs = "Variance unique to each observed variable", |