From 05baf3bf92cba127fd2319b779db78be86170e5e Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 17 Jun 2021 13:58:34 +0200 Subject: Let backtransform_odeparms handle nlmixr formation fractions Also adapt summary.nlmixr.mmkin to correctly handle the way formation fractions are translated to nlmixr --- man/dimethenamid_2018.Rd | 36 ++++++++++++++++++++++++++++++++++++ man/nlmixr.mmkin.Rd | 15 +++++++++++---- man/tffm0.Rd | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 man/tffm0.Rd (limited to 'man') diff --git a/man/dimethenamid_2018.Rd b/man/dimethenamid_2018.Rd index b6f761e8..93fcad26 100644 --- a/man/dimethenamid_2018.Rd +++ b/man/dimethenamid_2018.Rd @@ -31,5 +31,41 @@ specific pieces of information in the comments. } \examples{ print(dimethenamid_2018) +dmta_ds <- lapply(1:8, function(i) { + ds_i <- dimethenamid_2018$ds[[i]]$data + ds_i[ds_i$name == "DMTAP", "name"] <- "DMTA" + ds_i$time <- ds_i$time * dimethenamid_2018$f_time_norm[i] + ds_i +}) +names(dmta_ds) <- sapply(dimethenamid_2018$ds, function(ds) ds$title) +dmta_ds[["Borstel"]] <- rbind(dmta_ds[["Borstel 1"]], dmta_ds[["Borstel 2"]]) +dmta_ds[["Borstel 1"]] <- NULL +dmta_ds[["Borstel 2"]] <- NULL +dmta_ds[["Elliot"]] <- rbind(dmta_ds[["Elliot 1"]], dmta_ds[["Elliot 2"]]) +dmta_ds[["Elliot 1"]] <- NULL +dmta_ds[["Elliot 2"]] <- NULL +\dontrun{ +dfop_sfo3_plus <- mkinmod( + DMTA = mkinsub("DFOP", c("M23", "M27", "M31")), + M23 = mkinsub("SFO"), + M27 = mkinsub("SFO"), + M31 = mkinsub("SFO", "M27", sink = FALSE), + quiet = TRUE +) +f_dmta_mkin_tc <- mmkin( + list("DFOP-SFO3+" = dfop_sfo3_plus), + dmta_ds, quiet = TRUE, error_model = "tc") +nlmixr_model(f_dmta_mkin_tc) +f_dmta_nlmixr_focei <- nlmixr(f_dmta_mkin_tc, est = "focei", + control = nlmixr::foceiControl(print = 500)) +summary(f_dmta_nlmixr_focei) +plot(f_dmta_nlmixr_focei) +# saem has a problem with this model/data combination, maybe because of the +# overparameterised error model, to be investigated +#f_dmta_nlmixr_saem <- nlmixr(f_dmta_mkin_tc, est = "saem", +# control = saemControl(print = 500)) +#summary(f_dmta_nlmixr_saem) +#plot(f_dmta_nlmixr_saem) +} } \keyword{datasets} diff --git a/man/nlmixr.mmkin.Rd b/man/nlmixr.mmkin.Rd index 4ab30272..0f4f41a2 100644 --- a/man/nlmixr.mmkin.Rd +++ b/man/nlmixr.mmkin.Rd @@ -16,6 +16,8 @@ error_model = object[[1]]$err_mod, test_log_parms = TRUE, conf.level = 0.6, + degparms_start = "auto", + eta_start = "auto", ..., save = NULL, envir = parent.frame() @@ -27,7 +29,8 @@ nlmixr_model( object, est = c("saem", "focei"), degparms_start = "auto", - test_log_parms = FALSE, + eta_start = "auto", + test_log_parms = TRUE, conf.level = 0.6, error_model = object[[1]]$err_mod, add_attributes = FALSE @@ -58,6 +61,13 @@ when calculating mean degradation parameters using \link{mean_degparms}.} \item{conf.level}{Possibility to adjust the required confidence level for parameter that are tested if requested by 'test_log_parms'.} +\item{degparms_start}{Parameter values given as a named numeric vector will +be used to override the starting values obtained from the 'mmkin' object.} + +\item{eta_start}{Standard deviations on the transformed scale given as a +named numeric vector will be used to override the starting values obtained +from the 'mmkin' object.} + \item{\dots}{Passed to \link{nlmixr_model}} \item{save}{Passed to \link[nlmixr:nlmixr]{nlmixr::nlmixr}} @@ -68,9 +78,6 @@ for parameter that are tested if requested by 'test_log_parms'.} \item{digits}{Number of digits to use for printing} -\item{degparms_start}{Parameter values given as a named numeric vector will -be used to override the starting values obtained from the 'mmkin' object.} - \item{add_attributes}{Should the starting values used for degradation model parameters and their distribution and for the error model parameters be returned as attributes?} diff --git a/man/tffm0.Rd b/man/tffm0.Rd new file mode 100644 index 00000000..46978d5e --- /dev/null +++ b/man/tffm0.Rd @@ -0,0 +1,42 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/tffm0.R +\name{tffm0} +\alias{tffm0} +\alias{invtffm0} +\title{Transform formation fractions as in the first published mkin version} +\usage{ +tffm0(ff) + +invtffm0(ff_trans) +} +\arguments{ +\item{ff}{Vector of untransformed formation fractions. The sum +must be smaller or equal to one} + +\item{ff_trans}{Vector of transformed formation fractions that can be +restricted to the interval from 0 to 1} +} +\value{ +A vector of the transformed formation fractions + +A vector of backtransformed formation fractions for natural use in degradation models +} +\description{ +The transformed fractions can be restricted between 0 and 1 in model +optimisations. Therefore this transformation was used originally in mkin. It +was later replaced by the \link{ilr} transformation because the ilr transformed +fractions can assumed to follow normal distribution. As the ilr +transformation is not available in \link{RxODE} and can therefore not be used in +the nlmixr modelling language, this transformation is currently used for +translating mkin models with formation fractions to more than one target +compartment for fitting with nlmixr in \link{nlmixr_model}. However, +this implementation cannot be used there, as it is not accessible +from RxODE. +} +\examples{ +ff_example <- c( + 0.10983681, 0.09035905, 0.08399383 +) +ff_example_trans <- tffm0(ff_example) +invtffm0(ff_example_trans) +} -- cgit v1.2.1