From 1bd0e517fc58240c460a713d3bce2e1ca6dea9ec Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 21 Oct 2022 16:25:32 +0200 Subject: Adapt summary.saem.mmkin to covariate models Dissipation times are calculated for covariate values of zero currently, which will usually not be very useful. --- R/summary.saem.mmkin.R | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'R') 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", -- cgit v1.2.1