From 5e4ea59a41e00b05ea6664c08c7922e892e8ab77 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Tue, 29 Oct 2019 10:12:12 +0100 Subject: Return single parameters correctly from confint Static documentation rebuilt by pkgdown --- R/confint.mkinfit.R | 26 +++++++++++++++----------- docs/reference/confint.mkinfit.html | 33 ++++++++++++++++++++++----------- man/confint.mkinfit.Rd | 20 +++++++++++--------- 3 files changed, 48 insertions(+), 31 deletions(-) diff --git a/R/confint.mkinfit.R b/R/confint.mkinfit.R index 75813360..fadd14ae 100644 --- a/R/confint.mkinfit.R +++ b/R/confint.mkinfit.R @@ -98,15 +98,17 @@ #' rel_diffs_transformed_ff #' rel_diffs_untransformed_ff #' -#' # The profiling for the following fit does not finish in a reasonable time -#' #m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")), -#' # M1 = mkinsub("SFO"), -#' # M2 = mkinsub("SFO"), -#' # use_of_ff = "max", quiet = TRUE) -#' #DFOP_par_c <- synthetic_data_for_UBA_2014[[12]]$data -#' #f_tc_2 <- mkinfit(m_synth_DFOP_par, DFOP_par_c, error_model = "tc", -#' # error_model_algorithm = "direct", quiet = TRUE) -#' #confint(f_tc_2, "parent_0") +#' # The profiling for the following fit does not finish in a reasonable time, +#' # therefore we use the quadratic approximation +#' m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")), +#' M1 = mkinsub("SFO"), +#' M2 = mkinsub("SFO"), +#' use_of_ff = "max", quiet = TRUE) +#' DFOP_par_c <- synthetic_data_for_UBA_2014[[12]]$data +#' f_tc_2 <- mkinfit(m_synth_DFOP_par, DFOP_par_c, error_model = "tc", +#' error_model_algorithm = "direct", quiet = TRUE) +#' confint(f_tc_2, method = "quadratic") +#' confint(f_tc_2, "parent_0", method = "quadratic") #' } #' @export confint.mkinfit <- function(object, parm, @@ -164,10 +166,12 @@ confint.mkinfit <- function(object, parm, if (transformed & backtransform) { lci_back <- backtransform_odeparms(lci, object$mkinmod, object$transform_rates, object$transform_fractions) - lci <- c(lci_back, lci[names(object$errparms)]) uci_back <- backtransform_odeparms(uci, object$mkinmod, object$transform_rates, object$transform_fractions) - uci <- c(uci_back, uci[names(object$errparms)]) + + return_errparm_names <- intersect(names(object$errparms), return_pnames) + lci <- c(lci_back, lci[return_errparm_names]) + uci <- c(uci_back, uci[return_errparm_names]) } } ci <- cbind(lower = lci, upper = uci) diff --git a/docs/reference/confint.mkinfit.html b/docs/reference/confint.mkinfit.html index 0053894b..27fdb304 100644 --- a/docs/reference/confint.mkinfit.html +++ b/docs/reference/confint.mkinfit.html @@ -236,7 +236,7 @@ machines, cores > 1 is not supported.

use_of_ff = "max", quiet = TRUE) f_d_1 <- mkinfit(SFO_SFO, subset(FOCUS_2006_D, value != 0), quiet = TRUE) system.time(ci_profile <- confint(f_d_1, cores = 1, quiet = TRUE))
#> User System verstrichen -#> 51.063 0.000 51.090
# The following does not save much time, as parent_0 takes up most of the time +#> 50.787 0.000 50.815
# The following does not save much time, as parent_0 takes up most of the time # system.time(ci_profile <- confint(f_d_1, cores = 5)) # system.time(ci_profile <- confint(f_d_1, # c("k_parent_sink", "k_parent_m1", "k_m1_sink", "sigma"), cores = 1)) @@ -322,16 +322,27 @@ machines, cores > 1 is not supported.

#> k_m1 0.0146746451 0.0025300990 #> f_parent_to_m1 0.0046997668 0.0023460293 #> sigma 0.0550252516 0.0327066836
-# The profiling for the following fit does not finish in a reasonable time -#m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")), -# M1 = mkinsub("SFO"), -# M2 = mkinsub("SFO"), -# use_of_ff = "max", quiet = TRUE) -#DFOP_par_c <- synthetic_data_for_UBA_2014[[12]]$data -#f_tc_2 <- mkinfit(m_synth_DFOP_par, DFOP_par_c, error_model = "tc", -# error_model_algorithm = "direct", quiet = TRUE) -#confint(f_tc_2, "parent_0") -# } +# The profiling for the following fit does not finish in a reasonable time, +# therefore we use the quadratic approximation +m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")), + M1 = mkinsub("SFO"), + M2 = mkinsub("SFO"), + use_of_ff = "max", quiet = TRUE) +DFOP_par_c <- synthetic_data_for_UBA_2014[[12]]$data +f_tc_2 <- mkinfit(m_synth_DFOP_par, DFOP_par_c, error_model = "tc", + error_model_algorithm = "direct", quiet = TRUE) +confint(f_tc_2, method = "quadratic")
#> 2.5% 97.5% +#> parent_0 94.596183241 106.19937044 +#> k_M1 0.037605436 0.04490758 +#> k_M2 0.008568746 0.01087675 +#> f_parent_to_M1 0.021464277 0.62023879 +#> f_parent_to_M2 0.015166876 0.37975352 +#> k1 0.273897622 0.33388081 +#> k2 0.018614564 0.02250380 +#> g 0.671943572 0.73583247 +#> sigma_low 0.251284138 0.83992136 +#> rsd_high 0.040410998 0.07661999
confint(f_tc_2, "parent_0", method = "quadratic")
#> 2.5% 97.5% +#> parent_0 94.59618 106.1994
# }