From 6d6dc7d53bf99b088af3488588574afc832fb7fe Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 19 Mar 2021 11:22:07 +0100 Subject: test_log_parms for plot.mixed.mmkin, roxygen run --- NEWS.md | 4 +++- R/mixed.mmkin.R | 3 ++- R/plot.mixed.mmkin.R | 8 +++++++- man/mixed.Rd | 4 ++++ man/plot.mixed.mmkin.Rd | 8 ++++++++ man/saem.Rd | 10 +++++++--- 6 files changed, 31 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index 5d0ea69a..a91523bd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,7 +12,9 @@ - 'saem': generic function to fit saemix models using 'saemix_model' and 'saemix_data', with a generator 'saem.mmkin', summary and plot methods -- 'mean_degparms': New argument 'test_log_parms' that makes the function only consider log-transformed parameters where the untransformed parameters pass the t-test for a certain confidence level. This can be used to check more plausible parameters for 'saem' +- 'mean_degparms': New argument 'test_log_parms' that makes the function only consider log-transformed parameters where the untransformed parameters pass the t-test for a certain confidence level. This can be used to obtain more plausible starting parameters for 'saem' + +- 'plot.mixed.mmkin': Gains arguments 'test_log_parms' and 'conf.level' # mkin 1.0.4 (Unreleased) diff --git a/R/mixed.mmkin.R b/R/mixed.mmkin.R index 7aa5edd5..682a9a34 100644 --- a/R/mixed.mmkin.R +++ b/R/mixed.mmkin.R @@ -3,6 +3,8 @@ #' @param object An [mmkin] row object #' @param method The method to be used #' @param \dots Currently not used +#' @return An object of class 'mixed.mmkin' which has the observed data in a +#' single dataframe which is convenient for plotting #' @examples #' sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) #' n_biphasic <- 8 @@ -54,7 +56,6 @@ mixed.mmkin <- function(object, method = c("none"), ...) { if (nrow(object) > 1) stop("Only row objects allowed") method <- match.arg(method) - if (method == "default") method = c("naive", "nlme") ds_names <- colnames(object) res <- list(mmkin = object, mkinmod = object[[1]]$mkinmod) diff --git a/R/plot.mixed.mmkin.R b/R/plot.mixed.mmkin.R index 21399496..f0682c10 100644 --- a/R/plot.mixed.mmkin.R +++ b/R/plot.mixed.mmkin.R @@ -10,6 +10,10 @@ utils::globalVariables("ds") #' `resplot = "time"`. #' @param pred_over Named list of alternative predictions as obtained #' from [mkinpredict] with a compatible [mkinmod]. +#' @param test_log_parms Passed to [mean_degparms] in the case of an +#' [mixed.mmkin] object +#' @param conf.level Passed to [mean_degparms] in the case of an +#' [mixed.mmkin] object #' @param rel.height.legend The relative height of the legend shown on top #' @param rel.height.bottom The relative height of the bottom plot row #' @param ymax Vector of maximum y axis values @@ -58,6 +62,8 @@ plot.mixed.mmkin <- function(x, xlim = range(x$data$time), resplot = c("predicted", "time"), pred_over = NULL, + test_log_parms = FALSE, + conf.level = 0.6, ymax = "auto", maxabs = "auto", ncol.legend = ifelse(length(i) <= 3, length(i) + 1, ifelse(length(i) <= 8, 3, 4)), nrow.legend = ceiling((length(i) + 1) / ncol.legend), @@ -76,7 +82,7 @@ plot.mixed.mmkin <- function(x, backtransform = TRUE if (identical(class(x), "mixed.mmkin")) { - degparms_pop <- mean_degparms(x$mmkin) + degparms_pop <- mean_degparms(x$mmkin, test_log_parms = test_log_parms, conf.level = conf.level) degparms_tmp <- parms(x$mmkin, transformed = TRUE) degparms_i <- as.data.frame(t(degparms_tmp[setdiff(rownames(degparms_tmp), names(fit_1$errparms)), ])) diff --git a/man/mixed.Rd b/man/mixed.Rd index 8b00382d..95cae364 100644 --- a/man/mixed.Rd +++ b/man/mixed.Rd @@ -23,6 +23,10 @@ mixed(object, ...) \item{digits}{Number of digits to use for printing.} } +\value{ +An object of class 'mixed.mmkin' which has the observed data in a +single dataframe which is convenient for plotting +} \description{ Create a mixed effects model from an mmkin row object } diff --git a/man/plot.mixed.mmkin.Rd b/man/plot.mixed.mmkin.Rd index b1200729..bcab3e74 100644 --- a/man/plot.mixed.mmkin.Rd +++ b/man/plot.mixed.mmkin.Rd @@ -13,6 +13,8 @@ xlim = range(x$data$time), resplot = c("predicted", "time"), pred_over = NULL, + test_log_parms = FALSE, + conf.level = 0.6, ymax = "auto", maxabs = "auto", ncol.legend = ifelse(length(i) <= 3, length(i) + 1, ifelse(length(i) <= 8, 3, 4)), @@ -49,6 +51,12 @@ predicted values?} \item{pred_over}{Named list of alternative predictions as obtained from \link{mkinpredict} with a compatible \link{mkinmod}.} +\item{test_log_parms}{Passed to \link{mean_degparms} in the case of an +\link{mixed.mmkin} object} + +\item{conf.level}{Passed to \link{mean_degparms} in the case of an +\link{mixed.mmkin} object} + \item{ymax}{Vector of maximum y axis values} \item{maxabs}{Maximum absolute value of the residuals. This is used for the diff --git a/man/saem.Rd b/man/saem.Rd index 45f74e44..f462f405 100644 --- a/man/saem.Rd +++ b/man/saem.Rd @@ -17,8 +17,9 @@ saem(object, ...) test_log_parms = FALSE, conf.level = 0.6, solution_type = "auto", - control = list(displayProgress = FALSE, print = FALSE, save = FALSE, save.graphs = - FALSE), + nbiter.saemix = c(300, 100), + control = list(displayProgress = FALSE, print = FALSE, nbiter.saemix = nbiter.saemix, + save = FALSE, save.graphs = FALSE), fail_with_errors = TRUE, verbose = FALSE, quiet = FALSE, @@ -65,7 +66,10 @@ for parameter that are tested if requested by 'test_log_parms'.} \item{solution_type}{Possibility to specify the solution type in case the automatic choice is not desired} -\item{control}{Passed to \link[saemix:saemix]{saemix::saemix}} +\item{nbiter.saemix}{Convenience option to increase the number of +iterations} + +\item{control}{Passed to \link[saemix:saemix]{saemix::saemix}.} \item{fail_with_errors}{Should a failure to compute standard errors from the inverse of the Fisher Information Matrix be a failure?} -- cgit v1.2.1