diff options
-rw-r--r-- | R/confint.mkinfit.R | 26 | ||||
-rw-r--r-- | docs/reference/confint.mkinfit.html | 33 | ||||
-rw-r--r-- | 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.</p></td> <span class='kw'>use_of_ff</span> <span class='kw'>=</span> <span class='st'>"max"</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='no'>f_d_1</span> <span class='kw'><-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='no'>SFO_SFO</span>, <span class='fu'><a href='https://rdrr.io/r/base/subset.html'>subset</a></span>(<span class='no'>FOCUS_2006_D</span>, <span class='no'>value</span> <span class='kw'>!=</span> <span class='fl'>0</span>), <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) <span class='fu'><a href='https://rdrr.io/r/base/system.time.html'>system.time</a></span>(<span class='no'>ci_profile</span> <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>confint</a></span>(<span class='no'>f_d_1</span>, <span class='kw'>cores</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>))</div><div class='output co'>#> User System verstrichen -#> 51.063 0.000 51.090 </div><div class='input'><span class='co'># The following does not save much time, as parent_0 takes up most of the time</span> +#> 50.787 0.000 50.815 </div><div class='input'><span class='co'># The following does not save much time, as parent_0 takes up most of the time</span> <span class='co'># system.time(ci_profile <- confint(f_d_1, cores = 5))</span> <span class='co'># system.time(ci_profile <- confint(f_d_1,</span> <span class='co'># c("k_parent_sink", "k_parent_m1", "k_m1_sink", "sigma"), cores = 1))</span> @@ -322,16 +322,27 @@ machines, cores > 1 is not supported.</p></td> #> k_m1 0.0146746451 0.0025300990 #> f_parent_to_m1 0.0046997668 0.0023460293 #> sigma 0.0550252516 0.0327066836</div><div class='input'> -# 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") -# } +<span class='co'># The profiling for the following fit does not finish in a reasonable time,</span> +<span class='co'># therefore we use the quadratic approximation</span> +<span class='no'>m_synth_DFOP_par</span> <span class='kw'><-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"DFOP"</span>, <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"M1"</span>, <span class='st'>"M2"</span>)), + <span class='kw'>M1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>), + <span class='kw'>M2</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>), + <span class='kw'>use_of_ff</span> <span class='kw'>=</span> <span class='st'>"max"</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) +<span class='no'>DFOP_par_c</span> <span class='kw'><-</span> <span class='no'>synthetic_data_for_UBA_2014</span><span class='kw'>[[</span><span class='fl'>12</span>]]$<span class='no'>data</span> +<span class='no'>f_tc_2</span> <span class='kw'><-</span> <span class='fu'><a href='mkinfit.html'>mkinfit</a></span>(<span class='no'>m_synth_DFOP_par</span>, <span class='no'>DFOP_par_c</span>, <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='st'>"tc"</span>, + <span class='kw'>error_model_algorithm</span> <span class='kw'>=</span> <span class='st'>"direct"</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) +<span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>confint</a></span>(<span class='no'>f_tc_2</span>, <span class='kw'>method</span> <span class='kw'>=</span> <span class='st'>"quadratic"</span>)</div><div class='output co'>#> 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</div><div class='input'><span class='fu'><a href='https://rdrr.io/r/stats/confint.html'>confint</a></span>(<span class='no'>f_tc_2</span>, <span class='st'>"parent_0"</span>, <span class='kw'>method</span> <span class='kw'>=</span> <span class='st'>"quadratic"</span>)</div><div class='output co'>#> 2.5% 97.5% +#> parent_0 94.59618 106.1994</div><div class='input'># } </div></pre> </div> <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> diff --git a/man/confint.mkinfit.Rd b/man/confint.mkinfit.Rd index 99f5875c..bad73407 100644 --- a/man/confint.mkinfit.Rd +++ b/man/confint.mkinfit.Rd @@ -112,15 +112,17 @@ rel_diffs_untransformed_ff <- abs((ci_quadratic_untransformed_ff - ci_profile_ff 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") } } \references{ |