From 524a8bba89b95840b4e9215c403947a8bb76d7b2 Mon Sep 17 00:00:00 2001
From: Johannes Ranke
title
The name of the dataset, e.g. SFO_lin_a
data
A data frame with the data in the form expected by mkinfit
-- cgit v1.2.1# \dontrun{ # The data have been generated using the following kinetic models -m_synth_SFO_lin <- mkinmod(parent = list(type = "SFO", to = "M1"), - M1 = list(type = "SFO", to = "M2"), - M2 = list(type = "SFO"), use_of_ff = "max")#>- -m_synth_SFO_par <- mkinmod(parent = list(type = "SFO", to = c("M1", "M2"), - sink = FALSE), - M1 = list(type = "SFO"), - M2 = list(type = "SFO"), use_of_ff = "max")#>-m_synth_DFOP_lin <- mkinmod(parent = list(type = "DFOP", to = "M1"), - M1 = list(type = "SFO", to = "M2"), - M2 = list(type = "SFO"), use_of_ff = "max")#>-m_synth_DFOP_par <- mkinmod(parent = list(type = "DFOP", to = c("M1", "M2"), - sink = FALSE), - M1 = list(type = "SFO"), - M2 = list(type = "SFO"), use_of_ff = "max")#>+m_synth_SFO_lin <- mkinmod(parent = list(type = "SFO", to = "M1"), + M1 = list(type = "SFO", to = "M2"), + M2 = list(type = "SFO"), use_of_ff = "max") +#>+ +m_synth_SFO_par <- mkinmod(parent = list(type = "SFO", to = c("M1", "M2"), + sink = FALSE), + M1 = list(type = "SFO"), + M2 = list(type = "SFO"), use_of_ff = "max") +#>+m_synth_DFOP_lin <- mkinmod(parent = list(type = "DFOP", to = "M1"), + M1 = list(type = "SFO", to = "M2"), + M2 = list(type = "SFO"), use_of_ff = "max") +#>+m_synth_DFOP_par <- mkinmod(parent = list(type = "DFOP", to = c("M1", "M2"), + sink = FALSE), + M1 = list(type = "SFO"), + M2 = list(type = "SFO"), use_of_ff = "max") +#># The model predictions without intentional error were generated as follows -sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) - -d_synth_SFO_lin <- mkinpredict(m_synth_SFO_lin, - c(k_parent = 0.7, f_parent_to_M1 = 0.8, - k_M1 = 0.3, f_M1_to_M2 = 0.7, - k_M2 = 0.02), - c(parent = 100, M1 = 0, M2 = 0), - sampling_times) - -d_synth_DFOP_lin <- mkinpredict(m_synth_DFOP_lin, - c(k1 = 0.2, k2 = 0.02, g = 0.5, - f_parent_to_M1 = 0.5, k_M1 = 0.3, - f_M1_to_M2 = 0.7, k_M2 = 0.02), - c(parent = 100, M1 = 0, M2 = 0), - sampling_times) - -d_synth_SFO_par <- mkinpredict(m_synth_SFO_par, - c(k_parent = 0.2, - f_parent_to_M1 = 0.8, k_M1 = 0.01, - f_parent_to_M2 = 0.2, k_M2 = 0.02), - c(parent = 100, M1 = 0, M2 = 0), - sampling_times) - -d_synth_DFOP_par <- mkinpredict(m_synth_DFOP_par, - c(k1 = 0.3, k2 = 0.02, g = 0.7, - f_parent_to_M1 = 0.6, k_M1 = 0.04, - f_parent_to_M2 = 0.4, k_M2 = 0.01), - c(parent = 100, M1 = 0, M2 = 0), - sampling_times) +sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) + +d_synth_SFO_lin <- mkinpredict(m_synth_SFO_lin, + c(k_parent = 0.7, f_parent_to_M1 = 0.8, + k_M1 = 0.3, f_M1_to_M2 = 0.7, + k_M2 = 0.02), + c(parent = 100, M1 = 0, M2 = 0), + sampling_times) + +d_synth_DFOP_lin <- mkinpredict(m_synth_DFOP_lin, + c(k1 = 0.2, k2 = 0.02, g = 0.5, + f_parent_to_M1 = 0.5, k_M1 = 0.3, + f_M1_to_M2 = 0.7, k_M2 = 0.02), + c(parent = 100, M1 = 0, M2 = 0), + sampling_times) + +d_synth_SFO_par <- mkinpredict(m_synth_SFO_par, + c(k_parent = 0.2, + f_parent_to_M1 = 0.8, k_M1 = 0.01, + f_parent_to_M2 = 0.2, k_M2 = 0.02), + c(parent = 100, M1 = 0, M2 = 0), + sampling_times) + +d_synth_DFOP_par <- mkinpredict(m_synth_DFOP_par, + c(k1 = 0.3, k2 = 0.02, g = 0.7, + f_parent_to_M1 = 0.6, k_M1 = 0.04, + f_parent_to_M2 = 0.4, k_M2 = 0.01), + c(parent = 100, M1 = 0, M2 = 0), + sampling_times) # Construct names for datasets with errors -d_synth_names = paste0("d_synth_", c("SFO_lin", "SFO_par", - "DFOP_lin", "DFOP_par")) +d_synth_names = paste0("d_synth_", c("SFO_lin", "SFO_par", + "DFOP_lin", "DFOP_par")) # Original function used or adding errors. The add_err function now published # with this package is a slightly generalised version where the names of @@ -268,33 +272,35 @@ Compare also the code in the example section to see the degradation models." /> # The following is the simplified version of the two-component model of Rocke # and Lorenzato (1995) -sdfunc_twocomp = function(value, sd_low, rsd_high) { - sqrt(sd_low^2 + value^2 * rsd_high^2) -} +sdfunc_twocomp = function(value, sd_low, rsd_high) { + sqrt(sd_low^2 + value^2 * rsd_high^2) +} # Add the errors. -for (d_synth_name in d_synth_names) -{ - d_synth = get(d_synth_name) - assign(paste0(d_synth_name, "_a"), add_err(d_synth, function(value) 3)) - assign(paste0(d_synth_name, "_b"), add_err(d_synth, function(value) 7)) - assign(paste0(d_synth_name, "_c"), add_err(d_synth, - function(value) sdfunc_twocomp(value, 0.5, 0.07))) +for (d_synth_name in d_synth_names) +{ + d_synth = get(d_synth_name) + assign(paste0(d_synth_name, "_a"), add_err(d_synth, function(value) 3)) + assign(paste0(d_synth_name, "_b"), add_err(d_synth, function(value) 7)) + assign(paste0(d_synth_name, "_c"), add_err(d_synth, + function(value) sdfunc_twocomp(value, 0.5, 0.07))) -} +} -d_synth_err_names = c( - paste(rep(d_synth_names, each = 3), letters[1:3], sep = "_") -) +d_synth_err_names = c( + paste(rep(d_synth_names, each = 3), letters[1:3], sep = "_") +) # This is just one example of an evaluation using the kinetic model used for # the generation of the data - fit <- mkinfit(m_synth_SFO_lin, synthetic_data_for_UBA_2014[[1]]$data, - quiet = TRUE) - plot_sep(fit)summary(fit)#> mkin version used for fitting: 0.9.50.3 -#> R version used for fitting: 4.0.0 -#> Date of fit: Wed May 27 06:02:14 2020 -#> Date of summary: Wed May 27 06:02:14 2020 + fit <- mkinfit(m_synth_SFO_lin, synthetic_data_for_UBA_2014[[1]]$data, + quiet = TRUE) + plot_sep(fit) +#> mkin version used for fitting: 0.9.50.4 +#> R version used for fitting: 4.0.3 +#> Date of fit: Mon Nov 30 16:01:42 2020 +#> Date of summary: Mon Nov 30 16:01:42 2020 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -303,7 +309,7 @@ Compare also the code in the example section to see the degradation models." /> #> #> Model predictions using solution type deSolve #> -#> Fitted using 817 model solutions performed in 0.623 s +#> Fitted using 822 model solutions performed in 0.652 s #> #> Error model: Constant variance #> @@ -319,13 +325,13 @@ Compare also the code in the example section to see the degradation models." /> #> f_M1_to_M2 0.5000 deparm #> #> Starting values for the transformed parameters actually optimised: -#> value lower upper -#> parent_0 101.350000 -Inf Inf -#> log_k_parent -2.302585 -Inf Inf -#> log_k_M1 -2.301586 -Inf Inf -#> log_k_M2 -2.300587 -Inf Inf -#> f_parent_ilr_1 0.000000 -Inf Inf -#> f_M1_ilr_1 0.000000 -Inf Inf +#> value lower upper +#> parent_0 101.350000 -Inf Inf +#> log_k_parent -2.302585 -Inf Inf +#> log_k_M1 -2.301586 -Inf Inf +#> log_k_M2 -2.300587 -Inf Inf +#> f_parent_qlogis 0.000000 -Inf Inf +#> f_M1_qlogis 0.000000 -Inf Inf #> #> Fixed parameter values: #> value type @@ -338,32 +344,32 @@ Compare also the code in the example section to see the degradation models." /> #> 188.7274 200.3723 -87.36368 #> #> Optimised, transformed parameters with symmetric confidence intervals: -#> Estimate Std. Error Lower Upper -#> parent_0 102.1000 1.57000 98.8600 105.3000 -#> log_k_parent -0.3020 0.03885 -0.3812 -0.2229 -#> log_k_M1 -1.2070 0.07123 -1.3520 -1.0620 -#> log_k_M2 -3.9010 0.06571 -4.0350 -3.7670 -#> f_parent_ilr_1 0.8492 0.16640 0.5103 1.1880 -#> f_M1_ilr_1 0.6780 0.17600 0.3196 1.0360 -#> sigma 2.2730 0.25740 1.7490 2.7970 +#> Estimate Std. Error Lower Upper +#> parent_0 102.1000 1.57000 98.8600 105.3000 +#> log_k_parent -0.3020 0.03885 -0.3812 -0.2229 +#> log_k_M1 -1.2070 0.07123 -1.3520 -1.0620 +#> log_k_M2 -3.9010 0.06571 -4.0350 -3.7670 +#> f_parent_qlogis 1.2010 0.23530 0.7216 1.6800 +#> f_M1_qlogis 0.9589 0.24890 0.4520 1.4660 +#> sigma 2.2730 0.25740 1.7490 2.7970 #> #> Parameter correlation: -#> parent_0 log_k_parent log_k_M1 log_k_M2 f_parent_ilr_1 -#> parent_0 1.000e+00 3.933e-01 -1.605e-01 2.819e-02 -4.624e-01 -#> log_k_parent 3.933e-01 1.000e+00 -4.082e-01 7.166e-02 -5.682e-01 -#> log_k_M1 -1.605e-01 -4.082e-01 1.000e+00 -3.929e-01 7.478e-01 -#> log_k_M2 2.819e-02 7.166e-02 -3.929e-01 1.000e+00 -2.658e-01 -#> f_parent_ilr_1 -4.624e-01 -5.682e-01 7.478e-01 -2.658e-01 1.000e+00 -#> f_M1_ilr_1 1.614e-01 4.102e-01 -8.109e-01 5.419e-01 -8.605e-01 -#> sigma -1.384e-07 -2.581e-07 9.499e-08 1.518e-07 1.236e-07 -#> f_M1_ilr_1 sigma -#> parent_0 1.614e-01 -1.384e-07 -#> log_k_parent 4.102e-01 -2.581e-07 -#> log_k_M1 -8.109e-01 9.499e-08 -#> log_k_M2 5.419e-01 1.518e-07 -#> f_parent_ilr_1 -8.605e-01 1.236e-07 -#> f_M1_ilr_1 1.000e+00 8.795e-09 -#> sigma 8.795e-09 1.000e+00 +#> parent_0 log_k_parent log_k_M1 log_k_M2 f_parent_qlogis +#> parent_0 1.000e+00 3.933e-01 -1.605e-01 2.819e-02 -4.624e-01 +#> log_k_parent 3.933e-01 1.000e+00 -4.082e-01 7.166e-02 -5.682e-01 +#> log_k_M1 -1.605e-01 -4.082e-01 1.000e+00 -3.929e-01 7.478e-01 +#> log_k_M2 2.819e-02 7.166e-02 -3.929e-01 1.000e+00 -2.658e-01 +#> f_parent_qlogis -4.624e-01 -5.682e-01 7.478e-01 -2.658e-01 1.000e+00 +#> f_M1_qlogis 1.614e-01 4.102e-01 -8.109e-01 5.419e-01 -8.605e-01 +#> sigma -7.941e-08 -9.143e-09 -1.268e-08 5.947e-08 5.657e-08 +#> f_M1_qlogis sigma +#> parent_0 1.614e-01 -7.941e-08 +#> log_k_parent 4.102e-01 -9.143e-09 +#> log_k_M1 -8.109e-01 -1.268e-08 +#> log_k_M2 5.419e-01 5.947e-08 +#> f_parent_qlogis -8.605e-01 5.657e-08 +#> f_M1_qlogis 1.000e+00 -2.382e-10 +#> sigma -2.382e-10 1.000e+00 #> #> Backtransformed parameters: #> Confidence intervals for internally transformed parameters are asymmetric. @@ -410,8 +416,8 @@ Compare also the code in the example section to see the degradation models." /> #> 7 parent 0.3 5.772e-01 -0.27717 #> 14 parent 3.5 3.264e-03 3.49674 #> 28 parent 3.2 1.045e-07 3.20000 -#> 90 parent 0.6 9.535e-10 0.60000 -#> 120 parent 3.5 -5.941e-10 3.50000 +#> 90 parent 0.6 9.532e-10 0.60000 +#> 120 parent 3.5 -5.940e-10 3.50000 #> 1 M1 36.4 3.479e+01 1.61088 #> 1 M1 37.4 3.479e+01 2.61088 #> 3 M1 34.3 3.937e+01 -5.07027 @@ -421,9 +427,9 @@ Compare also the code in the example section to see the degradation models." /> #> 14 M1 5.8 1.995e+00 3.80469 #> 14 M1 1.2 1.995e+00 -0.79531 #> 60 M1 0.5 2.111e-06 0.50000 -#> 90 M1 3.2 -9.676e-10 3.20000 -#> 120 M1 1.5 7.671e-10 1.50000 -#> 120 M1 0.6 7.671e-10 0.60000 +#> 90 M1 3.2 -9.671e-10 3.20000 +#> 120 M1 1.5 7.670e-10 1.50000 +#> 120 M1 0.6 7.670e-10 0.60000 #> 1 M2 4.8 4.455e+00 0.34517 #> 3 M2 20.9 2.153e+01 -0.62527 #> 3 M2 19.3 2.153e+01 -2.22527 @@ -438,7 +444,7 @@ Compare also the code in the example section to see the degradation models." /> #> 90 M2 10.6 1.013e+01 0.47130 #> 90 M2 10.8 1.013e+01 0.67130 #> 120 M2 9.8 5.521e+00 4.27893 -#> 120 M2 3.3 5.521e+00 -2.22107# } +#> 120 M2 3.3 5.521e+00 -2.22107# }