From bc3825ae2d12c18ea3d3caf17eb23c93fef180b8 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 8 Oct 2020 09:31:35 +0200 Subject: Fix issues for release --- docs/dev/reference/AIC.mmkin.html | 8 +- docs/dev/reference/DFOP.solution.html | 2 +- docs/dev/reference/FOMC.solution.html | 2 +- docs/dev/reference/HS.solution.html | 2 +- docs/dev/reference/IORE.solution.html | 2 +- docs/dev/reference/SFO.solution.html | 2 +- docs/dev/reference/SFORB.solution.html | 2 +- docs/dev/reference/add_err.html | 2 +- docs/dev/reference/confint.mkinfit.html | 86 ++-- docs/dev/reference/create_deg_func.html | 16 +- docs/dev/reference/endpoints.html | 18 +- docs/dev/reference/get_deg_func.html | 2 +- docs/dev/reference/ilr.html | 2 +- docs/dev/reference/index.html | 6 - docs/dev/reference/logLik.mkinfit.html | 4 +- docs/dev/reference/logistic.solution.html | 16 +- docs/dev/reference/max_twa_parent.html | 2 +- docs/dev/reference/mccall81_245T.html | 18 +- docs/dev/reference/mkinds.html | 2 +- docs/dev/reference/mkinerrplot.html | 2 +- docs/dev/reference/mkinfit.html | 622 +++++++---------------------- docs/dev/reference/mkinmod.html | 9 +- docs/dev/reference/mkinparplot-1.png | Bin 16468 -> 16468 bytes docs/dev/reference/mkinparplot.html | 2 +- docs/dev/reference/mkinpredict.html | 6 +- docs/dev/reference/mkinresplot.html | 4 +- docs/dev/reference/mkinsub.html | 2 +- docs/dev/reference/mmkin-3.png | Bin 100817 -> 100799 bytes docs/dev/reference/mmkin-5.png | Bin 66959 -> 66958 bytes docs/dev/reference/mmkin.html | 17 +- docs/dev/reference/nafta.html | 22 +- docs/dev/reference/nlme-1.png | Bin 70555 -> 71651 bytes docs/dev/reference/nlme.html | 20 +- docs/dev/reference/nlme.mmkin.html | 97 +++-- docs/dev/reference/parms.html | 43 +- docs/dev/reference/plot.mkinfit.html | 4 +- docs/dev/reference/plot.mmkin-1.png | Bin 34273 -> 34584 bytes docs/dev/reference/plot.mmkin-2.png | Bin 34629 -> 34972 bytes docs/dev/reference/plot.mmkin-3.png | Bin 32259 -> 32445 bytes docs/dev/reference/plot.mmkin-4.png | Bin 25550 -> 25896 bytes docs/dev/reference/plot.mmkin-5.png | Bin 38129 -> 39246 bytes docs/dev/reference/plot.mmkin.html | 2 +- docs/dev/reference/plot.nlme.mmkin-2.png | Bin 35346 -> 35346 bytes docs/dev/reference/plot.nlme.mmkin.html | 5 +- docs/dev/reference/print.mkinds.html | 2 +- docs/dev/reference/sigma_twocomp.html | 2 +- docs/dev/reference/summary.mkinfit.html | 14 +- docs/dev/reference/transform_odeparms.html | 8 +- 48 files changed, 367 insertions(+), 710 deletions(-) (limited to 'docs/dev/reference') diff --git a/docs/dev/reference/AIC.mmkin.html b/docs/dev/reference/AIC.mmkin.html index 517aff12..a1418b82 100644 --- a/docs/dev/reference/AIC.mmkin.html +++ b/docs/dev/reference/AIC.mmkin.html @@ -73,7 +73,7 @@ same dataset." /> mkin - 0.9.50.3 + 0.9.50.3 @@ -192,13 +192,13 @@ dataframe if there are several fits in the column).

# of parameters, the higher (worse) the AIC AIC(f[, "FOCUS A"])
#> df AIC #> SFO 3 55.28197 -#> FOMC 4 57.28202 +#> FOMC 4 57.28211 #> DFOP 5 59.28197
AIC(f[, "FOCUS A"], k = 0) # If we do not penalize additional parameters, we get nearly the same
#> df AIC #> SFO 3 49.28197 -#> FOMC 4 49.28202 +#> FOMC 4 49.28211 #> DFOP 5 49.28197
BIC(f[, "FOCUS A"]) # Comparing the BIC gives a very similar picture
#> df BIC #> SFO 3 55.52030 -#> FOMC 4 57.59979 +#> FOMC 4 57.59987 #> DFOP 5 59.67918
# For FOCUS C, the more complex models fit better AIC(f[, "FOCUS C"])
#> df AIC diff --git a/docs/dev/reference/DFOP.solution.html b/docs/dev/reference/DFOP.solution.html index 48c3aabb..e7c69fc3 100644 --- a/docs/dev/reference/DFOP.solution.html +++ b/docs/dev/reference/DFOP.solution.html @@ -73,7 +73,7 @@ two exponential decline functions." /> mkin - 0.9.50.3 + 0.9.50.3
diff --git a/docs/dev/reference/FOMC.solution.html b/docs/dev/reference/FOMC.solution.html index 8ed22157..f89f87c9 100644 --- a/docs/dev/reference/FOMC.solution.html +++ b/docs/dev/reference/FOMC.solution.html @@ -73,7 +73,7 @@ a decreasing rate constant." /> mkin - 0.9.50.3 + 0.9.50.3 diff --git a/docs/dev/reference/HS.solution.html b/docs/dev/reference/HS.solution.html index 5053542a..4622ac80 100644 --- a/docs/dev/reference/HS.solution.html +++ b/docs/dev/reference/HS.solution.html @@ -73,7 +73,7 @@ between them." /> mkin - 0.9.50.3 + 0.9.50.3 diff --git a/docs/dev/reference/IORE.solution.html b/docs/dev/reference/IORE.solution.html index 9db7447c..26a34c73 100644 --- a/docs/dev/reference/IORE.solution.html +++ b/docs/dev/reference/IORE.solution.html @@ -73,7 +73,7 @@ a concentration dependent rate constant." /> mkin - 0.9.50.3 + 0.9.50.3 diff --git a/docs/dev/reference/SFO.solution.html b/docs/dev/reference/SFO.solution.html index 02b3cf22..930c2a97 100644 --- a/docs/dev/reference/SFO.solution.html +++ b/docs/dev/reference/SFO.solution.html @@ -72,7 +72,7 @@ mkin - 0.9.50.3 + 0.9.50.3 diff --git a/docs/dev/reference/SFORB.solution.html b/docs/dev/reference/SFORB.solution.html index 87d39b4e..845377a2 100644 --- a/docs/dev/reference/SFORB.solution.html +++ b/docs/dev/reference/SFORB.solution.html @@ -76,7 +76,7 @@ and no substance in the bound fraction." /> mkin - 0.9.50.3 + 0.9.50.3 diff --git a/docs/dev/reference/add_err.html b/docs/dev/reference/add_err.html index a4317cd7..852ae0d9 100644 --- a/docs/dev/reference/add_err.html +++ b/docs/dev/reference/add_err.html @@ -74,7 +74,7 @@ may depend on the predicted value and is specified as a standard deviation." /> mkin - 0.9.50.3 + 0.9.50.3 diff --git a/docs/dev/reference/confint.mkinfit.html b/docs/dev/reference/confint.mkinfit.html index 074bed3e..5b683355 100644 --- a/docs/dev/reference/confint.mkinfit.html +++ b/docs/dev/reference/confint.mkinfit.html @@ -258,15 +258,15 @@ Profile-Likelihood Based Confidence Intervals, Applied Statistics, 37,

Examples

f <- mkinfit("SFO", FOCUS_2006_C, quiet = TRUE) -confint(f, method = "quadratic")
#> 2.5% 97.5% -#> parent_0 71.8242430 93.1600766 -#> k_parent_sink 0.2109541 0.4440528 -#> sigma 1.9778868 7.3681380
+confint(f, method = "quadratic")
#> 2.5% 97.5% +#> parent_0 71.8242430 93.1600766 +#> k_parent 0.2109541 0.4440528 +#> sigma 1.9778868 7.3681380
# \dontrun{ -confint(f, method = "profile")
#> Profiling the likelihood
#> 2.5% 97.5% -#> parent_0 73.0641834 92.1392181 -#> k_parent_sink 0.2170293 0.4235348 -#> sigma 3.1307772 8.0628314
+confint(f, method = "profile")
#> Profiling the likelihood
#> 2.5% 97.5% +#> parent_0 73.0641834 92.1392181 +#> k_parent 0.2170293 0.4235348 +#> sigma 3.1307772 8.0628314
# Set the number of cores for the profiling method for further examples if (identical(Sys.getenv("NOT_CRAN"), "true")) { n_cores <- parallel::detectCores() - 1 @@ -279,30 +279,29 @@ Profile-Likelihood Based Confidence Intervals, Applied Statistics, 37, SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"), quiet = TRUE) SFO_SFO.ff <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"), 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, method = "profile", cores = 1, quiet = TRUE))
#> user system elapsed -#> 3.610 1.071 3.378
# Using more cores does not save much time here, as parent_0 takes up most of the time +f_d_1 <- mkinfit(SFO_SFO, subset(FOCUS_2006_D, value != 0), quiet = TRUE)
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
system.time(ci_profile <- confint(f_d_1, method = "profile", cores = 1, quiet = TRUE))
#> user system elapsed +#> 3.810 0.964 3.430
# Using more cores does not save much time here, as parent_0 takes up most of the time # If we additionally exclude parent_0 (the confidence of which is often of # minor interest), we get a nice performance improvement from about 50 # seconds to about 12 seconds if we use at least four cores system.time(ci_profile_no_parent_0 <- confint(f_d_1, method = "profile", - c("k_parent_sink", "k_parent_m1", "k_m1_sink", "sigma"), cores = n_cores))
#> Profiling the likelihood
#> Warning: scheduled cores 2, 1, 3 encountered errors in user code, all values of the jobs will be affected
#> Error in dimnames(x) <- dn: length of 'dimnames' [2] not equal to array extent
#> Timing stopped at: 0.005 0.04 0.206
ci_profile
#> 2.5% 97.5% + c("k_parent_sink", "k_parent_m1", "k_m1_sink", "sigma"), cores = n_cores))
#> Profiling the likelihood
#> Warning: scheduled cores 2, 1, 3 encountered errors in user code, all values of the jobs will be affected
#> Error in dimnames(x) <- dn: length of 'dimnames' [2] not equal to array extent
#> Timing stopped at: 0.015 0.029 0.198
ci_profile
#> 2.5% 97.5% #> parent_0 96.456003640 1.027703e+02 #> k_parent 0.090911032 1.071578e-01 #> k_m1 0.003892605 6.702778e-03 #> f_parent_to_m1 0.471328495 5.611550e-01 #> sigma 2.535612399 3.985263e+00
ci_quadratic_transformed <- confint(f_d_1, method = "quadratic") ci_quadratic_transformed
#> 2.5% 97.5% -#> parent_0 96.403839476 1.027931e+02 +#> parent_0 96.403839460 1.027931e+02 #> k_parent 0.090823790 1.072543e-01 #> k_m1 0.004012216 6.897547e-03 #> f_parent_to_m1 0.469118713 5.595960e-01 #> sigma 2.396089689 3.854918e+00
ci_quadratic_untransformed <- confint(f_d_1, method = "quadratic", transformed = FALSE) ci_quadratic_untransformed
#> 2.5% 97.5% -#> parent_0 96.403839429 1.027931e+02 +#> parent_0 96.403839413 1.027931e+02 #> k_parent 0.090491931 1.069035e-01 #> k_m1 0.003835483 6.685819e-03 -#> f_parent_to_m1 0.469113364 5.598386e-01 +#> f_parent_to_m1 0.469113365 5.598386e-01 #> sigma 2.396089689 3.854918e+00
# Against the expectation based on Bates and Watts (1988), the confidence # intervals based on the internal parameter transformation are less # congruent with the likelihood based intervals. Note the superiority of the @@ -314,7 +313,7 @@ Profile-Likelihood Based Confidence Intervals, Applied Statistics, 37, #> k_parent TRUE TRUE #> k_m1 FALSE FALSE #> f_parent_to_m1 TRUE FALSE -#> sigma FALSE TRUE
signif(rel_diffs_transformed, 3)
#> 2.5% 97.5% +#> sigma FALSE FALSE
signif(rel_diffs_transformed, 3)
#> 2.5% 97.5% #> parent_0 0.000541 0.000222 #> k_parent 0.000960 0.000900 #> k_m1 0.030700 0.029100 @@ -327,24 +326,23 @@ Profile-Likelihood Based Confidence Intervals, Applied Statistics, 37, #> sigma 0.055000 0.032700
# Investigate a case with formation fractions -f_d_2 <- mkinfit(SFO_SFO.ff, subset(FOCUS_2006_D, value != 0), quiet = TRUE) -ci_profile_ff <- confint(f_d_2, method = "profile", cores = n_cores)
#> Profiling the likelihood
ci_profile_ff
#> 2.5% 97.5% +f_d_2 <- mkinfit(SFO_SFO.ff, subset(FOCUS_2006_D, value != 0), quiet = TRUE)
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
ci_profile_ff <- confint(f_d_2, method = "profile", cores = n_cores)
#> Profiling the likelihood
ci_profile_ff
#> 2.5% 97.5% #> parent_0 96.456003640 1.027703e+02 #> k_parent 0.090911032 1.071578e-01 #> k_m1 0.003892605 6.702778e-03 #> f_parent_to_m1 0.471328495 5.611550e-01 #> sigma 2.535612399 3.985263e+00
ci_quadratic_transformed_ff <- confint(f_d_2, method = "quadratic") ci_quadratic_transformed_ff
#> 2.5% 97.5% -#> parent_0 96.403839476 1.027931e+02 +#> parent_0 96.403839460 1.027931e+02 #> k_parent 0.090823790 1.072543e-01 #> k_m1 0.004012216 6.897547e-03 #> f_parent_to_m1 0.469118713 5.595960e-01 #> sigma 2.396089689 3.854918e+00
ci_quadratic_untransformed_ff <- confint(f_d_2, method = "quadratic", transformed = FALSE) ci_quadratic_untransformed_ff
#> 2.5% 97.5% -#> parent_0 96.403839429 1.027931e+02 +#> parent_0 96.403839413 1.027931e+02 #> k_parent 0.090491931 1.069035e-01 #> k_m1 0.003835483 6.685819e-03 -#> f_parent_to_m1 0.469113364 5.598386e-01 +#> f_parent_to_m1 0.469113365 5.598386e-01 #> sigma 2.396089689 3.854918e+00
rel_diffs_transformed_ff <- abs((ci_quadratic_transformed_ff - ci_profile_ff)/ci_profile_ff) rel_diffs_untransformed_ff <- abs((ci_quadratic_untransformed_ff - ci_profile_ff)/ci_profile_ff) # While the confidence interval for the parent rate constant is closer to @@ -356,17 +354,17 @@ Profile-Likelihood Based Confidence Intervals, Applied Statistics, 37, #> k_parent TRUE TRUE #> k_m1 FALSE FALSE #> f_parent_to_m1 TRUE FALSE -#> sigma FALSE TRUE
rel_diffs_transformed_ff
#> 2.5% 97.5% -#> parent_0 0.0005408078 0.0002217796 +#> sigma FALSE FALSE
rel_diffs_transformed_ff
#> 2.5% 97.5% +#> parent_0 0.0005408080 0.0002217794 #> k_parent 0.0009596417 0.0009003876 -#> k_m1 0.0307277372 0.0290579184 -#> f_parent_to_m1 0.0046884131 0.0027782558 -#> sigma 0.0550252516 0.0327066836
rel_diffs_untransformed_ff
#> 2.5% 97.5% -#> parent_0 0.0005408083 0.000221780 -#> k_parent 0.0046100096 0.002373023 -#> k_m1 0.0146746467 0.002530101 -#> f_parent_to_m1 0.0046997600 0.002346022 -#> sigma 0.0550252516 0.032706684
+#> k_m1 0.0307277370 0.0290579182 +#> f_parent_to_m1 0.0046884130 0.0027782556 +#> sigma 0.0550252516 0.0327066836
rel_diffs_untransformed_ff
#> 2.5% 97.5% +#> parent_0 0.0005408085 0.0002217799 +#> k_parent 0.0046100096 0.0023730229 +#> k_m1 0.0146746469 0.0025301011 +#> f_parent_to_m1 0.0046997599 0.0023460223 +#> sigma 0.0550252516 0.0327066836
# 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")), @@ -375,19 +373,19 @@ Profile-Likelihood Based Confidence Intervals, Applied Statistics, 37, 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)
#> Warning: Optimisation did not converge: -#> iteration limit reached without convergence (10)
confint(f_tc_2, method = "quadratic")
#> 2.5% 97.5% -#> parent_0 95.654015524 105.79279749 -#> k_M1 0.037723773 0.04447598 -#> k_M2 0.008586438 0.01078076 -#> f_parent_to_M1 0.230403596 0.61953014 -#> f_parent_to_M2 0.162909765 0.38019017 -#> k1 0.275434628 0.33331386 -#> k2 0.018602188 0.02249211 -#> g 0.675149759 0.73520889 -#> sigma_low 0.251416929 0.84272023 -#> rsd_high 0.040371818 0.07666540
confint(f_tc_2, "parent_0", method = "quadratic")
#> 2.5% 97.5% -#> parent_0 95.65402 105.7928
# } + error_model_algorithm = "direct", quiet = TRUE) +confint(f_tc_2, method = "quadratic")
#> 2.5% 97.5% +#> parent_0 94.59613833 106.19939215 +#> k_M1 0.03760542 0.04490759 +#> k_M2 0.00856874 0.01087675 +#> f_parent_to_M1 0.02146166 0.62023888 +#> f_parent_to_M2 0.01516502 0.37975343 +#> k1 0.27389751 0.33388078 +#> k2 0.01861456 0.02250379 +#> g 0.67194349 0.73583256 +#> sigma_low 0.25128383 0.83992146 +#> rsd_high 0.04041100 0.07662001
confint(f_tc_2, "parent_0", method = "quadratic")
#> 2.5% 97.5% +#> parent_0 94.59614 106.1994
# }
@@ -171,16 +171,14 @@ SFO_SFO <- mkinmod( parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
FOCUS_D <- subset(FOCUS_2006_D, value != 0) # to avoid warnings -fit_1 <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE) -fit_2 <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE) -# \dontrun{ +fit_1 <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE)
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
fit_2 <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE)
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
# \dontrun{ if (require(rbenchmark)) benchmark( analytical = mkinfit(SFO_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE), deSolve = mkinfit(SFO_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE), - replications = 2)
#> Loading required package: rbenchmark
#> test replications elapsed relative user.self sys.self user.child -#> 1 analytical 2 0.422 1.000 0.421 0 0 -#> 2 deSolve 2 0.722 1.711 0.721 0 0 + replications = 2)
#> Loading required package: rbenchmark
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
#> test replications elapsed relative user.self sys.self user.child +#> 1 analytical 2 0.423 1.000 0.423 0 0 +#> 2 deSolve 2 0.716 1.693 0.715 0 0 #> sys.child #> 1 0 #> 2 0
DFOP_SFO <- mkinmod( @@ -189,8 +187,8 @@ analytical = mkinfit(DFOP_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE), deSolve = mkinfit(DFOP_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE), replications = 2)
#> test replications elapsed relative user.self sys.self user.child -#> 1 analytical 2 0.907 1.000 0.906 0 0 -#> 2 deSolve 2 1.659 1.829 1.658 0 0 +#> 1 analytical 2 0.910 1.000 0.909 0 0 +#> 2 deSolve 2 1.734 1.905 1.733 0 0 #> sys.child #> 1 0 #> 2 0
# } diff --git a/docs/dev/reference/endpoints.html b/docs/dev/reference/endpoints.html index 5751df93..1858e243 100644 --- a/docs/dev/reference/endpoints.html +++ b/docs/dev/reference/endpoints.html @@ -78,7 +78,7 @@ advantage that the SFORB model can also be used for metabolites." /> mkin - 0.9.50.3 + 0.9.50.3
@@ -187,18 +187,22 @@ of these SFORB models, equivalent to DFOP rate constants

#> DT50 DT90 DT50back #> parent 1.785233 15.1479 4.559973 #>
# \dontrun{ - fit_2 <- mkinfit("SFORB", FOCUS_2006_C, quiet = TRUE) - endpoints(fit_2)
#> $ff -#> parent_free_sink -#> 1 + fit_2 <- mkinfit("DFOP", FOCUS_2006_C, quiet = TRUE) + endpoints(fit_2)
#> $distimes +#> DT50 DT90 DT50back DT50_k1 DT50_k2 +#> parent 1.886925 21.25106 6.397207 1.508293 38.83438 +#>
fit_3 <- mkinfit("SFORB", FOCUS_2006_C, quiet = TRUE) + endpoints(fit_3)
#> $ff +#> parent_free +#> 1 #> #> $SFORB #> parent_b1 parent_b2 #> 0.4595574 0.0178488 #> #> $distimes -#> DT50 DT90 DT50_parent_b1 DT50_parent_b2 -#> parent 1.886925 21.25106 1.508293 38.83438 +#> DT50 DT90 DT50back DT50_parent_b1 DT50_parent_b2 +#> parent 1.886925 21.25106 6.397208 1.508293 38.83438 #>
# }
diff --git a/docs/dev/reference/get_deg_func.html b/docs/dev/reference/get_deg_func.html index 7500186b..ea0676cc 100644 --- a/docs/dev/reference/get_deg_func.html +++ b/docs/dev/reference/get_deg_func.html @@ -72,7 +72,7 @@ mkin - 0.9.50.3 + 0.9.50.3 diff --git a/docs/dev/reference/ilr.html b/docs/dev/reference/ilr.html index 245880f2..8f58949e 100644 --- a/docs/dev/reference/ilr.html +++ b/docs/dev/reference/ilr.html @@ -73,7 +73,7 @@ transformations." /> mkin - 0.9.50.3 + 0.9.50.3 diff --git a/docs/dev/reference/index.html b/docs/dev/reference/index.html index f1ab22e6..b72d0c85 100644 --- a/docs/dev/reference/index.html +++ b/docs/dev/reference/index.html @@ -330,12 +330,6 @@ of an mmkin object

Helper functions to create nlme models from mmkin row objects

- -

saemix_model() saemix_data()

- -

Create saemix models from mmkin row objects

- -

get_deg_func()

diff --git a/docs/dev/reference/logLik.mkinfit.html b/docs/dev/reference/logLik.mkinfit.html index 840a4821..7ab36f0d 100644 --- a/docs/dev/reference/logLik.mkinfit.html +++ b/docs/dev/reference/logLik.mkinfit.html @@ -76,7 +76,7 @@ the error model." /> mkin - 0.9.50.3 + 0.9.50.3 @@ -193,7 +193,7 @@ and the fitted error model parameters.

parent = mkinsub("SFO", to = "m1"), m1 = mkinsub("SFO") )
#> Successfully compiled differential equation model from auto-generated C code.
d_t <- FOCUS_2006_D - f_nw <- mkinfit(sfo_sfo, d_t, quiet = TRUE) # no weighting (weights are unity)
#> Warning: Observations with value of zero were removed from the data
f_obs <- mkinfit(sfo_sfo, d_t, error_model = "obs", quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
f_tc <- mkinfit(sfo_sfo, d_t, error_model = "tc", quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
AIC(f_nw, f_obs, f_tc)
#> df AIC + f_nw <- mkinfit(sfo_sfo, d_t, quiet = TRUE) # no weighting (weights are unity)
#> Warning: Observations with value of zero were removed from the data
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
f_obs <- mkinfit(sfo_sfo, d_t, error_model = "obs", quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
f_tc <- mkinfit(sfo_sfo, d_t, error_model = "tc", quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
AIC(f_nw, f_obs, f_tc)
#> df AIC #> f_nw 5 204.4486 #> f_obs 6 205.8727 #> f_tc 6 141.9656
# } diff --git a/docs/dev/reference/logistic.solution.html b/docs/dev/reference/logistic.solution.html index 4804fc73..248edcda 100644 --- a/docs/dev/reference/logistic.solution.html +++ b/docs/dev/reference/logistic.solution.html @@ -73,7 +73,7 @@ an increasing rate constant, supposedly caused by microbial growth" /> mkin - 0.9.50.3 + 0.9.50.3
@@ -232,18 +232,18 @@ Version 1.1, 18 December 2014 m <- mkinfit("logistic", d_2_1, quiet = TRUE) plot_sep(m)
summary(m)$bpar
#> Estimate se_notrans t value Pr(>t) Lower -#> parent_0 1.057896e+02 1.9023449649 55.610120 3.768361e-16 1.016451e+02 -#> kmax 6.398190e-02 0.0143201029 4.467978 3.841828e-04 3.929235e-02 -#> k0 1.612775e-04 0.0005866813 0.274898 3.940351e-01 5.846685e-08 -#> r 2.263946e-01 0.1718110773 1.317695 1.061044e-01 4.335843e-02 +#> parent_0 1.057896e+02 1.9023449703 55.610119 3.768361e-16 1.016451e+02 +#> kmax 6.398190e-02 0.0143201031 4.467978 3.841829e-04 3.929235e-02 +#> k0 1.612775e-04 0.0005866813 0.274898 3.940351e-01 5.846688e-08 +#> r 2.263946e-01 0.1718110715 1.317695 1.061044e-01 4.335843e-02 #> sigma 5.332935e+00 0.9145907310 5.830952 4.036926e-05 3.340213e+00 #> Upper #> parent_0 109.9341588 #> kmax 0.1041853 -#> k0 0.4448750 -#> r 1.1821121 +#> k0 0.4448749 +#> r 1.1821120 #> sigma 7.3256566
endpoints(m)$distimes
#> DT50 DT90 DT50_k0 DT50_kmax -#> parent 36.86533 62.41511 4297.854 10.83349
+#> parent 36.86533 62.41511 4297.853 10.83349
diff --git a/docs/dev/reference/mccall81_245T.html b/docs/dev/reference/mccall81_245T.html index dc0dfbf8..fa352d0a 100644 --- a/docs/dev/reference/mccall81_245T.html +++ b/docs/dev/reference/mccall81_245T.html @@ -74,7 +74,7 @@ mkin - 0.9.50.3 + 0.9.50.3 @@ -178,15 +178,15 @@ phenol = list(type = "SFO", to = "anisole"), anisole = list(type = "SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
# \dontrun{ fit.1 <- mkinfit(SFO_SFO_SFO, subset(mccall81_245T, soil == "Commerce"), quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
summary(fit.1)$bpar
#> Estimate se_notrans t value Pr(>t) -#> T245_0 1.038550e+02 2.184707509 47.537272 4.472189e-18 +#> T245_0 1.038550e+02 2.184707514 47.537272 4.472189e-18 #> k_T245 4.337042e-02 0.001898397 22.845818 2.276912e-13 -#> k_phenol 4.050581e-01 0.298699410 1.356073 9.756993e-02 +#> k_phenol 4.050581e-01 0.298699428 1.356073 9.756994e-02 #> k_anisole 6.678742e-03 0.000802144 8.326114 2.623179e-07 -#> f_T245_to_phenol 6.227599e-01 0.398534147 1.562626 6.949418e-02 -#> f_phenol_to_anisole 1.000000e+00 0.671844135 1.488440 7.867793e-02 -#> sigma 2.514628e+00 0.490755933 5.123989 6.233163e-05 +#> f_T245_to_phenol 6.227599e-01 0.398534167 1.562626 6.949418e-02 +#> f_phenol_to_anisole 1.000000e+00 0.671844168 1.488440 7.867794e-02 +#> sigma 2.514628e+00 0.490755943 5.123989 6.233164e-05 #> Lower Upper -#> T245_0 99.246061427 1.084640e+02 +#> T245_0 99.246061371 1.084640e+02 #> k_T245 0.039631621 4.746194e-02 #> k_phenol 0.218013878 7.525762e-01 #> k_anisole 0.005370739 8.305299e-03 @@ -194,7 +194,7 @@ #> f_phenol_to_anisole 0.000000000 1.000000e+00 #> sigma 1.706607296 3.322649e+00
endpoints(fit.1)
#> $ff #> T245_phenol T245_sink phenol_anisole phenol_sink -#> 6.227599e-01 3.772401e-01 1.000000e+00 1.005127e-10 +#> 6.227599e-01 3.772401e-01 1.000000e+00 1.748047e-10 #> #> $distimes #> DT50 DT90 @@ -206,7 +206,7 @@ parms.ini = c(k_phenol_sink = 0), fixed_parms = "k_phenol_sink", quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
#> Warning: Initial parameter(s) k_phenol_sink not used in the model
#> Error in data.frame(value = c(state.ini.fixed, parms.fixed)): row names contain missing values
summary(fit.2)$bpar
#> Error in summary(fit.2): object 'fit.2' not found
endpoints(fit.1)
#> $ff #> T245_phenol T245_sink phenol_anisole phenol_sink -#> 6.227599e-01 3.772401e-01 1.000000e+00 1.005127e-10 +#> 6.227599e-01 3.772401e-01 1.000000e+00 1.748047e-10 #> #> $distimes #> DT50 DT90 diff --git a/docs/dev/reference/mkinds.html b/docs/dev/reference/mkinds.html index 5c7d9490..a8641375 100644 --- a/docs/dev/reference/mkinds.html +++ b/docs/dev/reference/mkinds.html @@ -75,7 +75,7 @@ provided by this package come as mkinds objects nevertheless." /> mkin - 0.9.50.3 + 0.9.50.3
diff --git a/docs/dev/reference/mkinerrplot.html b/docs/dev/reference/mkinerrplot.html index 940a6861..104d1e3a 100644 --- a/docs/dev/reference/mkinerrplot.html +++ b/docs/dev/reference/mkinerrplot.html @@ -76,7 +76,7 @@ using the argument show_errplot = TRUE." /> mkin - 0.9.50.3 + 0.9.50.3 diff --git a/docs/dev/reference/mkinfit.html b/docs/dev/reference/mkinfit.html index e1e75767..90fb26be 100644 --- a/docs/dev/reference/mkinfit.html +++ b/docs/dev/reference/mkinfit.html @@ -423,16 +423,16 @@ Degradation Data. Environments 6(12) 124 # Use shorthand notation for parent only degradation fit <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE) 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 07:43:45 2020 -#> Date of summary: Wed May 27 07:43:45 2020 +#> R version used for fitting: 4.0.2 +#> Date of fit: Thu Oct 8 09:12:15 2020 +#> Date of summary: Thu Oct 8 09:12:15 2020 #> #> Equations: #> d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent #> #> Model predictions using solution type analytical #> -#> Fitted using 222 model solutions performed in 0.044 s +#> Fitted using 222 model solutions performed in 0.045 s #> #> Error model: Constant variance #> @@ -467,10 +467,10 @@ Degradation Data. Environments 6(12) 124 #> #> Parameter correlation: #> parent_0 log_alpha log_beta sigma -#> parent_0 1.000e+00 -1.565e-01 -3.142e-01 4.770e-08 -#> log_alpha -1.565e-01 1.000e+00 9.564e-01 9.974e-08 -#> log_beta -3.142e-01 9.564e-01 1.000e+00 8.468e-08 -#> sigma 4.770e-08 9.974e-08 8.468e-08 1.000e+00 +#> parent_0 1.000e+00 -1.565e-01 -3.142e-01 4.758e-08 +#> log_alpha -1.565e-01 1.000e+00 9.564e-01 1.007e-07 +#> log_beta -3.142e-01 9.564e-01 1.000e+00 8.568e-08 +#> sigma 4.758e-08 1.007e-07 8.568e-08 1.000e+00 #> #> Backtransformed parameters: #> Confidence intervals for internally transformed parameters are asymmetric. @@ -503,426 +503,118 @@ Degradation Data. Environments 6(12) 124 #> 91 parent 3.9 1.441 2.4590 #> 119 parent 0.6 1.092 -0.4919
# One parent compound, one metabolite, both single first order. +# We remove zero values from FOCUS dataset D in order to avoid warnings +FOCUS_D <- subset(FOCUS_2006_D, value != 0) # Use mkinsub for convenience in model formulation. Pathway to sink included per default. SFO_SFO <- mkinmod( parent = mkinsub("SFO", "m1"), - m1 = mkinsub("SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
# Fit the model to the FOCUS example dataset D using defaults -print(system.time(fit <- mkinfit(SFO_SFO, FOCUS_2006_D, - solution_type = "eigen", quiet = TRUE)))
#> Warning: Observations with value of zero were removed from the data
#> user system elapsed -#> 0.405 0.001 0.407
parms(fit)
#> parent_0 k_parent k_m1 f_parent_to_m1 sigma -#> 99.598481046 0.098697740 0.005260651 0.514475962 3.125503875
endpoints(fit)
#> $ff + m1 = mkinsub("SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
+# Fit the model quietly to the FOCUS example dataset D using defaults +fit <- mkinfit(SFO_SFO, FOCUS_D, quiet = TRUE)
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
# Since mkin 0.9.50.3, we get a warning about non-normality of residuals, +# so we try an alternative error model +fit.tc <- mkinfit(SFO_SFO, FOCUS_D, quiet = TRUE, error_model = "tc") +# This avoids the warning, and the likelihood ratio test confirms it is preferable +lrtest(fit.tc, fit)
#> Likelihood ratio test +#> +#> Model 1: SFO_SFO with error model tc and fixed parameter(s) m1_0 +#> Model 2: SFO_SFO with error model const and fixed parameter(s) m1_0 +#> #Df LogLik Df Chisq Pr(>Chisq) +#> 1 6 -64.983 +#> 2 5 -97.224 -1 64.483 9.737e-16 *** +#> --- +#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# We can also allow for different variances of parent and metabolite as error model +fit.obs <- mkinfit(SFO_SFO, FOCUS_D, quiet = TRUE, error_model = "obs") +# This also avoids the warning about non-normality, but the two-component error model +# has significantly higher likelihood +lrtest(fit.obs, fit.tc)
#> Likelihood ratio test +#> +#> Model 1: SFO_SFO with error model tc and fixed parameter(s) m1_0 +#> Model 2: SFO_SFO with error model obs and fixed parameter(s) m1_0 +#> #Df LogLik Df Chisq Pr(>Chisq) +#> 1 6 -64.983 +#> 2 6 -96.936 0 63.907 < 2.2e-16 *** +#> --- +#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
parms(fit.tc)
#> parent_0 k_parent k_m1 f_parent_to_m1 sigma_low +#> 1.007343e+02 1.005562e-01 5.166712e-03 5.083933e-01 3.049891e-03 +#> rsd_high +#> 7.928117e-02
endpoints(fit.tc)
#> $ff #> parent_m1 parent_sink -#> 0.514476 0.485524 +#> 0.5083933 0.4916067 #> #> $distimes -#> DT50 DT90 -#> parent 7.022929 23.32966 -#> m1 131.760724 437.69965 -#>
# \dontrun{ -# deSolve is slower when no C compiler (gcc) was available during model generation -print(system.time(fit.deSolve <- mkinfit(SFO_SFO, FOCUS_2006_D, - solution_type = "deSolve")))
#> Warning: Observations with value of zero were removed from the data
#> Ordinary least squares optimisation
#> Sum of squared residuals at call 1: 15156.12 -#> Sum of squared residuals at call 2: 15156.12 -#> Sum of squared residuals at call 6: 8243.645 -#> Sum of squared residuals at call 12: 6290.712 -#> Sum of squared residuals at call 13: 6290.683 -#> Sum of squared residuals at call 15: 6290.452 -#> Sum of squared residuals at call 18: 1700.749 -#> Sum of squared residuals at call 20: 1700.611 -#> Sum of squared residuals at call 24: 1190.923 -#> Sum of squared residuals at call 26: 1190.922 -#> Sum of squared residuals at call 29: 1017.417 -#> Sum of squared residuals at call 31: 1017.417 -#> Sum of squared residuals at call 33: 1017.416 -#> Sum of squared residuals at call 34: 644.0472 -#> Sum of squared residuals at call 36: 644.047 -#> Sum of squared residuals at call 38: 644.047 -#> Sum of squared residuals at call 39: 590.5025 -#> Sum of squared residuals at call 41: 590.5022 -#> Sum of squared residuals at call 43: 590.5016 -#> Sum of squared residuals at call 44: 543.2196 -#> Sum of squared residuals at call 45: 543.2193 -#> Sum of squared residuals at call 46: 543.2192 -#> Sum of squared residuals at call 50: 391.348 -#> Sum of squared residuals at call 51: 391.3479 -#> Sum of squared residuals at call 56: 386.479 -#> Sum of squared residuals at call 58: 386.479 -#> Sum of squared residuals at call 60: 386.4779 -#> Sum of squared residuals at call 61: 384.0686 -#> Sum of squared residuals at call 63: 384.0686 -#> Sum of squared residuals at call 66: 382.7813 -#> Sum of squared residuals at call 68: 382.7813 -#> Sum of squared residuals at call 70: 382.7813 -#> Sum of squared residuals at call 71: 378.9273 -#> Sum of squared residuals at call 73: 378.9273 -#> Sum of squared residuals at call 75: 378.9272 -#> Sum of squared residuals at call 76: 377.4847 -#> Sum of squared residuals at call 78: 377.4846 -#> Sum of squared residuals at call 81: 375.9738 -#> Sum of squared residuals at call 83: 375.9738 -#> Sum of squared residuals at call 86: 375.3387 -#> Sum of squared residuals at call 88: 375.3387 -#> Sum of squared residuals at call 91: 374.5774 -#> Sum of squared residuals at call 93: 374.5774 -#> Sum of squared residuals at call 95: 374.5774 -#> Sum of squared residuals at call 96: 373.5438 -#> Sum of squared residuals at call 100: 373.5438 -#> Sum of squared residuals at call 102: 373.265 -#> Sum of squared residuals at call 104: 373.265 -#> Sum of squared residuals at call 107: 372.6825 -#> Sum of squared residuals at call 111: 372.6825 -#> Sum of squared residuals at call 114: 372.6356 -#> Sum of squared residuals at call 116: 372.6356 -#> Sum of squared residuals at call 119: 372.6199 -#> Sum of squared residuals at call 121: 372.6199 -#> Sum of squared residuals at call 123: 372.6199 -#> Sum of squared residuals at call 124: 372.5881 -#> Sum of squared residuals at call 126: 372.5881 -#> Sum of squared residuals at call 129: 372.5418 -#> Sum of squared residuals at call 130: 372.4866 -#> Sum of squared residuals at call 131: 372.2242 -#> Sum of squared residuals at call 132: 371.5237 -#> Sum of squared residuals at call 134: 371.5237 -#> Sum of squared residuals at call 137: 371.292 -#> Sum of squared residuals at call 139: 371.292 -#> Sum of squared residuals at call 143: 371.2256 -#> Sum of squared residuals at call 144: 371.2256 -#> Sum of squared residuals at call 146: 371.2256 -#> Sum of squared residuals at call 149: 371.2194 -#> Sum of squared residuals at call 150: 371.2147 -#> Sum of squared residuals at call 153: 371.2147 -#> Sum of squared residuals at call 155: 371.2137 -#> Sum of squared residuals at call 156: 371.2137 -#> Sum of squared residuals at call 157: 371.2137 -#> Sum of squared residuals at call 160: 371.2134 -#> Sum of squared residuals at call 164: 371.2134 -#> Sum of squared residuals at call 165: 371.2134 -#> Sum of squared residuals at call 167: 371.2134 -#> Negative log-likelihood at call 177: 97.22429
#> Optimisation successfully terminated.
#> user system elapsed -#> 0.361 0.000 0.361
parms(fit.deSolve)
#> parent_0 k_parent k_m1 f_parent_to_m1 sigma -#> 99.598480300 0.098697739 0.005260651 0.514475968 3.125503874
endpoints(fit.deSolve)
#> $ff -#> parent_m1 parent_sink -#> 0.514476 0.485524 -#> -#> $distimes -#> DT50 DT90 -#> parent 7.022929 23.32966 -#> m1 131.760721 437.69964 -#>
# } - -# Use stepwise fitting, using optimised parameters from parent only fit, FOMC +#> DT50 DT90 +#> parent 6.89313 22.89848 +#> m1 134.15635 445.65776 +#>
+# We can show a quick (only one replication) benchmark for this case, as we +# have several alternative solution methods for the model. We skip +# uncompiled deSolve, as it is so slow. More benchmarks are found in the +# benchmark vignette +# \dontrun{ +if(require(rbenchmark)) { + benchmark(replications = 1, order = "relative", columns = c("test", "relative", "elapsed"), + deSolve_compiled = mkinfit(SFO_SFO, FOCUS_D, quiet = TRUE, error_model = "tc", + solution_type = "deSolve", use_compiled = TRUE), + eigen = mkinfit(SFO_SFO, FOCUS_D, quiet = TRUE, error_model = "tc", + solution_type = "eigen"), + analytical = mkinfit(SFO_SFO, FOCUS_D, quiet = TRUE, error_model = "tc", + solution_type = "analytical")) +}
#> test relative elapsed +#> 3 analytical 1.000 0.750 +#> 1 deSolve_compiled 2.288 1.716 +#> 2 eigen 2.821 2.116
# } + +# Use stepwise fitting, using optimised parameters from parent only fit, FOMC-SFO # \dontrun{ FOMC_SFO <- mkinmod( parent = mkinsub("FOMC", "m1"), - m1 = mkinsub("SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
# Fit the model to the FOCUS example dataset D using defaults -fit.FOMC_SFO <- mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
# Use starting parameters from parent only FOMC fit -fit.FOMC = mkinfit("FOMC", FOCUS_2006_D, quiet = TRUE) -fit.FOMC_SFO <- mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE, - parms.ini = fit.FOMC$bparms.ode)
#> Warning: Observations with value of zero were removed from the data
-# Use stepwise fitting, using optimised parameters from parent only fit, SFORB -SFORB_SFO <- mkinmod( - parent = list(type = "SFORB", to = "m1", sink = TRUE), - m1 = list(type = "SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
# Fit the model to the FOCUS example dataset D using defaults -fit.SFORB_SFO <- mkinfit(SFORB_SFO, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
fit.SFORB_SFO.deSolve <- mkinfit(SFORB_SFO, FOCUS_2006_D, solution_type = "deSolve", - quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
# Use starting parameters from parent only SFORB fit (not really needed in this case) -fit.SFORB = mkinfit("SFORB", FOCUS_2006_D, quiet = TRUE) -fit.SFORB_SFO <- mkinfit(SFORB_SFO, FOCUS_2006_D, parms.ini = fit.SFORB$bparms.ode, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
#> Warning: Initial parameter(s) k_parent_free_sink not used in the model
# } - -# \dontrun{ -# Weighted fits, including IRLS (error_model = "obs") -SFO_SFO.ff <- mkinmod(parent = mkinsub("SFO", "m1"), - m1 = mkinsub("SFO"), use_of_ff = "max")
#> Successfully compiled differential equation model from auto-generated C code.
f.noweight <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
summary(f.noweight)
#> mkin version used for fitting: 0.9.50.3 -#> R version used for fitting: 4.0.0 -#> Date of fit: Wed May 27 07:43:50 2020 -#> Date of summary: Wed May 27 07:43:50 2020 -#> -#> Equations: -#> d_parent/dt = - k_parent * parent -#> d_m1/dt = + f_parent_to_m1 * k_parent * parent - k_m1 * m1 -#> -#> Model predictions using solution type analytical -#> -#> Fitted using 421 model solutions performed in 0.125 s -#> -#> Error model: Constant variance -#> -#> Error model algorithm: OLS -#> -#> Starting values for parameters to be optimised: -#> value type -#> parent_0 100.7500 state -#> k_parent 0.1000 deparm -#> k_m1 0.1001 deparm -#> f_parent_to_m1 0.5000 deparm -#> -#> Starting values for the transformed parameters actually optimised: -#> value lower upper -#> parent_0 100.750000 -Inf Inf -#> log_k_parent -2.302585 -Inf Inf -#> log_k_m1 -2.301586 -Inf Inf -#> f_parent_ilr_1 0.000000 -Inf Inf -#> -#> Fixed parameter values: -#> value type -#> m1_0 0 state -#> -#> Results: -#> -#> AIC BIC logLik -#> 204.4486 212.6365 -97.22429 -#> -#> Optimised, transformed parameters with symmetric confidence intervals: -#> Estimate Std. Error Lower Upper -#> parent_0 99.60000 1.57000 96.40000 102.8000 -#> log_k_parent -2.31600 0.04087 -2.39900 -2.2330 -#> log_k_m1 -5.24800 0.13320 -5.51800 -4.9770 -#> f_parent_ilr_1 0.04096 0.06312 -0.08746 0.1694 -#> sigma 3.12600 0.35850 2.39600 3.8550 -#> -#> Parameter correlation: -#> parent_0 log_k_parent log_k_m1 f_parent_ilr_1 sigma -#> parent_0 1.000e+00 5.174e-01 -1.688e-01 -5.471e-01 -3.190e-07 -#> log_k_parent 5.174e-01 1.000e+00 -3.263e-01 -5.426e-01 3.168e-07 -#> log_k_m1 -1.688e-01 -3.263e-01 1.000e+00 7.478e-01 -1.406e-07 -#> f_parent_ilr_1 -5.471e-01 -5.426e-01 7.478e-01 1.000e+00 -1.587e-10 -#> sigma -3.190e-07 3.168e-07 -1.406e-07 -1.587e-10 1.000e+00 -#> -#> Backtransformed parameters: -#> Confidence intervals for internally transformed parameters are asymmetric. -#> t-test (unrealistically) based on the assumption of normal distribution -#> for estimators of untransformed parameters. -#> Estimate t value Pr(>t) Lower Upper -#> parent_0 99.600000 63.430 2.298e-36 96.400000 1.028e+02 -#> k_parent 0.098700 24.470 4.955e-23 0.090820 1.073e-01 -#> k_m1 0.005261 7.510 6.165e-09 0.004012 6.898e-03 -#> f_parent_to_m1 0.514500 23.070 3.104e-22 0.469100 5.596e-01 -#> sigma 3.126000 8.718 2.235e-10 2.396000 3.855e+00 -#> -#> FOCUS Chi2 error levels in percent: -#> err.min n.optim df -#> All data 6.398 4 15 -#> parent 6.459 2 7 -#> m1 4.690 2 8 -#> -#> Resulting formation fractions: -#> ff -#> parent_m1 0.5145 -#> parent_sink 0.4855 -#> -#> Estimated disappearance times: -#> DT50 DT90 -#> parent 7.023 23.33 -#> m1 131.761 437.70 -#> -#> Data: -#> time variable observed predicted residual -#> 0 parent 99.46 99.59848 -1.385e-01 -#> 0 parent 102.04 99.59848 2.442e+00 -#> 1 parent 93.50 90.23787 3.262e+00 -#> 1 parent 92.50 90.23787 2.262e+00 -#> 3 parent 63.23 74.07319 -1.084e+01 -#> 3 parent 68.99 74.07319 -5.083e+00 -#> 7 parent 52.32 49.91206 2.408e+00 -#> 7 parent 55.13 49.91206 5.218e+00 -#> 14 parent 27.27 25.01257 2.257e+00 -#> 14 parent 26.64 25.01257 1.627e+00 -#> 21 parent 11.50 12.53462 -1.035e+00 -#> 21 parent 11.64 12.53462 -8.946e-01 -#> 35 parent 2.85 3.14787 -2.979e-01 -#> 35 parent 2.91 3.14787 -2.379e-01 -#> 50 parent 0.69 0.71624 -2.624e-02 -#> 50 parent 0.63 0.71624 -8.624e-02 -#> 75 parent 0.05 0.06074 -1.074e-02 -#> 75 parent 0.06 0.06074 -7.381e-04 -#> 1 m1 4.84 4.80296 3.704e-02 -#> 1 m1 5.64 4.80296 8.370e-01 -#> 3 m1 12.91 13.02400 -1.140e-01 -#> 3 m1 12.96 13.02400 -6.400e-02 -#> 7 m1 22.97 25.04476 -2.075e+00 -#> 7 m1 24.47 25.04476 -5.748e-01 -#> 14 m1 41.69 36.69002 5.000e+00 -#> 14 m1 33.21 36.69002 -3.480e+00 -#> 21 m1 44.37 41.65310 2.717e+00 -#> 21 m1 46.44 41.65310 4.787e+00 -#> 35 m1 41.22 43.31312 -2.093e+00 -#> 35 m1 37.95 43.31312 -5.363e+00 -#> 50 m1 41.19 41.21831 -2.831e-02 -#> 50 m1 40.01 41.21831 -1.208e+00 -#> 75 m1 40.09 36.44703 3.643e+00 -#> 75 m1 33.85 36.44703 -2.597e+00 -#> 100 m1 31.04 31.98163 -9.416e-01 -#> 100 m1 33.13 31.98163 1.148e+00 -#> 120 m1 25.15 28.78984 -3.640e+00 -#> 120 m1 33.31 28.78984 4.520e+00
f.obs <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, error_model = "obs", quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
summary(f.obs)
#> mkin version used for fitting: 0.9.50.3 -#> R version used for fitting: 4.0.0 -#> Date of fit: Wed May 27 07:43:51 2020 -#> Date of summary: Wed May 27 07:43:51 2020 + m1 = mkinsub("SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
fit.FOMC_SFO <- mkinfit(FOMC_SFO, FOCUS_D, quiet = TRUE)
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0499
# Again, we get a warning and try a more sophisticated error model +fit.FOMC_SFO.tc <- mkinfit(FOMC_SFO, FOCUS_D, quiet = TRUE, error_model = "tc") +# This model has a higher likelihood, but not significantly so +lrtest(fit.tc, fit.FOMC_SFO.tc)
#> Likelihood ratio test +#> +#> Model 1: FOMC_SFO with error model tc and fixed parameter(s) m1_0 +#> Model 2: SFO_SFO with error model tc and fixed parameter(s) m1_0 +#> #Df LogLik Df Chisq Pr(>Chisq) +#> 1 7 -64.829 +#> 2 6 -64.983 -1 0.3075 0.5792
# Also, the missing standard error for log_beta and the t-tests for alpha +# and beta indicate overparameterisation +summary(fit.FOMC_SFO.tc, data = FALSE)
#> Warning: NaNs produced
#> Warning: NaNs produced
#> Warning: diag(.) had 0 or NA entries; non-finite result is doubtful
#> mkin version used for fitting: 0.9.50.3 +#> R version used for fitting: 4.0.2 +#> Date of fit: Thu Oct 8 09:12:29 2020 +#> Date of summary: Thu Oct 8 09:12:29 2020 #> #> Equations: -#> d_parent/dt = - k_parent * parent -#> d_m1/dt = + f_parent_to_m1 * k_parent * parent - k_m1 * m1 -#> -#> Model predictions using solution type analytical -#> -#> Fitted using 978 model solutions performed in 0.413 s -#> -#> Error model: Variance unique to each observed variable -#> -#> Error model algorithm: d_3 -#> Direct fitting and three-step fitting yield approximately the same likelihood -#> -#> Starting values for parameters to be optimised: -#> value type -#> parent_0 100.7500 state -#> k_parent 0.1000 deparm -#> k_m1 0.1001 deparm -#> f_parent_to_m1 0.5000 deparm -#> sigma_parent 3.0000 error -#> sigma_m1 3.0000 error -#> -#> Starting values for the transformed parameters actually optimised: -#> value lower upper -#> parent_0 100.750000 -Inf Inf -#> log_k_parent -2.302585 -Inf Inf -#> log_k_m1 -2.301586 -Inf Inf -#> f_parent_ilr_1 0.000000 -Inf Inf -#> sigma_parent 3.000000 0 Inf -#> sigma_m1 3.000000 0 Inf -#> -#> Fixed parameter values: -#> value type -#> m1_0 0 state -#> -#> Results: -#> -#> AIC BIC logLik -#> 205.8727 215.6982 -96.93634 -#> -#> Optimised, transformed parameters with symmetric confidence intervals: -#> Estimate Std. Error Lower Upper -#> parent_0 99.65000 1.70200 96.19000 103.1000 -#> log_k_parent -2.31300 0.04376 -2.40200 -2.2240 -#> log_k_m1 -5.25000 0.12430 -5.50400 -4.9970 -#> f_parent_ilr_1 0.03861 0.06171 -0.08708 0.1643 -#> sigma_parent 3.40100 0.56820 2.24400 4.5590 -#> sigma_m1 2.85500 0.45240 1.93400 3.7770 -#> -#> Parameter correlation: -#> parent_0 log_k_parent log_k_m1 f_parent_ilr_1 sigma_parent -#> parent_0 1.00000 0.51078 -0.19133 -0.59997 0.035670 -#> log_k_parent 0.51078 1.00000 -0.37458 -0.59239 0.069833 -#> log_k_m1 -0.19133 -0.37458 1.00000 0.74398 -0.026158 -#> f_parent_ilr_1 -0.59997 -0.59239 0.74398 1.00000 -0.041369 -#> sigma_parent 0.03567 0.06983 -0.02616 -0.04137 1.000000 -#> sigma_m1 -0.03385 -0.06627 0.02482 0.03926 -0.004628 -#> sigma_m1 -#> parent_0 -0.033847 -#> log_k_parent -0.066265 -#> log_k_m1 0.024823 -#> f_parent_ilr_1 0.039256 -#> sigma_parent -0.004628 -#> sigma_m1 1.000000 -#> -#> Backtransformed parameters: -#> Confidence intervals for internally transformed parameters are asymmetric. -#> t-test (unrealistically) based on the assumption of normal distribution -#> for estimators of untransformed parameters. -#> Estimate t value Pr(>t) Lower Upper -#> parent_0 99.650000 58.560 2.004e-34 96.190000 1.031e+02 -#> k_parent 0.098970 22.850 1.099e-21 0.090530 1.082e-01 -#> k_m1 0.005245 8.046 1.732e-09 0.004072 6.756e-03 -#> f_parent_to_m1 0.513600 23.560 4.352e-22 0.469300 5.578e-01 -#> sigma_parent 3.401000 5.985 5.662e-07 2.244000 4.559e+00 -#> sigma_m1 2.855000 6.311 2.215e-07 1.934000 3.777e+00 -#> -#> FOCUS Chi2 error levels in percent: -#> err.min n.optim df -#> All data 6.398 4 15 -#> parent 6.464 2 7 -#> m1 4.682 2 8 -#> -#> Resulting formation fractions: -#> ff -#> parent_m1 0.5136 -#> parent_sink 0.4864 -#> -#> Estimated disappearance times: -#> DT50 DT90 -#> parent 7.003 23.26 -#> m1 132.154 439.01 -#> -#> Data: -#> time variable observed predicted residual -#> 0 parent 99.46 99.65417 -1.942e-01 -#> 0 parent 102.04 99.65417 2.386e+00 -#> 1 parent 93.50 90.26332 3.237e+00 -#> 1 parent 92.50 90.26332 2.237e+00 -#> 3 parent 63.23 74.05306 -1.082e+01 -#> 3 parent 68.99 74.05306 -5.063e+00 -#> 7 parent 52.32 49.84325 2.477e+00 -#> 7 parent 55.13 49.84325 5.287e+00 -#> 14 parent 27.27 24.92971 2.340e+00 -#> 14 parent 26.64 24.92971 1.710e+00 -#> 21 parent 11.50 12.46890 -9.689e-01 -#> 21 parent 11.64 12.46890 -8.289e-01 -#> 35 parent 2.85 3.11925 -2.692e-01 -#> 35 parent 2.91 3.11925 -2.092e-01 -#> 50 parent 0.69 0.70679 -1.679e-02 -#> 50 parent 0.63 0.70679 -7.679e-02 -#> 75 parent 0.05 0.05952 -9.523e-03 -#> 75 parent 0.06 0.05952 4.772e-04 -#> 1 m1 4.84 4.81075 2.925e-02 -#> 1 m1 5.64 4.81075 8.292e-01 -#> 3 m1 12.91 13.04196 -1.320e-01 -#> 3 m1 12.96 13.04196 -8.196e-02 -#> 7 m1 22.97 25.06847 -2.098e+00 -#> 7 m1 24.47 25.06847 -5.985e-01 -#> 14 m1 41.69 36.70308 4.987e+00 -#> 14 m1 33.21 36.70308 -3.493e+00 -#> 21 m1 44.37 41.65115 2.719e+00 -#> 21 m1 46.44 41.65115 4.789e+00 -#> 35 m1 41.22 43.29465 -2.075e+00 -#> 35 m1 37.95 43.29465 -5.345e+00 -#> 50 m1 41.19 41.19948 -9.479e-03 -#> 50 m1 40.01 41.19948 -1.189e+00 -#> 75 m1 40.09 36.44035 3.650e+00 -#> 75 m1 33.85 36.44035 -2.590e+00 -#> 100 m1 31.04 31.98773 -9.477e-01 -#> 100 m1 33.13 31.98773 1.142e+00 -#> 120 m1 25.15 28.80429 -3.654e+00 -#> 120 m1 33.31 28.80429 4.506e+00
f.tc <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, error_model = "tc", quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
summary(f.tc)
#> mkin version used for fitting: 0.9.50.3 -#> R version used for fitting: 4.0.0 -#> Date of fit: Wed May 27 07:43:52 2020 -#> Date of summary: Wed May 27 07:43:52 2020 -#> -#> Equations: -#> d_parent/dt = - k_parent * parent -#> d_m1/dt = + f_parent_to_m1 * k_parent * parent - k_m1 * m1 +#> d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent +#> d_m1/dt = + f_parent_to_m1 * (alpha/beta) * 1/((time/beta) + 1) * +#> parent - k_m1 * m1 #> -#> Model predictions using solution type analytical +#> Model predictions using solution type deSolve #> -#> Fitted using 2088 model solutions performed in 0.714 s +#> Fitted using 3611 model solutions performed in 2.61 s #> #> Error model: Two-component variance function #> #> Error model algorithm: d_3 -#> Direct fitting and three-step fitting yield approximately the same likelihood +#> Three-step fitting yielded a higher likelihood than direct fitting #> #> Starting values for parameters to be optimised: -#> value type -#> parent_0 100.7500 state -#> k_parent 0.1000 deparm -#> k_m1 0.1001 deparm -#> f_parent_to_m1 0.5000 deparm -#> sigma_low 0.1000 error -#> rsd_high 0.1000 error +#> value type +#> parent_0 100.75 state +#> alpha 1.00 deparm +#> beta 10.00 deparm +#> k_m1 0.10 deparm +#> f_parent_to_m1 0.50 deparm +#> sigma_low 0.10 error +#> rsd_high 0.10 error #> #> Starting values for the transformed parameters actually optimised: #> value lower upper #> parent_0 100.750000 -Inf Inf -#> log_k_parent -2.302585 -Inf Inf -#> log_k_m1 -2.301586 -Inf Inf +#> log_k_m1 -2.302585 -Inf Inf #> f_parent_ilr_1 0.000000 -Inf Inf +#> log_alpha 0.000000 -Inf Inf +#> log_beta 2.302585 -Inf Inf #> sigma_low 0.100000 0 Inf #> rsd_high 0.100000 0 Inf #> @@ -932,98 +624,70 @@ Degradation Data. Environments 6(12) 124 #> #> Results: #> -#> AIC BIC logLik -#> 141.9656 151.7911 -64.98278 +#> AIC BIC logLik +#> 143.658 155.1211 -64.82902 #> #> Optimised, transformed parameters with symmetric confidence intervals: -#> Estimate Std. Error Lower Upper -#> parent_0 100.70000 2.621000 95.400000 106.10000 -#> log_k_parent -2.29700 0.008862 -2.315000 -2.27900 -#> log_k_m1 -5.26600 0.091310 -5.452000 -5.08000 -#> f_parent_ilr_1 0.02374 0.055300 -0.088900 0.13640 -#> sigma_low 0.00305 0.004829 -0.006786 0.01289 -#> rsd_high 0.07928 0.009418 0.060100 0.09847 +#> Estimate Std. Error Lower Upper +#> parent_0 101.600000 2.6390000 96.240000 107.000000 +#> log_k_m1 -5.284000 0.0928900 -5.473000 -5.095000 +#> f_parent_ilr_1 0.001008 0.0541900 -0.109500 0.111500 +#> log_alpha 5.522000 0.0077300 5.506000 5.538000 +#> log_beta 7.806000 NaN NaN NaN +#> sigma_low 0.002488 0.0002431 0.001992 0.002984 +#> rsd_high 0.079210 0.0093280 0.060180 0.098230 #> #> Parameter correlation: -#> parent_0 log_k_parent log_k_m1 f_parent_ilr_1 sigma_low rsd_high -#> parent_0 1.00000 0.67644 -0.10215 -0.76822 0.14294 -0.08783 -#> log_k_parent 0.67644 1.00000 -0.15102 -0.59491 0.34611 -0.08125 -#> log_k_m1 -0.10215 -0.15102 1.00000 0.51808 -0.05236 0.01240 -#> f_parent_ilr_1 -0.76822 -0.59491 0.51808 1.00000 -0.13900 0.03248 -#> sigma_low 0.14294 0.34611 -0.05236 -0.13900 1.00000 -0.16546 -#> rsd_high -0.08783 -0.08125 0.01240 0.03248 -0.16546 1.00000 +#> parent_0 log_k_m1 f_parent_ilr_1 log_alpha log_beta sigma_low +#> parent_0 1.000000 -0.094697 -0.76654 0.70525 NaN 0.016099 +#> log_k_m1 -0.094697 1.000000 0.51404 -0.14347 NaN 0.001576 +#> f_parent_ilr_1 -0.766543 0.514038 1.00000 -0.61368 NaN 0.015465 +#> log_alpha 0.705247 -0.143468 -0.61368 1.00000 NaN 5.871780 +#> log_beta NaN NaN NaN NaN 1 NaN +#> sigma_low 0.016099 0.001576 0.01546 5.87178 NaN 1.000000 +#> rsd_high 0.006566 -0.011662 -0.05353 0.04845 NaN -0.652554 +#> rsd_high +#> parent_0 0.006566 +#> log_k_m1 -0.011662 +#> f_parent_ilr_1 -0.053525 +#> log_alpha 0.048451 +#> log_beta NaN +#> sigma_low -0.652554 +#> rsd_high 1.000000 #> #> Backtransformed parameters: #> Confidence intervals for internally transformed parameters are asymmetric. #> t-test (unrealistically) based on the assumption of normal distribution #> for estimators of untransformed parameters. -#> Estimate t value Pr(>t) Lower Upper -#> parent_0 1.007e+02 38.4300 1.180e-28 95.400000 1.061e+02 -#> k_parent 1.006e-01 112.8000 1.718e-43 0.098760 1.024e-01 -#> k_m1 5.167e-03 10.9500 1.171e-12 0.004290 6.223e-03 -#> f_parent_to_m1 5.084e-01 26.0100 2.146e-23 0.468600 5.481e-01 -#> sigma_low 3.050e-03 0.6314 2.661e-01 -0.006786 1.289e-02 -#> rsd_high 7.928e-02 8.4170 6.418e-10 0.060100 9.847e-02 +#> Estimate t value Pr(>t) Lower Upper +#> parent_0 1.016e+02 32.7800 6.312e-26 9.624e+01 1.070e+02 +#> k_m1 5.072e-03 10.1200 1.216e-11 4.197e-03 6.130e-03 +#> f_parent_to_m1 5.004e-01 20.8300 4.318e-20 4.614e-01 5.394e-01 +#> alpha 2.502e+02 0.5624 2.889e-01 2.463e+02 2.542e+02 +#> beta 2.455e+03 0.5549 2.915e-01 NA NA +#> sigma_low 2.488e-03 0.4843 3.158e-01 1.992e-03 2.984e-03 +#> rsd_high 7.921e-02 8.4300 8.001e-10 6.018e-02 9.823e-02 #> #> FOCUS Chi2 error levels in percent: #> err.min n.optim df -#> All data 6.475 4 15 -#> parent 6.573 2 7 -#> m1 4.671 2 8 +#> All data 6.781 5 14 +#> parent 7.141 3 6 +#> m1 4.640 2 8 #> #> Resulting formation fractions: #> ff -#> parent_m1 0.5084 -#> parent_sink 0.4916 +#> parent_m1 0.5004 +#> parent_sink 0.4996 #> #> Estimated disappearance times: -#> DT50 DT90 -#> parent 6.893 22.9 -#> m1 134.156 445.7 -#> -#> Data: -#> time variable observed predicted residual -#> 0 parent 99.46 100.73434 -1.274340 -#> 0 parent 102.04 100.73434 1.305660 -#> 1 parent 93.50 91.09751 2.402486 -#> 1 parent 92.50 91.09751 1.402486 -#> 3 parent 63.23 74.50141 -11.271410 -#> 3 parent 68.99 74.50141 -5.511410 -#> 7 parent 52.32 49.82880 2.491200 -#> 7 parent 55.13 49.82880 5.301200 -#> 14 parent 27.27 24.64809 2.621908 -#> 14 parent 26.64 24.64809 1.991908 -#> 21 parent 11.50 12.19232 -0.692315 -#> 21 parent 11.64 12.19232 -0.552315 -#> 35 parent 2.85 2.98327 -0.133266 -#> 35 parent 2.91 2.98327 -0.073266 -#> 50 parent 0.69 0.66013 0.029874 -#> 50 parent 0.63 0.66013 -0.030126 -#> 75 parent 0.05 0.05344 -0.003438 -#> 75 parent 0.06 0.05344 0.006562 -#> 1 m1 4.84 4.88645 -0.046451 -#> 1 m1 5.64 4.88645 0.753549 -#> 3 m1 12.91 13.22867 -0.318669 -#> 3 m1 12.96 13.22867 -0.268669 -#> 7 m1 22.97 25.36417 -2.394166 -#> 7 m1 24.47 25.36417 -0.894166 -#> 14 m1 41.69 37.00974 4.680263 -#> 14 m1 33.21 37.00974 -3.799737 -#> 21 m1 44.37 41.90133 2.468669 -#> 21 m1 46.44 41.90133 4.538669 -#> 35 m1 41.22 43.45691 -2.236913 -#> 35 m1 37.95 43.45691 -5.506913 -#> 50 m1 41.19 41.34199 -0.151985 -#> 50 m1 40.01 41.34199 -1.331985 -#> 75 m1 40.09 36.61471 3.475295 -#> 75 m1 33.85 36.61471 -2.764705 -#> 100 m1 31.04 32.20082 -1.160823 -#> 100 m1 33.13 32.20082 0.929177 -#> 120 m1 25.15 29.04130 -3.891304 -#> 120 m1 33.31 29.04130 4.268696
# } - - -
+#> DT50 DT90 DT50back +#> parent 6.812 22.7 6.834 +#> m1 136.661 454.0 NA
+# We can easily use starting parameters from the parent only fit (only for illustration) +fit.FOMC = mkinfit("FOMC", FOCUS_2006_D, quiet = TRUE, error_model = "tc") +fit.FOMC_SFO <- mkinfit(FOMC_SFO, FOCUS_D, quiet = TRUE, + parms.ini = fit.FOMC$bparms.ode, error_model = "tc") +# }
#> Compilation argument: -#> /usr/lib/R/bin/R CMD SHLIB file15d25f6867c9.c 2> file15d25f6867c9.c.err.txt +#> /usr/lib/R/bin/R CMD SHLIB file306f74383fd2.c 2> file306f74383fd2.c.err.txt #> Program source: #> 1: #include <R.h> #> 2: @@ -301,7 +301,7 @@ Evaluating and Calculating Degradation Kinetics in Environmental Media

#> }) #> return(predicted) #> } -#> <environment: 0x5555576161e0>
+#> <environment: 0x55555ad56ea0>
# If we have several parallel metabolites # (compare tests/testthat/test_synthetic_data_for_UBA_2014.R) m_synth_DFOP_par <- mkinmod( @@ -312,8 +312,9 @@ Evaluating and Calculating Degradation Kinetics in Environmental Media

fit_DFOP_par_c <- mkinfit(m_synth_DFOP_par, synthetic_data_for_UBA_2014[[12]]$data, - quiet = TRUE) -# }
+ quiet = TRUE)
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.000174
# } + +
diff --git a/docs/dev/reference/mkinpredict.html b/docs/dev/reference/mkinpredict.html index 6d83e56f..15699c02 100644 --- a/docs/dev/reference/mkinpredict.html +++ b/docs/dev/reference/mkinpredict.html @@ -74,7 +74,7 @@ kinetic parameters and initial values for the state variables." /> mkin - 0.9.50.3 + 0.9.50.3 @@ -401,9 +401,9 @@ solver is used.

solution_type = "analytical", use_compiled = FALSE)[201,]) }
#> test relative elapsed #> 2 deSolve_compiled 1.0 0.005 -#> 4 analytical 1.0 0.005 +#> 4 analytical 1.8 0.009 #> 1 eigen 4.0 0.020 -#> 3 deSolve 45.6 0.228
+#> 3 deSolve 44.6 0.223
# \dontrun{ # Predict from a fitted model f <- mkinfit(SFO_SFO, FOCUS_2006_C, quiet = TRUE) diff --git a/docs/dev/reference/mkinresplot.html b/docs/dev/reference/mkinresplot.html index 11e0914e..5591d26f 100644 --- a/docs/dev/reference/mkinresplot.html +++ b/docs/dev/reference/mkinresplot.html @@ -75,7 +75,7 @@ argument show_residuals = TRUE." /> mkin - 0.9.50.3 + 0.9.50.3
@@ -243,7 +243,7 @@ combining the plot of the fit and the residual plot.

Examples

-model <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
fit <- mkinfit(model, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
mkinresplot(fit, "m1")
+model <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
fit <- mkinfit(model, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
mkinresplot(fit, "m1")
diff --git a/docs/dev/reference/mmkin-3.png b/docs/dev/reference/mmkin-3.png index e80448ab..bce34531 100644 Binary files a/docs/dev/reference/mmkin-3.png and b/docs/dev/reference/mmkin-3.png differ diff --git a/docs/dev/reference/mmkin-5.png b/docs/dev/reference/mmkin-5.png index 4c771bc9..56750342 100644 Binary files a/docs/dev/reference/mmkin-5.png and b/docs/dev/reference/mmkin-5.png differ diff --git a/docs/dev/reference/mmkin.html b/docs/dev/reference/mmkin.html index 3daf16e1..a5d7ba42 100644 --- a/docs/dev/reference/mmkin.html +++ b/docs/dev/reference/mmkin.html @@ -196,8 +196,9 @@ for parallel execution.

Value

A two-dimensional array of mkinfit -objects that can be indexed using the model names for the first index (row index) -and the dataset names for the second index (column index).

+objects and/or try-errors that can be indexed using the model names for the +first index (row index) and the dataset names for the second index (column +index).

See also

[.mmkin for subsetting, plot.mmkin for @@ -218,19 +219,19 @@ plotting.

time_default <- system.time(fits.0 <- mmkin(models, datasets, quiet = TRUE)) time_1 <- system.time(fits.4 <- mmkin(models, datasets, cores = 1, quiet = TRUE))
#> Warning: Optimisation did not converge: -#> false convergence (8)
+#> false convergence (8)
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0117
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0174
time_default
#> user system elapsed -#> 4.499 0.456 1.983
time_1
#> user system elapsed -#> 5.771 0.003 5.777
+#> 4.500 0.399 1.311
time_1
#> user system elapsed +#> 5.154 0.008 5.165
endpoints(fits.0[["SFO_lin", 2]])
#> $ff #> parent_M1 parent_sink M1_M2 M1_sink -#> 0.7340479 0.2659521 0.7505687 0.2494313 +#> 0.7340478 0.2659522 0.7505691 0.2494309 #> #> $distimes #> DT50 DT90 #> parent 0.8777688 2.915885 -#> M1 2.3257457 7.725960 -#> M2 33.7200848 112.015697 +#> M1 2.3257466 7.725963 +#> M2 33.7200800 112.015681 #>
# plot.mkinfit handles rows or columns of mmkin result objects plot(fits.0[1, ])
plot(fits.0[1, ], obs_var = c("M1", "M2"))
plot(fits.0[, 1])
# Use double brackets to extract a single mkinfit object, which will be plotted diff --git a/docs/dev/reference/nafta.html b/docs/dev/reference/nafta.html index fe802c1b..690e4827 100644 --- a/docs/dev/reference/nafta.html +++ b/docs/dev/reference/nafta.html @@ -76,7 +76,7 @@ order of increasing model complexity, i.e. SFO, then IORE, and finally DFOP." /> mkin - 0.9.50.3 + 0.9.50.3
@@ -214,7 +214,7 @@ list element "data" contains the dataset used in the fits.

Examples

- nafta_evaluation <- nafta(NAFTA_SOP_Appendix_D, cores = 1)
#> The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
#> The representative half-life of the IORE model is longer than the one corresponding
#> to the terminal degradation rate found with the DFOP model.
#> The representative half-life obtained from the DFOP model may be used
print(nafta_evaluation)
#> Sums of squares: + nafta_evaluation <- nafta(NAFTA_SOP_Appendix_D, cores = 1)
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.00192
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.00258
#> The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
#> The representative half-life of the IORE model is longer than the one corresponding
#> to the terminal degradation rate found with the DFOP model.
#> The representative half-life obtained from the DFOP model may be used
print(nafta_evaluation)
#> Sums of squares: #> SFO IORE DFOP #> 1378.6832 615.7730 517.8836 #> @@ -223,17 +223,17 @@ list element "data" contains the dataset used in the fits.

#> #> Parameters: #> $SFO -#> Estimate Pr(>t) Lower Upper -#> parent_0 83.7558 1.80e-14 77.18268 90.3288 -#> k_parent_sink 0.0017 7.43e-05 0.00112 0.0026 -#> sigma 8.7518 1.22e-05 5.64278 11.8608 +#> Estimate Pr(>t) Lower Upper +#> parent_0 83.7558 1.80e-14 77.18268 90.3288 +#> k_parent 0.0017 7.43e-05 0.00112 0.0026 +#> sigma 8.7518 1.22e-05 5.64278 11.8608 #> #> $IORE -#> Estimate Pr(>t) Lower Upper -#> parent_0 9.69e+01 NA 8.88e+01 1.05e+02 -#> k__iore_parent_sink 8.40e-14 NA 1.79e-18 3.94e-09 -#> N_parent 6.68e+00 NA 4.19e+00 9.17e+00 -#> sigma 5.85e+00 NA 3.76e+00 7.94e+00 +#> Estimate Pr(>t) Lower Upper +#> parent_0 9.69e+01 NA 8.88e+01 1.05e+02 +#> k__iore_parent 8.40e-14 NA 1.79e-18 3.94e-09 +#> N_parent 6.68e+00 NA 4.19e+00 9.17e+00 +#> sigma 5.85e+00 NA 3.76e+00 7.94e+00 #> #> $DFOP #> Estimate Pr(>t) Lower Upper diff --git a/docs/dev/reference/nlme-1.png b/docs/dev/reference/nlme-1.png index 68ccb43f..8db1f999 100644 Binary files a/docs/dev/reference/nlme-1.png and b/docs/dev/reference/nlme-1.png differ diff --git a/docs/dev/reference/nlme.html b/docs/dev/reference/nlme.html index 28a9f0a5..af5a151a 100644 --- a/docs/dev/reference/nlme.html +++ b/docs/dev/reference/nlme.html @@ -225,28 +225,28 @@ nlme for the case of a single grouping variable ds.

#> Model: value ~ nlme_f(name, time, parent_0, log_k_parent_sink) #> Data: grouped_data #> AIC BIC logLik -#> 298.2781 307.7372 -144.1391 +#> 252.7798 262.1358 -121.3899 #> #> Random effects: #> Formula: list(parent_0 ~ 1, log_k_parent_sink ~ 1) #> Level: ds #> Structure: Diagonal -#> parent_0 log_k_parent_sink Residual -#> StdDev: 0.9374809 0.7098104 3.835429 +#> parent_0 log_k_parent_sink Residual +#> StdDev: 0.0006768135 0.6800777 2.489397 #> #> Fixed effects: parent_0 + log_k_parent_sink ~ 1 -#> Value Std.Error DF t-value p-value -#> parent_0 101.76838 1.1445465 45 88.91589 0 -#> log_k_parent_sink -3.05444 0.4195622 45 -7.28008 0 +#> Value Std.Error DF t-value p-value +#> parent_0 101.74884 0.6456014 44 157.60321 0 +#> log_k_parent_sink -3.05575 0.4015811 44 -7.60929 0 #> Correlation: #> prnt_0 -#> log_k_parent_sink 0.034 +#> log_k_parent_sink 0.026 #> #> Standardized Within-Group Residuals: -#> Min Q1 Med Q3 Max -#> -2.61693660 -0.21853517 0.05740766 0.57209378 3.04598387 +#> Min Q1 Med Q3 Max +#> -2.1317488 -0.6878121 0.0828385 0.8592270 2.9529864 #> -#> Number of Observations: 49 +#> Number of Observations: 48 #> Number of Groups: 3
plot(augPred(m_nlme, level = 0:1), layout = c(3, 1))
# augPred does not seem to work on fits with more than one state # variable diff --git a/docs/dev/reference/nlme.mmkin.html b/docs/dev/reference/nlme.mmkin.html index c7db9c23..16df54af 100644 --- a/docs/dev/reference/nlme.mmkin.html +++ b/docs/dev/reference/nlme.mmkin.html @@ -262,45 +262,44 @@ with additional elements

Examples

ds <- lapply(experimental_data_for_UBA_2019[6:10], function(x) subset(x$data[c("name", "time", "value")], name == "parent")) -f <- mmkin("SFO", ds, quiet = TRUE, cores = 1) -library(nlme) +f <- mmkin("SFO", ds, quiet = TRUE, cores = 1)
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0195
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.011
library(nlme) endpoints(f[[1]])
#> $distimes #> DT50 DT90 #> parent 11.96183 39.73634 #>
f_nlme <- nlme(f) print(f_nlme)
#> Nonlinear mixed-effects model fit by maximum likelihood -#> Model: value ~ (mkin::get_deg_func())(name, time, parent_0, log_k_parent_sink) +#> Model: value ~ (mkin::get_deg_func())(name, time, parent_0, log_k_parent) #> Data: "Not shown" #> Log-likelihood: -307.5269 -#> Fixed: list(parent_0 ~ 1, log_k_parent_sink ~ 1) -#> parent_0 log_k_parent_sink -#> 85.540979 -3.229602 +#> Fixed: list(parent_0 ~ 1, log_k_parent ~ 1) +#> parent_0 log_k_parent +#> 85.541149 -3.229596 #> #> Random effects: -#> Formula: list(parent_0 ~ 1, log_k_parent_sink ~ 1) +#> Formula: list(parent_0 ~ 1, log_k_parent ~ 1) #> Level: ds #> Structure: Diagonal -#> parent_0 log_k_parent_sink Residual -#> StdDev: 1.308245 1.288586 6.304923 +#> parent_0 log_k_parent Residual +#> StdDev: 1.30857 1.288591 6.304906 #> #> Number of Observations: 90 #> Number of Groups: 5
endpoints(f_nlme)
#> $distimes #> DT50 DT90 -#> parent 17.51556 58.18543 +#> parent 17.51545 58.18505 #>
# \dontrun{ f_nlme_2 <- nlme(f, start = c(parent_0 = 100, log_k_parent_sink = 0.1)) update(f_nlme_2, random = parent_0 ~ 1)
#> Nonlinear mixed-effects model fit by maximum likelihood -#> Model: value ~ (mkin::get_deg_func())(name, time, parent_0, log_k_parent_sink) +#> Model: value ~ (mkin::get_deg_func())(name, time, parent_0, log_k_parent) #> Data: "Not shown" #> Log-likelihood: -404.3729 -#> Fixed: list(parent_0 ~ 1, log_k_parent_sink ~ 1) -#> parent_0 log_k_parent_sink -#> 75.933480 -3.555983 +#> Fixed: list(parent_0 ~ 1, log_k_parent ~ 1) +#> parent_0 log_k_parent +#> 75.933480 -3.555983 #> #> Random effects: #> Formula: parent_0 ~ 1 | ds #> parent_0 Residual -#> StdDev: 0.002416802 21.63027 +#> StdDev: 0.002416792 21.63027 #> #> Number of Observations: 90 #> Number of Groups: 5
# Test on some real data @@ -332,88 +331,88 @@ with additional elements

f_nlme_fomc_sfo <- nlme(f_2["FOMC-SFO", ], control = list(pnlsMaxIter = 100, tolerance = 1e-4), verbose = TRUE)
#> #> **Iteration 1 -#> LME step: Loglik: -394.1603, nlminb iterations: 2 +#> LME step: Loglik: -394.1603, nlminb iterations: 3 #> reStruct parameters: #> ds1 ds2 ds3 ds4 ds5 -#> -0.2079863 0.8563823 1.7454253 1.0917707 1.2756955 +#> -0.2079793 0.8563830 1.7454105 1.0917354 1.2756825 #> Beginning PNLS step: .. completed fit_nlme() step. -#> PNLS step: RSS = 643.8814 -#> fixed effects: 94.17379 -5.473189 -0.6970234 -0.202509 2.103883 +#> PNLS step: RSS = 643.8803 +#> fixed effects: 94.17379 -5.473193 -0.6970236 -0.2025091 2.103883 #> iterations: 100 #> Convergence crit. (must all become <= tolerance = 0.0001): #> fixed reStruct -#> 0.7959873 0.1447512 +#> 0.7960134 0.1447728 #> #> **Iteration 2 #> LME step: Loglik: -396.3824, nlminb iterations: 7 #> reStruct parameters: #> ds1 ds2 ds3 ds4 ds5 -#> -1.712406e-01 -2.278541e-05 1.842120e+00 1.073975e+00 1.322924e+00 +#> -1.712404e-01 -2.432655e-05 1.842120e+00 1.073975e+00 1.322925e+00 #> Beginning PNLS step: .. completed fit_nlme() step. -#> PNLS step: RSS = 643.8025 -#> fixed effects: 94.17385 -5.473491 -0.6970406 -0.2025139 2.103871 +#> PNLS step: RSS = 643.8035 +#> fixed effects: 94.17385 -5.473487 -0.6970404 -0.2025137 2.103871 #> iterations: 100 #> Convergence crit. (must all become <= tolerance = 0.0001): -#> fixed reStruct -#> 5.51758e-05 1.26861e-03 +#> fixed reStruct +#> 5.382757e-05 1.236667e-03 #> #> **Iteration 3 #> LME step: Loglik: -396.3825, nlminb iterations: 7 #> reStruct parameters: #> ds1 ds2 ds3 ds4 ds5 -#> -0.1712500923 -0.0001515734 1.8420972550 1.0739796967 1.3229177241 +#> -0.1712499044 -0.0001499831 1.8420971364 1.0739799123 1.3229167796 #> Beginning PNLS step: .. completed fit_nlme() step. -#> PNLS step: RSS = 643.7941 -#> fixed effects: 94.17386 -5.473523 -0.6970424 -0.2025146 2.103869 +#> PNLS step: RSS = 643.7948 +#> fixed effects: 94.17386 -5.473521 -0.6970422 -0.2025144 2.10387 #> iterations: 100 #> Convergence crit. (must all become <= tolerance = 0.0001): #> fixed reStruct -#> 5.792621e-06 1.335434e-04 +#> 6.072817e-06 1.400857e-04 #> #> **Iteration 4 #> LME step: Loglik: -396.3825, nlminb iterations: 7 #> reStruct parameters: #> ds1 ds2 ds3 ds4 ds5 -#> -0.1712517206 -0.0001651603 1.8420950864 1.0739800294 1.3229173529 +#> -0.1712529502 -0.0001641277 1.8420957542 1.0739797181 1.3229173076 #> Beginning PNLS step: .. completed fit_nlme() step. -#> PNLS step: RSS = 643.7949 -#> fixed effects: 94.17386 -5.473521 -0.6970423 -0.2025145 2.10387 +#> PNLS step: RSS = 643.7936 +#> fixed effects: 94.17386 -5.473526 -0.6970426 -0.2025146 2.103869 #> iterations: 100 #> Convergence crit. (must all become <= tolerance = 0.0001): #> fixed reStruct -#> 4.025781e-07 9.628656e-06
f_nlme_dfop_sfo <- nlme(f_2["DFOP-SFO", ], +#> 1.027451e-06 2.275704e-05
f_nlme_dfop_sfo <- nlme(f_2["DFOP-SFO", ], control = list(pnlsMaxIter = 120, tolerance = 5e-4), verbose = TRUE)
#> #> **Iteration 1 -#> LME step: Loglik: -404.9583, nlminb iterations: 1 +#> LME step: Loglik: -404.9582, nlminb iterations: 1 #> reStruct parameters: #> ds1 ds2 ds3 ds4 ds5 ds6 -#> -0.4114357 0.9798641 1.6990035 0.7293314 0.3354323 1.7113047 +#> -0.4114355 0.9798697 1.6990037 0.7293315 0.3354323 1.7113046 #> Beginning PNLS step: .. completed fit_nlme() step. -#> PNLS step: RSS = 630.3642 -#> fixed effects: 93.82269 -5.455991 -0.6788957 -1.862196 -4.199671 0.0553284 +#> PNLS step: RSS = 630.3644 +#> fixed effects: 93.82269 -5.455991 -0.6788957 -1.862196 -4.199671 0.05532828 #> iterations: 120 #> Convergence crit. (must all become <= tolerance = 0.0005): #> fixed reStruct -#> 0.7879730 0.5822574 +#> 0.7885368 0.5822683 #> #> **Iteration 2 #> LME step: Loglik: -407.7755, nlminb iterations: 11 #> reStruct parameters: #> ds1 ds2 ds3 ds4 ds5 ds6 -#> -0.371224105 0.003056163 1.789939431 0.724671132 0.301602942 1.754200482 +#> -0.371224133 0.003056179 1.789939402 0.724671158 0.301602977 1.754200729 #> Beginning PNLS step: .. completed fit_nlme() step. -#> PNLS step: RSS = 630.364 -#> fixed effects: 93.82269 -5.455991 -0.6788958 -1.862196 -4.199671 0.05532834 +#> PNLS step: RSS = 630.3633 +#> fixed effects: 93.82269 -5.455992 -0.6788958 -1.862196 -4.199671 0.05532831 #> iterations: 120 #> Convergence crit. (must all become <= tolerance = 0.0005): #> fixed reStruct -#> 9.814652e-07 1.059239e-05
plot(f_2["FOMC-SFO", 3:4])
plot(f_nlme_fomc_sfo, 3:4)
+#> 4.789774e-07 2.200661e-05
plot(f_2["FOMC-SFO", 3:4])
plot(f_nlme_fomc_sfo, 3:4)
plot(f_2["DFOP-SFO", 3:4])
plot(f_nlme_dfop_sfo, 3:4)
anova(f_nlme_dfop_sfo, f_nlme_fomc_sfo, f_nlme_sfo_sfo)
#> Model df AIC BIC logLik Test L.Ratio p-value -#> f_nlme_dfop_sfo 1 13 843.8547 884.6201 -408.9274 -#> f_nlme_fomc_sfo 2 11 818.5151 853.0089 -398.2576 1 vs 2 21.33957 <.0001 -#> f_nlme_sfo_sfo 3 9 1085.1821 1113.4043 -533.5910 2 vs 3 270.66697 <.0001
anova(f_nlme_dfop_sfo, f_nlme_sfo_sfo) # if we ignore FOMC
#> Model df AIC BIC logLik Test L.Ratio p-value -#> f_nlme_dfop_sfo 1 13 843.8547 884.6201 -408.9274 +#> f_nlme_dfop_sfo 1 13 843.8547 884.6201 -408.9273 +#> f_nlme_fomc_sfo 2 11 818.5149 853.0087 -398.2575 1 vs 2 21.33975 <.0001 +#> f_nlme_sfo_sfo 3 9 1085.1821 1113.4043 -533.5910 2 vs 3 270.66716 <.0001
anova(f_nlme_dfop_sfo, f_nlme_sfo_sfo) # if we ignore FOMC
#> Model df AIC BIC logLik Test L.Ratio p-value +#> f_nlme_dfop_sfo 1 13 843.8547 884.6201 -408.9273 #> f_nlme_sfo_sfo 2 9 1085.1821 1113.4043 -533.5910 1 vs 2 249.3274 <.0001
endpoints(f_nlme_sfo_sfo)
#> $ff #> parent_sink parent_A1 A1_sink @@ -428,9 +427,9 @@ with additional elements

#> 0.2768574 0.7231426 #> #> $distimes -#> DT50 DT90 DT50_k1 DT50_k2 -#> parent 11.07091 104.6320 4.462384 46.20825 -#> A1 162.30518 539.1661 NA NA +#> DT50 DT90 DT50back DT50_k1 DT50_k2 +#> parent 11.07091 104.6320 31.49738 4.462384 46.20825 +#> A1 162.30536 539.1667 NA NA NA #>
# }
diff --git a/docs/dev/reference/parms.html b/docs/dev/reference/parms.html index a50ca352..bd35d3c1 100644 --- a/docs/dev/reference/parms.html +++ b/docs/dev/reference/parms.html @@ -188,23 +188,22 @@ such matrices is returned.

Examples

# mkinfit objects fit <- mkinfit("SFO", FOCUS_2006_C, quiet = TRUE) -parms(fit)
#> parent_0 k_parent_sink sigma -#> 82.4921598 0.3060633 4.6730124
parms(fit, transformed = TRUE)
#> parent_0 log_k_parent_sink sigma -#> 82.492160 -1.183963 4.673012
+parms(fit)
#> parent_0 k_parent sigma +#> 82.4921598 0.3060633 4.6730124
parms(fit, transformed = TRUE)
#> parent_0 log_k_parent sigma +#> 82.492160 -1.183963 4.673012
# mmkin objects ds <- lapply(experimental_data_for_UBA_2019[6:10], function(x) subset(x$data[c("name", "time", "value")])) names(ds) <- paste("Dataset", 6:10) # \dontrun{ -fits <- mmkin(c("SFO", "FOMC", "DFOP"), ds, quiet = TRUE, cores = 1) -parms(fits["SFO", ])
#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 -#> parent_0 88.52275400 82.666781678 86.8547308 91.7779306 82.14809450 -#> k_parent_sink 0.05794659 0.009647805 0.2102974 0.1232258 0.00720421 -#> sigma 5.15274487 7.040168584 3.6769645 6.4669234 6.50457673
parms(fits[, 2])
#> $SFO -#> Dataset 7 -#> parent_0 82.666781678 -#> k_parent_sink 0.009647805 -#> sigma 7.040168584 +fits <- mmkin(c("SFO", "FOMC", "DFOP"), ds, quiet = TRUE, cores = 1)
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0195
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.00408
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0492
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.00985
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.00815
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.011
parms(fits["SFO", ])
#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 +#> parent_0 88.52275400 82.666781678 86.8547308 91.7779306 82.14809450 +#> k_parent 0.05794659 0.009647805 0.2102974 0.1232258 0.00720421 +#> sigma 5.15274487 7.040168584 3.6769645 6.4669234 6.50457673
parms(fits[, 2])
#> $SFO +#> Dataset 7 +#> parent_0 82.666781678 +#> k_parent 0.009647805 +#> sigma 7.040168584 #> #> $FOMC #> Dataset 7 @@ -221,10 +220,10 @@ such matrices is returned.

#> g 0.526942415 #> sigma 2.221302196 #>
parms(fits)
#> $SFO -#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 -#> parent_0 88.52275400 82.666781678 86.8547308 91.7779306 82.14809450 -#> k_parent_sink 0.05794659 0.009647805 0.2102974 0.1232258 0.00720421 -#> sigma 5.15274487 7.040168584 3.6769645 6.4669234 6.50457673 +#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 +#> parent_0 88.52275400 82.666781678 86.8547308 91.7779306 82.14809450 +#> k_parent 0.05794659 0.009647805 0.2102974 0.1232258 0.00720421 +#> sigma 5.15274487 7.040168584 3.6769645 6.4669234 6.50457673 #> #> $FOMC #> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 @@ -241,15 +240,15 @@ such matrices is returned.

#> g 0.44845068 0.526942415 0.66091965 0.65322767 0.342652880 #> sigma 1.35690468 2.221302196 1.34169076 2.87159846 1.942067831 #>
parms(fits, transformed = TRUE)
#> $SFO -#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 -#> parent_0 88.522754 82.666782 86.854731 91.777931 82.148094 -#> log_k_parent_sink -2.848234 -4.641025 -1.559232 -2.093737 -4.933090 -#> sigma 5.152745 7.040169 3.676964 6.466923 6.504577 +#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 +#> parent_0 88.522754 82.666782 86.854731 91.777931 82.148094 +#> log_k_parent -2.848234 -4.641025 -1.559232 -2.093737 -4.933090 +#> sigma 5.152745 7.040169 3.676964 6.466923 6.504577 #> #> $FOMC #> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 -#> parent_0 95.5585751 92.6837649 90.7197870 98.38393896 94.848146 -#> log_alpha 0.2916741 -0.6996015 0.4941466 0.07181817 -1.271085 +#> parent_0 95.5585751 92.6837649 90.7197870 98.38393897 94.848146 +#> log_alpha 0.2916741 -0.6996015 0.4941466 0.07181816 -1.271085 #> log_beta 2.5675088 2.6493701 1.6108523 1.48095106 1.932278 #> sigma 1.8476712 1.9167519 1.0660627 3.14605557 1.622278 #> diff --git a/docs/dev/reference/plot.mkinfit.html b/docs/dev/reference/plot.mkinfit.html index b9331f1a..ffbd1206 100644 --- a/docs/dev/reference/plot.mkinfit.html +++ b/docs/dev/reference/plot.mkinfit.html @@ -74,7 +74,7 @@ observed data together with the solution of the fitted model." /> mkin - 0.9.50.3 + 0.9.50.3
@@ -338,7 +338,7 @@ latex is being used for the formatting of the chi2 error level, if # parent to sink included # \dontrun{ SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1", full = "Parent"), - m1 = mkinsub("SFO", full = "Metabolite M1" ))
#> Successfully compiled differential equation model from auto-generated C code.
fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE, error_model = "tc")
#> Warning: Observations with value of zero were removed from the data
plot(fit)
plot_res(fit)
plot_res(fit, standardized = FALSE)
plot_err(fit)
+ m1 = mkinsub("SFO", full = "Metabolite M1" ))
#> Successfully compiled differential equation model from auto-generated C code.
fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE, error_model = "tc")
#> Warning: Observations with value of zero were removed from the data
plot(fit)
plot_res(fit)
plot_res(fit, standardized = FALSE)
plot_err(fit)
# Show the observed variables separately, with residuals plot(fit, sep_obs = TRUE, show_residuals = TRUE, lpos = c("topright", "bottomright"), show_errmin = TRUE)
diff --git a/docs/dev/reference/plot.mmkin-1.png b/docs/dev/reference/plot.mmkin-1.png index 8cf969c9..24fa6ca7 100644 Binary files a/docs/dev/reference/plot.mmkin-1.png and b/docs/dev/reference/plot.mmkin-1.png differ diff --git a/docs/dev/reference/plot.mmkin-2.png b/docs/dev/reference/plot.mmkin-2.png index 45d67b55..377e50b5 100644 Binary files a/docs/dev/reference/plot.mmkin-2.png and b/docs/dev/reference/plot.mmkin-2.png differ diff --git a/docs/dev/reference/plot.mmkin-3.png b/docs/dev/reference/plot.mmkin-3.png index c58b371a..3ea7b38a 100644 Binary files a/docs/dev/reference/plot.mmkin-3.png and b/docs/dev/reference/plot.mmkin-3.png differ diff --git a/docs/dev/reference/plot.mmkin-4.png b/docs/dev/reference/plot.mmkin-4.png index 47cd7eec..017fbd1d 100644 Binary files a/docs/dev/reference/plot.mmkin-4.png and b/docs/dev/reference/plot.mmkin-4.png differ diff --git a/docs/dev/reference/plot.mmkin-5.png b/docs/dev/reference/plot.mmkin-5.png index 44037bb4..e7463916 100644 Binary files a/docs/dev/reference/plot.mmkin-5.png and b/docs/dev/reference/plot.mmkin-5.png differ diff --git a/docs/dev/reference/plot.mmkin.html b/docs/dev/reference/plot.mmkin.html index ca1ec266..f02e2ea6 100644 --- a/docs/dev/reference/plot.mmkin.html +++ b/docs/dev/reference/plot.mmkin.html @@ -76,7 +76,7 @@ the fit of at least one model to the same dataset is shown." /> mkin - 0.9.50.3 + 0.9.50.3
diff --git a/docs/dev/reference/plot.nlme.mmkin-2.png b/docs/dev/reference/plot.nlme.mmkin-2.png index c82d0271..265fd2e0 100644 Binary files a/docs/dev/reference/plot.nlme.mmkin-2.png and b/docs/dev/reference/plot.nlme.mmkin-2.png differ diff --git a/docs/dev/reference/plot.nlme.mmkin.html b/docs/dev/reference/plot.nlme.mmkin.html index fd40b975..7e6124a1 100644 --- a/docs/dev/reference/plot.nlme.mmkin.html +++ b/docs/dev/reference/plot.nlme.mmkin.html @@ -72,7 +72,7 @@ mkin - 0.9.50.3 + 0.9.50.3 @@ -238,8 +238,7 @@ than two rows of plots are shown.

Examples

ds <- lapply(experimental_data_for_UBA_2019[6:10], function(x) subset(x$data[c("name", "time", "value")], name == "parent")) -f <- mmkin("SFO", ds, quiet = TRUE, cores = 1) -#plot(f) # too many panels for pkgdown +f <- mmkin("SFO", ds, quiet = TRUE, cores = 1)
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0195
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.011
#plot(f) # too many panels for pkgdown plot(f[, 3:4])
library(nlme) f_nlme <- nlme(f) diff --git a/docs/dev/reference/print.mkinds.html b/docs/dev/reference/print.mkinds.html index 0539c7da..a8c0d808 100644 --- a/docs/dev/reference/print.mkinds.html +++ b/docs/dev/reference/print.mkinds.html @@ -72,7 +72,7 @@ mkin - 0.9.50.3 + 0.9.50.3
diff --git a/docs/dev/reference/sigma_twocomp.html b/docs/dev/reference/sigma_twocomp.html index eac61a11..fd5c603e 100644 --- a/docs/dev/reference/sigma_twocomp.html +++ b/docs/dev/reference/sigma_twocomp.html @@ -73,7 +73,7 @@ dependence of the measured value \(y\):" /> mkin - 0.9.50.3 + 0.9.50.3 diff --git a/docs/dev/reference/summary.mkinfit.html b/docs/dev/reference/summary.mkinfit.html index 99d7d7c4..f971fdf4 100644 --- a/docs/dev/reference/summary.mkinfit.html +++ b/docs/dev/reference/summary.mkinfit.html @@ -76,7 +76,7 @@ values." /> mkin - 0.9.50.3 + 0.9.50.3 @@ -233,9 +233,9 @@ EC Document Reference Sanco/10058/2005 version 2.0, 434 pp,

Examples

summary(mkinfit(mkinmod(parent = mkinsub("SFO")), FOCUS_2006_A, quiet = TRUE))
#> 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:05 2020 -#> Date of summary: Wed May 27 06:02:05 2020 +#> R version used for fitting: 4.0.2 +#> Date of fit: Thu Oct 8 09:13:59 2020 +#> Date of summary: Thu Oct 8 09:13:59 2020 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -274,9 +274,9 @@ EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, #> #> Parameter correlation: #> parent_0 log_k_parent sigma -#> parent_0 1.000e+00 5.428e-01 1.648e-07 -#> log_k_parent 5.428e-01 1.000e+00 2.513e-07 -#> sigma 1.648e-07 2.513e-07 1.000e+00 +#> parent_0 1.000e+00 5.428e-01 1.642e-07 +#> log_k_parent 5.428e-01 1.000e+00 2.507e-07 +#> sigma 1.642e-07 2.507e-07 1.000e+00 #> #> Backtransformed parameters: #> Confidence intervals for internally transformed parameters are asymmetric. diff --git a/docs/dev/reference/transform_odeparms.html b/docs/dev/reference/transform_odeparms.html index b0994d33..58a1e9a1 100644 --- a/docs/dev/reference/transform_odeparms.html +++ b/docs/dev/reference/transform_odeparms.html @@ -226,7 +226,7 @@ This is no problem for the internal use in mkinfit< SFO_SFO <- mkinmod( parent = list(type = "SFO", to = "m1", sink = TRUE), m1 = list(type = "SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
# Fit the model to the FOCUS example dataset D using defaults -fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
fit.s <- summary(fit) +fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
fit.s <- summary(fit) # Transformed and backtransformed parameters print(fit.s$par, 3)
#> Estimate Std. Error Lower Upper #> parent_0 99.598 1.5702 96.4038 102.793 @@ -241,7 +241,7 @@ This is no problem for the internal use in mkinfit< #> sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.8549
# \dontrun{ # Compare to the version without transforming rate parameters -fit.2 <- mkinfit(SFO_SFO, FOCUS_2006_D, transform_rates = FALSE, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
#> Error in if (cost < cost.current) { assign("cost.current", cost, inherits = TRUE) if (!quiet) cat(ifelse(OLS, "Sum of squared residuals", "Negative log-likelihood"), " at call ", calls, ": ", cost.current, "\n", sep = "")}: missing value where TRUE/FALSE needed
#> Timing stopped at: 0 0.002 0.002
fit.2.s <- summary(fit.2)
#> Error in summary(fit.2): object 'fit.2' not found
print(fit.2.s$par, 3)
#> Error in print(fit.2.s$par, 3): object 'fit.2.s' not found
print(fit.2.s$bpar, 3)
#> Error in print(fit.2.s$bpar, 3): object 'fit.2.s' not found
# } +fit.2 <- mkinfit(SFO_SFO, FOCUS_2006_D, transform_rates = FALSE, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
#> Error in if (cost < cost.current) { assign("cost.current", cost, inherits = TRUE) if (!quiet) cat(ifelse(OLS, "Sum of squared residuals", "Negative log-likelihood"), " at call ", calls, ": ", signif(cost.current, 6), "\n", sep = "")}: missing value where TRUE/FALSE needed
#> Timing stopped at: 0.002 0 0.003
fit.2.s <- summary(fit.2)
#> Error in summary(fit.2): object 'fit.2' not found
print(fit.2.s$par, 3)
#> Error in print(fit.2.s$par, 3): object 'fit.2.s' not found
print(fit.2.s$bpar, 3)
#> Error in print(fit.2.s$bpar, 3): object 'fit.2.s' not found
# } initials <- fit$start$value names(initials) <- rownames(fit$start) @@ -256,7 +256,7 @@ This is no problem for the internal use in mkinfit< parent = list(type = "SFO", to = "m1", sink = TRUE), m1 = list(type = "SFO"), use_of_ff = "max")
#> Successfully compiled differential equation model from auto-generated C code.
-fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
fit.ff.s <- summary(fit.ff) +fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165
fit.ff.s <- summary(fit.ff) print(fit.ff.s$par, 3)
#> Estimate Std. Error Lower Upper #> parent_0 99.598 1.5702 96.4038 102.793 #> log_k_parent -2.316 0.0409 -2.3988 -2.233 @@ -277,7 +277,7 @@ This is no problem for the internal use in mkinfit< m1 = list(type = "SFO"), use_of_ff = "max")
#> Successfully compiled differential equation model from auto-generated C code.
-fit.ff.2 <- mkinfit(SFO_SFO.ff.2, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
fit.ff.2.s <- summary(fit.ff.2) +fit.ff.2 <- mkinfit(SFO_SFO.ff.2, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
#> Warning: Shapiro-Wilk test for standardized residuals: p = 0.0242
fit.ff.2.s <- summary(fit.ff.2) print(fit.ff.2.s$par, 3)
#> Estimate Std. Error Lower Upper #> parent_0 84.79 3.012 78.67 90.91 #> log_k_parent -2.76 0.082 -2.92 -2.59 -- cgit v1.2.1