From 121e38654eea03c91aa117da58fc342feff01756 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Tue, 5 Oct 2021 16:55:41 +0200 Subject: Fix nlmixr for logit transformed parameters --- R/nlmixr.R | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'R') diff --git a/R/nlmixr.R b/R/nlmixr.R index f8fffba9..55a7bdd7 100644 --- a/R/nlmixr.R +++ b/R/nlmixr.R @@ -92,11 +92,11 @@ nlmixr::nlmixr #' plot(f_nlmixr_fomc_saem_tc) #' #' sfo_sfo <- mkinmod(parent = mkinsub("SFO", "A1"), -#' A1 = mkinsub("SFO")) +#' A1 = mkinsub("SFO"), quiet = TRUE) #' fomc_sfo <- mkinmod(parent = mkinsub("FOMC", "A1"), -#' A1 = mkinsub("SFO")) +#' A1 = mkinsub("SFO"), quiet = TRUE) #' dfop_sfo <- mkinmod(parent = mkinsub("DFOP", "A1"), -#' A1 = mkinsub("SFO")) +#' A1 = mkinsub("SFO"), quiet = TRUE) #' #' f_mmkin_const <- mmkin(list( #' "SFO-SFO" = sfo_sfo, "FOMC-SFO" = fomc_sfo, "DFOP-SFO" = dfop_sfo), @@ -108,6 +108,8 @@ nlmixr::nlmixr #' "SFO-SFO" = sfo_sfo, "FOMC-SFO" = fomc_sfo, "DFOP-SFO" = dfop_sfo), #' ds, quiet = TRUE, error_model = "tc") #' +#' nlmixr_model(f_mmkin_const["SFO-SFO", ]) +#' #' # A single constant variance is currently only possible with est = 'focei' in nlmixr #' f_nlmixr_sfo_sfo_focei_const <- nlmixr(f_mmkin_const["SFO-SFO", ], est = "focei") #' f_nlmixr_fomc_sfo_focei_const <- nlmixr(f_mmkin_const["FOMC-SFO", ], est = "focei") @@ -450,9 +452,14 @@ nlmixr_model <- function(object, # Population initial values for logit transformed parameters for (parm_name in grep("_qlogis$", names(degparms_start), value = TRUE)) { + parm_name_new <- names( + backtransform_odeparms(degparms_start[parm_name], + object[[1]]$mkinmod, + object[[1]]$transform_rates, + object[[1]]$transform_fractions)) model_block <- paste0( model_block, - gsub("_qlogis$", "", parm_name), " = ", + parm_name_new, " = ", "expit(", parm_name, " + eta.", parm_name, ")\n") } -- cgit v1.2.1