From e05656d57668688b971c28e32b4cfd4d3eac4662 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 18 Sep 2019 13:03:50 +0200 Subject: Correct and rebuild docs - Reconcile docs and code for max_twa_parent - Correct links to docs in twa vignette - Static documentation rebuilt by pkgdown --- R/max_twa_parent.R | 30 +++-- build.log | 9 -- docs/404.html | 154 +++++++++++++++++++++++++ docs/articles/FOCUS_D.html | 31 ++--- docs/articles/FOCUS_L.html | 133 +++++++++++---------- docs/articles/index.html | 16 ++- docs/articles/mkin.html | 27 +++-- docs/articles/twa.html | 23 +++- docs/articles/web_only/FOCUS_Z.html | 39 ++++--- docs/articles/web_only/NAFTA_examples.html | 79 +++++++------ docs/articles/web_only/benchmarks.html | 75 ++++++------ docs/articles/web_only/compiled_models.html | 49 ++++---- docs/authors.html | 18 ++- docs/index.html | 19 +-- docs/news/index.html | 27 +++-- docs/pkgdown.css | 46 +++++--- docs/pkgdown.js | 14 +-- docs/pkgdown.yml | 2 +- docs/reference/AIC.mmkin.html | 37 +++--- docs/reference/CAKE_export.html | 20 +++- docs/reference/DFOP.solution.html | 18 ++- docs/reference/Extract.mmkin.html | 20 +++- docs/reference/FOCUS_2006_DFOP_ref_A_to_B.html | 22 +++- docs/reference/FOCUS_2006_FOMC_ref_A_to_F.html | 22 +++- docs/reference/FOCUS_2006_HS_ref_A_to_F.html | 22 +++- docs/reference/FOCUS_2006_SFO_ref_A_to_F.html | 22 +++- docs/reference/FOCUS_2006_datasets.html | 27 ++++- docs/reference/FOMC.solution.html | 18 ++- docs/reference/HS.solution.html | 18 ++- docs/reference/IORE.solution.html | 28 +++-- docs/reference/NAFTA_SOP_2015.html | 27 +++-- docs/reference/NAFTA_SOP_Attachment.html | 20 +++- docs/reference/SFO.solution.html | 18 ++- docs/reference/SFORB.solution.html | 18 ++- docs/reference/add_err.html | 39 ++++--- docs/reference/endpoints.html | 16 ++- docs/reference/experimental_data_for_UBA.html | 36 ++++-- docs/reference/geometric_mean.html | 18 ++- docs/reference/ilr.html | 32 +++-- docs/reference/index.html | 22 ++-- docs/reference/logLik.mkinfit.html | 32 +++-- docs/reference/logistic.solution.html | 42 ++++--- docs/reference/max_twa_parent.html | 67 +++++++++-- docs/reference/mccall81_245T.html | 36 ++++-- docs/reference/mkin_long_to_wide.html | 16 ++- docs/reference/mkin_wide_to_long.html | 18 ++- docs/reference/mkinds.html | 38 ++++-- docs/reference/mkinerrmin.html | 26 +++-- docs/reference/mkinerrplot.html | 35 ++++-- docs/reference/mkinfit.html | 106 +++++++++-------- docs/reference/mkinmod.html | 32 +++-- docs/reference/mkinparplot.html | 25 ++-- docs/reference/mkinplot.html | 18 ++- docs/reference/mkinpredict.html | 74 +++++++----- docs/reference/mkinresplot.html | 26 +++-- docs/reference/mkinsub.html | 20 +++- docs/reference/mmkin.html | 44 ++++--- docs/reference/nafta.html | 24 ++-- docs/reference/plot.mkinfit.html | 82 +++++++------ docs/reference/plot.mmkin.html | 46 +++++--- docs/reference/plot.nafta.html | 22 ++-- docs/reference/print.mkinds.html | 20 +++- docs/reference/print.mkinmod.html | 28 +++-- docs/reference/print.nafta.html | 20 +++- docs/reference/schaefer07_complex_case.html | 37 +++--- docs/reference/sigma_twocomp.html | 16 ++- docs/reference/summary.mkinfit.html | 32 +++-- docs/reference/synthetic_data_for_UBA.html | 124 +++----------------- docs/reference/test_data_from_UBA_2014.html | 32 +++-- docs/reference/transform_odeparms.html | 70 ++++++----- man/max_twa_parent.Rd | 44 ++++++- vignettes/mkin_benchmarks.rda | Bin 874 -> 877 bytes vignettes/twa.Rmd | 7 +- 73 files changed, 1657 insertions(+), 913 deletions(-) create mode 100644 docs/404.html diff --git a/R/max_twa_parent.R b/R/max_twa_parent.R index 946a9b3d..5129e369 100644 --- a/R/max_twa_parent.R +++ b/R/max_twa_parent.R @@ -1,4 +1,4 @@ -# Copyright (C) 2016,2017,2018 Johannes Ranke +# Copyright (C) 2016-2019 Johannes Ranke # Contact: jranke@uni-bremen.de # This file is part of the R package mkin @@ -37,14 +37,14 @@ max_twa_parent <- function(fit, windows) { } k <- parms.all[k_name] twafunc <- function(t) { - M0 * (1 - exp(- k * t)) / (k * t) + max_twa_sfo(M0, k, t) } } if (type == "FOMC") { alpha <- parms.all["alpha"] beta <- parms.all["beta"] twafunc <- function(t) { - M0 * (beta)/(t * (1 - alpha)) * ((t/beta + 1)^(1 - alpha) - 1) + max_twa_fomc(M0, alpha, beta, t) } } if (type == "DFOP") { @@ -52,7 +52,7 @@ max_twa_parent <- function(fit, windows) { k2 <- parms.all["k2"] g <- parms.all["g"] twafunc <- function(t) { - M0/t * ((g/k1) * (1 - exp(- k1 * t)) + ((1 - g)/k2) * (1 - exp(- k2 * t))) + max_twa_dfop(M0, k1, k2, g, t) } } if (type == "HS") { @@ -61,11 +61,8 @@ max_twa_parent <- function(fit, windows) { tb <- parms.all["tb"] twafunc <- function(t) { ifelse(t <= tb, - M0 * (1 - exp(- k1 * t)) / (k1 * t), - (M0 / t) * ( - (1/k1) * (1 - exp(- k1 * tb)) + - (exp(- k1 * tb) / k2) * (1 - exp(- k2 * (t - tb))) - ) + max_twa_sfo(M0, k1, t), + max_twa_hs(M0, k1, k2, tb, t) ) } } @@ -77,3 +74,18 @@ max_twa_parent <- function(fit, windows) { names(res) <- windows return(res) } +max_twa_sfo <- function(M0 = 1, k, t) { + M0 * (1 - exp(- k * t)) / (k * t) +} +max_twa_fomc <- function(M0 = 1, alpha, beta, t) { + M0 * (beta)/(t * (1 - alpha)) * ((t/beta + 1)^(1 - alpha) - 1) +} +max_twa_dfop <- function(M0 = 1, k1, k2, g, t) { + M0/t * ((g/k1) * (1 - exp(- k1 * t)) + ((1 - g)/k2) * (1 - exp(- k2 * t))) +} +max_twa_hs <- function(M0 = 1, k1, k2, tb, t) { + (M0 / t) * ( + (1/k1) * (1 - exp(- k1 * tb)) + + (exp(- k1 * tb) / k2) * (1 - exp(- k2 * (t - tb))) + ) +} diff --git a/build.log b/build.log index 65e585da..976d27d4 100644 --- a/build.log +++ b/build.log @@ -1,10 +1 @@ * checking for file ‘./DESCRIPTION’ ... OK -* preparing ‘mkin’: -* checking DESCRIPTION meta-information ... OK -* installing the package to build vignettes -* creating vignettes ... OK -* checking for LF line-endings in source and make files and shell scripts -* checking for empty or unneeded directories -* looking to see if a ‘data/datalist’ file should be added -* building ‘mkin_0.9.49.6.tar.gz’ - diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 00000000..bdc5053f --- /dev/null +++ b/docs/404.html @@ -0,0 +1,154 @@ + + + + + + + + +Page not found (404) • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + +Content not found. Please use links in the navbar. + +
+ +
+ + + +
+ + +
+

Site built with pkgdown 1.4.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/articles/FOCUS_D.html b/docs/articles/FOCUS_D.html index 00c3cabe..70739ae6 100644 --- a/docs/articles/FOCUS_D.html +++ b/docs/articles/FOCUS_D.html @@ -7,8 +7,9 @@ Example evaluation of FOCUS Example Dataset D • mkin - - + + + @@ -82,13 +83,14 @@ +
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ diff --git a/docs/articles/FOCUS_L.html b/docs/articles/FOCUS_L.html index 779635cd..81659030 100644 --- a/docs/articles/FOCUS_L.html +++ b/docs/articles/FOCUS_L.html @@ -7,8 +7,9 @@ Example evaluation of FOCUS Laboratory Data L1 to L3 • mkin - - + + + @@ -82,13 +83,14 @@ +
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ diff --git a/docs/articles/index.html b/docs/articles/index.html index 95828a82..cc136fdc 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -44,6 +46,7 @@ + @@ -113,6 +116,7 @@
+
@@ -139,19 +143,23 @@
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/articles/mkin.html b/docs/articles/mkin.html index 926bd907..90549b0f 100644 --- a/docs/articles/mkin.html +++ b/docs/articles/mkin.html @@ -7,8 +7,9 @@ Introduction to mkin • mkin - - + + + @@ -82,13 +83,14 @@ +
@@ -246,17 +248,20 @@
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ diff --git a/docs/articles/twa.html b/docs/articles/twa.html index 30d54f9e..b15f1522 100644 --- a/docs/articles/twa.html +++ b/docs/articles/twa.html @@ -7,8 +7,9 @@ Calculation of time weighted average concentrations with mkin • mkin - - + + + @@ -82,13 +83,14 @@ +
+ + diff --git a/docs/reference/logistic.solution.html b/docs/reference/logistic.solution.html index eb4b0de0..91fe035e 100644 --- a/docs/reference/logistic.solution.html +++ b/docs/reference/logistic.solution.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -48,6 +50,7 @@ + @@ -117,6 +120,7 @@
+
@@ -182,30 +186,30 @@

Examples

# Reproduce the plot on page 57 of FOCUS (2014) - plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.2), - from = 0, to = 100, ylim = c(0, 100), - xlab = "Time", ylab = "Residue")
plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.4), - from = 0, to = 100, add = TRUE, lty = 2, col = 2)
plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.8), - from = 0, to = 100, add = TRUE, lty = 3, col = 3)
plot(function(x) logistic.solution(x, 100, 0.08, 0.001, 0.2), - from = 0, to = 100, add = TRUE, lty = 4, col = 4)
plot(function(x) logistic.solution(x, 100, 0.08, 0.08, 0.2), - from = 0, to = 100, add = TRUE, lty = 5, col = 5)
legend("topright", inset = 0.05, - legend = paste0("k0 = ", c(0.0001, 0.0001, 0.0001, 0.001, 0.08), - ", r = ", c(0.2, 0.4, 0.8, 0.2, 0.2)), + plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.2), + from = 0, to = 100, ylim = c(0, 100), + xlab = "Time", ylab = "Residue")
plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.4), + from = 0, to = 100, add = TRUE, lty = 2, col = 2)
plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.8), + from = 0, to = 100, add = TRUE, lty = 3, col = 3)
plot(function(x) logistic.solution(x, 100, 0.08, 0.001, 0.2), + from = 0, to = 100, add = TRUE, lty = 4, col = 4)
plot(function(x) logistic.solution(x, 100, 0.08, 0.08, 0.2), + from = 0, to = 100, add = TRUE, lty = 5, col = 5)
legend("topright", inset = 0.05, + legend = paste0("k0 = ", c(0.0001, 0.0001, 0.0001, 0.001, 0.08), + ", r = ", c(0.2, 0.4, 0.8, 0.2, 0.2)), lty = 1:5, col = 1:5)
# Fit with synthetic data logistic <- mkinmod(parent = mkinsub("logistic")) - sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) - parms_logistic <- c(kmax = 0.08, k0 = 0.0001, r = 0.2) + sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) + parms_logistic <- c(kmax = 0.08, k0 = 0.0001, r = 0.2) d_logistic <- mkinpredict(logistic, - parms_logistic, c(parent = 100), + parms_logistic, c(parent = 100), sampling_times) d_2_1 <- add_err(d_logistic, sdfunc = function(x) sigma_twocomp(x, 0.5, 0.07), n = 1, reps = 2, digits = 5, LOD = 0.1, seed = 123456)[[1]] m <- mkinfit("logistic", d_2_1, quiet = TRUE) - plot_sep(m)
summary(m)$bpar
#> Estimate se_notrans t value Pr(>t) Lower + 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 @@ -236,19 +240,23 @@
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/max_twa_parent.html b/docs/reference/max_twa_parent.html index 596e51ec..d1c2a805 100644 --- a/docs/reference/max_twa_parent.html +++ b/docs/reference/max_twa_parent.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -51,6 +53,7 @@ guidance." /> + @@ -120,6 +123,7 @@ guidance." />
+
@@ -140,7 +144,11 @@ guidance.

-
max_twa_parent(fit, windows)
+
max_twa_parent(fit, windows)
+  max_twa_sfo(M0 = 1, k, t)
+  max_twa_fomc(M0 = 1, alpha, beta, t)
+  max_twa_dfop(M0 = 1, k1, k2, g, t)
+  max_twa_hs(M0 = 1, k1, k2, tb, t)

Arguments

@@ -153,11 +161,52 @@ guidance.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
windows

The width of the time windows for which the TWAs should be calculated.

M0

The initial concentration for which the maximum time weighted + average over the decline curve should be calculated. The default + is to use a value of 1, which means that a relative maximum time + weighted average factor (f_twa) is calculated.

k

The rate constant in the case of SFO kinetics.

t

The width of the time window.

alpha

Parameter of the FOMC model.

beta

Parameter of the FOMC model.

k1

The first rate constant of the DFOP or the HS kinetics.

k2

The second rate constant of the DFOP or the HS kinetics.

g

Parameter of the DFOP model.

tb

Parameter of the HS model.

Value

-

A numeric vector, named using the windows argument.

+

For max_twa_parent, a numeric vector, named using the windows argument. + For the other functions, a numeric vector of length one (also known as 'a + number').

References

@@ -170,7 +219,7 @@ guidance.

Examples

fit <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE) - max_twa_parent(fit, c(7, 21))
#> 7 21 + max_twa_parent(fit, c(7, 21))
#> 7 21 #> 34.71343 18.22124
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/mccall81_245T.html b/docs/reference/mccall81_245T.html index aa888f0f..91c55a6a 100644 --- a/docs/reference/mccall81_245T.html +++ b/docs/reference/mccall81_245T.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -49,6 +51,7 @@ + @@ -118,6 +121,7 @@ +
@@ -149,7 +153,9 @@ treatment

value

a numeric vector containing concentrations in percent of applied radioactivity

soil

a factor containing the name of the soil

- + + +

Source

@@ -158,9 +164,10 @@

Examples

-
SFO_SFO_SFO <- mkinmod(T245 = list(type = "SFO", to = "phenol"), - phenol = list(type = "SFO", to = "anisole"), - anisole = list(type = "SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
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
#> Warning: NaNs wurden erzeugt
#> Estimate se_notrans t value Pr(>t) Lower +
SFO_SFO_SFO <- mkinmod(T245 = list(type = "SFO", to = "phenol"), + 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
#> Warning: NaNs wurden erzeugt
#> Estimate se_notrans t value Pr(>t) Lower #> T245_0 1.038550e+02 2.1508110557 48.286452 3.542232e-18 99.246062215 #> k_T245_sink 1.636106e-02 NaN NaN NaN 0.012661558 #> k_T245_phenol 2.700936e-02 NaN NaN NaN 0.024487315 @@ -188,9 +195,9 @@ #> phenol 1.711229 5.68458 #> anisole 103.784092 344.76329 #>
# k_phenol_sink is really small, therefore fix it to zero - fit.2 <- mkinfit(SFO_SFO_SFO, subset(mccall81_245T, soil == "Commerce"), - 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
summary(fit.2)$bpar
#> Estimate se_notrans t value Pr(>t) Lower + fit.2 <- mkinfit(SFO_SFO_SFO, subset(mccall81_245T, soil == "Commerce"), + 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
summary(fit.2)$bpar
#> Estimate se_notrans t value Pr(>t) Lower #> T245_0 1.038550e+02 2.1623653063 48.028441 4.993105e-19 99.271025146 #> k_T245_sink 1.636106e-02 0.0019676255 8.315130 1.673674e-07 0.012679148 #> k_T245_phenol 2.700936e-02 0.0012421966 21.743224 1.314080e-13 0.024500319 @@ -215,7 +222,8 @@ #> T245 15.982025 53.09114 #> phenol 1.711229 5.68458 #> anisole 103.784092 344.76329 -#>
plot_sep(fit.2)
+#>
plot_sep(fit.2)
# } +
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/mkin_long_to_wide.html b/docs/reference/mkin_long_to_wide.html index 479bc5dd..169aefd4 100644 --- a/docs/reference/mkin_long_to_wide.html +++ b/docs/reference/mkin_long_to_wide.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -49,6 +51,7 @@ + @@ -118,6 +121,7 @@ +
@@ -202,19 +206,23 @@
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/mkin_wide_to_long.html b/docs/reference/mkin_wide_to_long.html index c95fe952..d8ae913f 100644 --- a/docs/reference/mkin_wide_to_long.html +++ b/docs/reference/mkin_wide_to_long.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -48,6 +50,7 @@ + @@ -117,6 +120,7 @@ +
@@ -156,7 +160,7 @@

Examples

-
wide <- data.frame(t = c(1,2,3), x = c(1,4,7), y = c(3,4,5)) +
wide <- data.frame(t = c(1,2,3), x = c(1,4,7), y = c(3,4,5)) mkin_wide_to_long(wide)
#> name time value #> 1 x 1 1 #> 2 x 2 4 @@ -180,19 +184,23 @@
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/mkinds.html b/docs/reference/mkinds.html index 2a34173c..e0f4fbb6 100644 --- a/docs/reference/mkinds.html +++ b/docs/reference/mkinds.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -47,6 +49,7 @@ + @@ -116,6 +119,7 @@ +
@@ -141,15 +145,23 @@

Fields

-
+ +
title

A full title for the dataset

-
sampling

times The sampling times

-
time_unit

The time unit

-
observed

Names of the observed compounds

-
unit

The unit of the observations

-
replicates

The number of replicates

-
data

A dataframe with at least the columns name, time and value + +

sampling

times The sampling times

+ +
time_unit

The time unit

+ +
observed

Names of the observed compounds

+ +
unit

The unit of the observations

+ +
replicates

The number of replicates

+ +
data

A dataframe with at least the columns name, time and value in order to be compatible with mkinfit

+
@@ -170,19 +182,23 @@ in order to be compatible with mkinfit

+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/mkinerrmin.html b/docs/reference/mkinerrmin.html index 359ce5f5..941e30f5 100644 --- a/docs/reference/mkinerrmin.html +++ b/docs/reference/mkinerrmin.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -48,6 +50,7 @@ chi-squared test as defined in the FOCUS kinetics report from 2006." /> + @@ -117,6 +120,7 @@ chi-squared test as defined in the FOCUS kinetics report from 2006." /> +
@@ -179,14 +183,16 @@ chi-squared test as defined in the FOCUS kinetics report from 2006.

SFO_SFO = mkinmod(parent = mkinsub("SFO", to = "m1"), m1 = mkinsub("SFO"), use_of_ff = "max")
#> Successfully compiled differential equation model from auto-generated C code.
-fit_FOCUS_D = mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
round(mkinerrmin(fit_FOCUS_D), 4)
#> err.min n.optim df +fit_FOCUS_D = mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
round(mkinerrmin(fit_FOCUS_D), 4)
#> err.min n.optim df #> All data 0.0640 4 15 #> parent 0.0646 2 7 -#> m1 0.0469 2 8
fit_FOCUS_E = mkinfit(SFO_SFO, FOCUS_2006_E, quiet = TRUE) - round(mkinerrmin(fit_FOCUS_E), 4)
#> err.min n.optim df +#> m1 0.0469 2 8
# \dontrun{ + fit_FOCUS_E = mkinfit(SFO_SFO, FOCUS_2006_E, quiet = TRUE) + round(mkinerrmin(fit_FOCUS_E), 4)
#> err.min n.optim df #> All data 0.1544 4 13 #> parent 0.1659 2 7 -#> m1 0.1095 2 6
+#> m1 0.1095 2 6
# } +
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/mkinerrplot.html b/docs/reference/mkinerrplot.html index 80f0abf5..be2f7614 100644 --- a/docs/reference/mkinerrplot.html +++ b/docs/reference/mkinerrplot.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -52,6 +54,7 @@ + @@ -121,6 +124,7 @@ +
@@ -143,11 +147,12 @@
mkinerrplot(object,
-    obs_vars = names(object$mkinmod$map),
-    xlim = c(0, 1.1 * max(object$data$predicted)),
+    obs_vars = names(object$mkinmod$map),
+    xlim = c(0, 1.1 * max(object$data$predicted)),
     xlab = "Predicted", ylab = "Squared residual",
     maxy = "auto", legend= TRUE, lpos = "topright",
     col_obs = "auto", pch_obs = "auto",
+    frame = TRUE,
     ...)

Arguments

@@ -186,7 +191,7 @@ lpos

Where should the legend be placed? Default is "topright". Will be passed on to - legend.

+ legend.

col_obs @@ -197,8 +202,12 @@

Symbols to be used for the observed variables.

- … -

further arguments passed to plot.

+ frame +

Should a frame be drawn around the plots?

+ + + ... +

further arguments passed to plot.

@@ -213,7 +222,9 @@

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, error_model = "tc", quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
mkinerrplot(fit)
+
# \dontrun{ +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, error_model = "tc", quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
mkinerrplot(fit)
# } +
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/mkinfit.html b/docs/reference/mkinfit.html index 2ba4cc0c..b620f364 100644 --- a/docs/reference/mkinfit.html +++ b/docs/reference/mkinfit.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -55,6 +57,7 @@ Per default, parameters in the kinetic models are internally transformed in + @@ -124,6 +127,7 @@ Per default, parameters in the kinetic models are internally transformed in +
@@ -137,7 +141,7 @@ Per default, parameters in the kinetic models are internally transformed in

This function maximises the likelihood of the observed data using - the Port algorithm nlminb, and the specified initial or fixed + the Port algorithm nlminb, and the specified initial or fixed parameters and starting values. In each step of the optimsation, the kinetic model is solved using the function mkinpredict. The parameters of the selected error model are fitted simultaneously with the degradation @@ -152,18 +156,18 @@ Per default, parameters in the kinetic models are internally transformed in parms.ini = "auto", state.ini = "auto", err.ini = "auto", - fixed_parms = NULL, fixed_initials = names(mkinmod$diffs)[-1], + fixed_parms = NULL, fixed_initials = names(mkinmod$diffs)[-1], from_max_mean = FALSE, - solution_type = c("auto", "analytical", "eigen", "deSolve"), + solution_type = c("auto", "analytical", "eigen", "deSolve"), method.ode = "lsoda", use_compiled = "auto", - control = list(eval.max = 300, iter.max = 200), + control = list(eval.max = 300, iter.max = 200), transform_rates = TRUE, transform_fractions = TRUE, quiet = FALSE, atol = 1e-8, rtol = 1e-10, n.outtimes = 100, - error_model = c("const", "obs", "tc"), - error_model_algorithm = c("d_3", "direct", "twostep", "threestep", "fourstep", "IRLS", + error_model = c("const", "obs", "tc"), + error_model_algorithm = c("d_3", "direct", "twostep", "threestep", "fourstep", "IRLS", "OLS"), reweight.tol = 1e-8, reweight.max.iter = 10, trace_parms = FALSE, ...) @@ -267,7 +271,7 @@ Per default, parameters in the kinetic models are internally transformed in control -

A list of control arguments passed to nlminb.

+

A list of control arguments passed to nlminb.

transform_rates @@ -368,7 +372,7 @@ Per default, parameters in the kinetic models are internally transformed in

Should a trace of the parameter values be listed?

- … + ...

Further arguments that will be passed on to deSolve.

@@ -381,7 +385,7 @@ Per default, parameters in the kinetic models are internally transformed in

See also

Plotting methods plot.mkinfit and mkinparplot.

-

Comparisons of models fitted to the same data can be made using AIC +

Comparisons of models fitted to the same data can be made using AIC by virtue of the method logLik.mkinfit.

Fitting of several models to several datasets in a single call to mmkin.

@@ -402,17 +406,17 @@ Per default, parameters in the kinetic models are internally transformed in

Examples

# Use shorthand notation for parent only degradation fit <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE) -summary(fit)
#> mkin version used for fitting: 0.9.49.6 -#> R version used for fitting: 3.6.0 -#> Date of fit: Tue Jul 9 08:58:09 2019 -#> Date of summary: Tue Jul 9 08:58:09 2019 +summary(fit)
#> mkin version used for fitting: 0.9.49.6 +#> R version used for fitting: 3.6.1 +#> Date of fit: Wed Sep 18 12:55:32 2019 +#> Date of summary: Wed Sep 18 12:55:32 2019 #> #> 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.475 s +#> Fitted using 222 model solutions performed in 0.459 s #> #> Error model: Constant variance #> @@ -484,9 +488,9 @@ Per default, parameters in the kinetic models are internally transformed in 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, +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 verstrichen -#> 1.581 0.000 1.582
coef(fit)
#> NULL
#> $ff +#> 1.480 0.000 1.482
coef(fit)
#> NULL
#> $ff #> parent_sink parent_m1 m1_sink #> 0.485524 0.514476 1.000000 #> @@ -497,8 +501,9 @@ Per default, parameters in the kinetic models are internally transformed in #> DT50 DT90 #> parent 7.022929 23.32967 #> m1 131.760712 437.69961 -#>
# deSolve is slower when no C compiler (gcc) was available during model generation -print(system.time(fit.deSolve <- mkinfit(SFO_SFO, FOCUS_2006_D, +#>
# \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: 18915.53 #> Sum of squared residuals at call 2: 18915.53 #> Sum of squared residuals at call 6: 11424.02 @@ -558,7 +563,7 @@ Per default, parameters in the kinetic models are internally transformed in #> Sum of squared residuals at call 126: 371.2134 #> Sum of squared residuals at call 135: 371.2134 #> Negative log-likelihood at call 145: 97.22429
#> Optimisation successfully terminated.
#> User System verstrichen -#> 1.109 0.000 1.109
coef(fit.deSolve)
#> NULL
endpoints(fit.deSolve)
#> $ff +#> 1.045 0.000 1.046
coef(fit.deSolve)
#> NULL
endpoints(fit.deSolve)
#> $ff #> parent_sink parent_m1 m1_sink #> 0.485524 0.514476 1.000000 #> @@ -569,9 +574,11 @@ Per default, parameters in the kinetic models are internally transformed in #> DT50 DT90 #> parent 7.022929 23.32967 #> m1 131.760712 437.69961 -#>
-# Use stepwise fitting, using optimised parameters from parent only fit, FOMC -
FOMC_SFO <- mkinmod( +#>
# } + +# Use stepwise fitting, using optimised parameters from parent only fit, FOMC +# \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 @@ -580,18 +587,20 @@ Per default, parameters in the kinetic models are internally transformed in 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 + 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
-
# Weighted fits, including IRLS +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
# } + +# \dontrun{ +# Weighted fits, including IRLS 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.49.6 -#> R version used for fitting: 3.6.0 -#> Date of fit: Tue Jul 9 08:58:26 2019 -#> Date of summary: Tue Jul 9 08:58:26 2019 + 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.49.6 +#> R version used for fitting: 3.6.1 +#> Date of fit: Wed Sep 18 12:55:47 2019 +#> Date of summary: Wed Sep 18 12:55:47 2019 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -599,7 +608,7 @@ Per default, parameters in the kinetic models are internally transformed in #> #> Model predictions using solution type deSolve #> -#> Fitted using 421 model solutions performed in 1.136 s +#> Fitted using 421 model solutions performed in 1.077 s #> #> Error model: Constant variance #> @@ -707,10 +716,10 @@ Per default, parameters in the kinetic models are internally transformed in #> 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.49.6 -#> R version used for fitting: 3.6.0 -#> Date of fit: Tue Jul 9 08:58:29 2019 -#> Date of summary: Tue Jul 9 08:58:29 2019 +#> 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.49.6 +#> R version used for fitting: 3.6.1 +#> Date of fit: Wed Sep 18 12:55:50 2019 +#> Date of summary: Wed Sep 18 12:55:50 2019 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -718,7 +727,7 @@ Per default, parameters in the kinetic models are internally transformed in #> #> Model predictions using solution type deSolve #> -#> Fitted using 979 model solutions performed in 2.836 s +#> Fitted using 979 model solutions performed in 2.624 s #> #> Error model: Variance unique to each observed variable #> @@ -839,10 +848,10 @@ Per default, parameters in the kinetic models are internally transformed in #> 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.49.6 -#> R version used for fitting: 3.6.0 -#> Date of fit: Tue Jul 9 08:58:39 2019 -#> Date of summary: Tue Jul 9 08:58:39 2019 +#> 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.49.6 +#> R version used for fitting: 3.6.1 +#> Date of fit: Wed Sep 18 12:55:59 2019 +#> Date of summary: Wed Sep 18 12:55:59 2019 #> #> Equations: #> d_parent/dt = - k_parent * parent @@ -850,7 +859,7 @@ Per default, parameters in the kinetic models are internally transformed in #> #> Model predictions using solution type deSolve #> -#> Fitted using 2289 model solutions performed in 9.908 s +#> Fitted using 2289 model solutions performed in 9.376 s #> #> Error model: Two-component variance function #> @@ -964,7 +973,8 @@ Per default, parameters in the kinetic models are internally transformed in #> 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
+#> 120 m1 33.31 29.04130 4.268696
# } +
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/mkinmod.html b/docs/reference/mkinmod.html index 16f80fe0..81fed454 100644 --- a/docs/reference/mkinmod.html +++ b/docs/reference/mkinmod.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -52,6 +54,7 @@ For the definition of model types and their parameters, the equations given + @@ -121,6 +124,7 @@ For the definition of model types and their parameters, the equations given +
@@ -220,21 +224,22 @@ For the definition of model types and their parameters, the equations given

Examples

# Specify the SFO model (this is not needed any more, as we can now mkinfit("SFO", ...) -SFO <- mkinmod(parent = list(type = "SFO")) +SFO <- mkinmod(parent = list(type = "SFO")) # One parent compound, one metabolite, both single first order SFO_SFO <- mkinmod( parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
-
# The above model used to be specified like this, before the advent of mkinsub() +# \dontrun{ +# The above model used to be specified like this, before the advent of mkinsub() SFO_SFO <- mkinmod( - parent = list(type = "SFO", to = "m1"), - m1 = list(type = "SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
+ parent = list(type = "SFO", to = "m1"), + m1 = list(type = "SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
# Show details of creating the C function SFO_SFO <- mkinmod( parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"), verbose = TRUE)
#> Compilation argument: -#> /usr/lib/R/bin/R CMD SHLIB file37c428e02a2c.c 2> file37c428e02a2c.c.err.txt +#> /usr/lib/R/bin/R CMD SHLIB file419a1fa6c394.c 2> file419a1fa6c394.c.err.txt #> Program source: #> 1: #include <R.h> #> 2: @@ -257,14 +262,15 @@ For the definition of model types and their parameters, the equations given #> 19: }
#> Successfully compiled differential equation model from auto-generated C code.
# If we have several parallel metabolites # (compare tests/testthat/test_synthetic_data_for_UBA_2014.R) -m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")), +m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")), M1 = mkinsub("SFO"), M2 = mkinsub("SFO"), use_of_ff = "max", quiet = TRUE) fit_DFOP_par_c <- mkinfit(m_synth_DFOP_par, synthetic_data_for_UBA_2014[[12]]$data, - quiet = TRUE)
+ quiet = TRUE) +# }
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/mkinparplot.html b/docs/reference/mkinparplot.html index 05a597a1..79a4cc2b 100644 --- a/docs/reference/mkinparplot.html +++ b/docs/reference/mkinparplot.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -48,6 +50,7 @@ + @@ -117,6 +120,7 @@ +
@@ -151,10 +155,11 @@

Examples

-
model <- mkinmod( - T245 = mkinsub("SFO", to = c("phenol"), sink = FALSE), - phenol = mkinsub("SFO", to = c("anisole")), - anisole = mkinsub("SFO"), use_of_ff = "max")
#> Successfully compiled differential equation model from auto-generated C code.
fit <- mkinfit(model, subset(mccall81_245T, soil == "Commerce"), quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
mkinparplot(fit)
+
# \dontrun{ +model <- mkinmod( + T245 = mkinsub("SFO", to = c("phenol"), sink = FALSE), + phenol = mkinsub("SFO", to = c("anisole")), + anisole = mkinsub("SFO"), use_of_ff = "max")
#> Successfully compiled differential equation model from auto-generated C code.
fit <- mkinfit(model, subset(mccall81_245T, soil == "Commerce"), quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
mkinparplot(fit)
# }
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/mkinplot.html b/docs/reference/mkinplot.html index f32e0758..33d69b6d 100644 --- a/docs/reference/mkinplot.html +++ b/docs/reference/mkinplot.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -47,6 +49,7 @@ + @@ -116,6 +119,7 @@ +
@@ -142,7 +146,7 @@

an object of class mkinfit.

- … + ...

further arguments passed to plot.mkinfit.

@@ -166,19 +170,23 @@
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/mkinpredict.html b/docs/reference/mkinpredict.html index fc3e8512..d162135a 100644 --- a/docs/reference/mkinpredict.html +++ b/docs/reference/mkinpredict.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -49,6 +51,7 @@ + @@ -118,6 +121,7 @@ +
@@ -136,7 +140,7 @@
-
mkinpredict(x, odeparms, odeini, outtimes = seq(0, 120, by = 0.1),
+    
mkinpredict(x, odeparms, odeini, outtimes = seq(0, 120, by = 0.1),
     solution_type = "deSolve", use_compiled = "auto", method.ode = "lsoda",
     atol = 1e-08, rtol = 1e-10, map_output = TRUE, ...)
@@ -200,7 +204,7 @@ variables (default) or for all state variables (if set to FALSE).

- … + ...

Further arguments passed to the ode solver in case such a solver is used.

@@ -213,7 +217,7 @@

Examples

SFO <- mkinmod(degradinol = mkinsub("SFO")) # Compare solution types - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, solution_type = "analytical")
#> time degradinol #> 1 0 100.0000000 #> 2 1 74.0818221 @@ -235,7 +239,7 @@ #> 18 17 0.6096747 #> 19 18 0.4516581 #> 20 19 0.3345965 -#> 21 20 0.2478752
mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, +#> 21 20 0.2478752
mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, solution_type = "deSolve")
#> time degradinol #> 1 0 100.0000000 #> 2 1 74.0818221 @@ -257,7 +261,7 @@ #> 18 17 0.6096747 #> 19 18 0.4516581 #> 20 19 0.3345965 -#> 21 20 0.2478752
mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, +#> 21 20 0.2478752
mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, solution_type = "deSolve", use_compiled = FALSE)
#> time degradinol #> 1 0 100.0000000 #> 2 1 74.0818221 @@ -279,7 +283,7 @@ #> 18 17 0.6096747 #> 19 18 0.4516581 #> 20 19 0.3345965 -#> 21 20 0.2478752
mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, +#> 21 20 0.2478752
mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, solution_type = "eigen")
#> time degradinol #> 1 0 100.0000000 #> 2 1 74.0818221 @@ -304,42 +308,43 @@ #> 21 20 0.2478752
# Compare integration methods to analytical solution - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, + mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, solution_type = "analytical")[21,]
#> time degradinol -#> 21 20 0.2478752
mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, +#> 21 20 0.2478752
mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, method = "lsoda")[21,]
#> time degradinol -#> 21 20 0.2478752
mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, +#> 21 20 0.2478752
mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, method = "ode45")[21,]
#> time degradinol -#> 21 20 0.2478752
mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, +#> 21 20 0.2478752
mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), 0:20, method = "rk4")[21,]
#> time degradinol #> 21 20 0.2480043
# rk4 is not as precise here # The number of output times used to make a lot of difference until the # default for atol was adjusted - mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), - seq(0, 20, by = 0.1))[201,]
#> time degradinol -#> 201 20 0.2478752
mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), - seq(0, 20, by = 0.01))[2001,]
#> time degradinol + mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), + seq(0, 20, by = 0.1))[201,]
#> time degradinol +#> 201 20 0.2478752
mkinpredict(SFO, c(k_degradinol_sink = 0.3), c(degradinol = 100), + seq(0, 20, by = 0.01))[2001,]
#> time degradinol #> 2001 20 0.2478752
# Check compiled model versions - they are faster than the eigenvalue based solutions! - SFO_SFO = mkinmod(parent = list(type = "SFO", to = "m1"), - m1 = list(type = "SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
system.time( - print(mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), - c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), + SFO_SFO = mkinmod(parent = list(type = "SFO", to = "m1"), + m1 = list(type = "SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
system.time( + print(mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), + c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), solution_type = "eigen")[201,]))
#> time parent m1 #> 201 20 4.978707 27.46227
#> User System verstrichen -#> 0.003 0.000 0.003
system.time( - print(mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), - c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), +#> 0.004 0.000 0.003
system.time( + print(mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), + c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), solution_type = "deSolve")[201,]))
#> time parent m1 #> 201 20 4.978707 27.46227
#> User System verstrichen -#> 0.001 0.000 0.002
system.time( - print(mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), - c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), +#> 0.002 0.000 0.001
system.time( + print(mkinpredict(SFO_SFO, c(k_parent_m1 = 0.05, k_parent_sink = 0.1, k_m1_sink = 0.01), + c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), solution_type = "deSolve", use_compiled = FALSE)[201,]))
#> time parent m1 #> 201 20 4.978707 27.46227
#> User System verstrichen -#> 0.022 0.000 0.021
-
# Predict from a fitted model +#> 0.021 0.000 0.021
+ # \dontrun{ + # Predict from a fitted model f <- mkinfit(SFO_SFO, FOCUS_2006_C)
#> Ordinary least squares optimisation
#> Sum of squared residuals at call 1: 552.5739 #> Sum of squared residuals at call 3: 552.5739 #> Sum of squared residuals at call 4: 552.5739 @@ -368,13 +373,14 @@ #> Sum of squared residuals at call 59: 196.5334 #> Sum of squared residuals at call 65: 196.5334 #> Sum of squared residuals at call 73: 196.5334 -#> Negative log-likelihood at call 75: 26.64668
#> Optimisation successfully terminated.
head(mkinpredict(f))
#> time parent m1 +#> Negative log-likelihood at call 75: 26.64668
#> Optimisation successfully terminated.
head(mkinpredict(f))
#> time parent m1 #> 1 0.0 82.49216 0.000000 #> 2 0.1 80.00563 1.179955 #> 3 0.2 77.59404 2.312580 #> 4 0.3 75.25515 3.399419 #> 5 0.4 72.98675 4.441969 -#> 6 0.5 70.78673 5.441679
+#> 6 0.5 70.78673 5.441679
# } +
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/mkinresplot.html b/docs/reference/mkinresplot.html index 1c485c93..d841909f 100644 --- a/docs/reference/mkinresplot.html +++ b/docs/reference/mkinresplot.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -50,6 +52,7 @@ + @@ -119,6 +122,7 @@ +
@@ -139,8 +143,8 @@
mkinresplot(object,
-    obs_vars = names(object$mkinmod$map),
-    xlim = c(0, 1.1 * max(object$data$time)),
+    obs_vars = names(object$mkinmod$map),
+    xlim = c(0, 1.1 * max(object$data$time)),
     xlab = "Time", ylab = "Residual",
     maxabs = "auto", legend = TRUE, lpos = "topright", ...)
@@ -180,11 +184,11 @@ lpos

Where should the legend be placed? Default is "topright". Will be passed on to - legend.

+ legend.

- … -

further arguments passed to plot.

+ ... +

further arguments passed to plot.

@@ -218,19 +222,23 @@ +
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/mkinsub.html b/docs/reference/mkinsub.html index e3035247..1523138c 100644 --- a/docs/reference/mkinsub.html +++ b/docs/reference/mkinsub.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -48,6 +50,7 @@ + @@ -117,6 +120,7 @@ +
@@ -171,8 +175,8 @@

Examples

# One parent compound, one metabolite, both single first order. SFO_SFO <- mkinmod( - parent = list(type = "SFO", to = "m1"), - m1 = list(type = "SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
+ parent = list(type = "SFO", to = "m1"), + m1 = list(type = "SFO"))
#> Successfully compiled differential equation model from auto-generated C code.
# The same model using mkinsub SFO_SFO.2 <- mkinmod( parent = mkinsub("SFO", "m1"), @@ -197,19 +201,23 @@
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/mmkin.html b/docs/reference/mmkin.html index 49860cbe..9bb7926b 100644 --- a/docs/reference/mmkin.html +++ b/docs/reference/mmkin.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -48,6 +50,7 @@ + @@ -117,6 +120,7 @@ +
@@ -135,7 +139,7 @@
mmkin(models, datasets,
-      cores = round(detectCores()/2), cluster = NULL, ...)
+ cores = round(detectCores()/2), cluster = NULL, ...)

Arguments

@@ -164,7 +168,7 @@ execution.

- +
...

Further arguments that will be passed to mkinfit.

@@ -180,22 +184,23 @@

Examples

-
m_synth_SFO_lin <- mkinmod(parent = mkinsub("SFO", "M1"), +
# \dontrun{ +m_synth_SFO_lin <- mkinmod(parent = mkinsub("SFO", "M1"), M1 = mkinsub("SFO", "M2"), M2 = mkinsub("SFO"), use_of_ff = "max")
#> Successfully compiled differential equation model from auto-generated C code.
m_synth_FOMC_lin <- mkinmod(parent = mkinsub("FOMC", "M1"), M1 = mkinsub("SFO", "M2"), M2 = mkinsub("SFO"), use_of_ff = "max")
#> Successfully compiled differential equation model from auto-generated C code.
-models <- list(SFO_lin = m_synth_SFO_lin, FOMC_lin = m_synth_FOMC_lin) -datasets <- lapply(synthetic_data_for_UBA_2014[1:3], function(x) x$data) -names(datasets) <- paste("Dataset", 1:3) +models <- list(SFO_lin = m_synth_SFO_lin, FOMC_lin = m_synth_FOMC_lin) +datasets <- lapply(synthetic_data_for_UBA_2014[1:3], function(x) x$data) +names(datasets) <- paste("Dataset", 1:3) -time_default <- system.time(fits.0 <- mmkin(models, datasets, quiet = TRUE)) -time_1 <- system.time(fits.4 <- mmkin(models, datasets, cores = 1, quiet = TRUE)) +time_default <- system.time(fits.0 <- mmkin(models, datasets, quiet = TRUE)) +time_1 <- system.time(fits.4 <- mmkin(models, datasets, cores = 1, quiet = TRUE)) time_default
#> User System verstrichen -#> 0.045 0.038 5.672
time_1
#> User System verstrichen -#> 20.914 0.000 20.928
+#> 0.012 0.024 5.064
time_1
#> User System verstrichen +#> 19.094 0.000 19.104
endpoints(fits.0[["SFO_lin", 2]])
#> $ff #> parent_M1 parent_sink M1_M2 M1_sink #> 0.7340481 0.2659519 0.7505684 0.2494316 @@ -210,12 +215,13 @@ #> M2 33.7200958 112.015734 #>
# 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 +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 # by plot.mkinfit and can be plotted using plot_sep -plot(fits.0[[1, 1]], sep_obs = TRUE, show_residuals = TRUE, show_errmin = TRUE)
plot_sep(fits.0[[1, 1]]) +plot(fits.0[[1, 1]], sep_obs = TRUE, show_residuals = TRUE, show_errmin = TRUE)
plot_sep(fits.0[[1, 1]]) # Plotting with mmkin (single brackets, extracting an mmkin object) does not # allow to plot the observed variables separately -plot(fits.0[1, 1])
+plot(fits.0[1, 1])
# } +
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/nafta.html b/docs/reference/nafta.html index 1153f553..c5ea9a9a 100644 --- a/docs/reference/nafta.html +++ b/docs/reference/nafta.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -49,6 +51,7 @@ + @@ -118,6 +121,7 @@ +
@@ -136,7 +140,7 @@
-
nafta(ds, title = NA, quiet = FALSE, …)
+
nafta(ds, title = NA, quiet = FALSE, ...)

Arguments

@@ -157,7 +161,7 @@ - +

Should the evaluation text be shown?

...

Further arguments passed to mmkin.

@@ -182,7 +186,7 @@

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)
#> 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 #> @@ -219,7 +223,7 @@ #> DFOP 429 2380 841 #> #> Representative half-life: -#> [1] 841.41
plot(nafta_evaluation)
+#> [1] 841.41
plot(nafta_evaluation)
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/plot.mkinfit.html b/docs/reference/plot.mkinfit.html index 7c6f2aac..795262f8 100644 --- a/docs/reference/plot.mkinfit.html +++ b/docs/reference/plot.mkinfit.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -52,6 +54,7 @@ If the current plot device is a tikz device, + @@ -121,6 +124,7 @@ If the current plot device is a tikz device, +
@@ -136,28 +140,28 @@ If the current plot device is a tikz device,

Solves the differential equations with the optimised and fixed parameters from a previous successful call to mkinfit and plots the observed data together with the solution of the fitted model.

-

If the current plot device is a tikz device, +

If the current plot device is a tikz device, then latex is being used for the formatting of the chi2 error level, if show_errmin = TRUE.

-
# S3 method for mkinfit
-plot(x, fit = x,
-  obs_vars = names(fit$mkinmod$map),
-  xlab = "Time", ylab = "Observed",
-  xlim = range(fit$data$time),
-  ylim = "default",
-  col_obs = 1:length(obs_vars), pch_obs = col_obs,
-  lty_obs = rep(1, length(obs_vars)),
-  add = FALSE, legend = !add,
-  show_residuals = FALSE,
-  show_errplot = FALSE,
-  maxabs = "auto",
-  sep_obs = FALSE, rel.height.middle = 0.9,
-  lpos = "topright", inset = c(0.05, 0.05),
-  show_errmin = FALSE, errmin_digits = 3, …)
-plot_sep(fit, sep_obs = TRUE,  show_residuals = TRUE, show_errmin = TRUE, …)
+
# S3 method for mkinfit
+plot(x, fit = x,
+  obs_vars = names(fit$mkinmod$map),
+  xlab = "Time", ylab = "Observed",
+  xlim = range(fit$data$time),
+  ylim = "default",
+  col_obs = 1:length(obs_vars), pch_obs = col_obs,
+  lty_obs = rep(1, length(obs_vars)),
+  add = FALSE, legend = !add,
+  show_residuals = FALSE,
+  show_errplot = FALSE,
+  maxabs = "auto",
+  sep_obs = FALSE, rel.height.middle = 0.9,
+  lpos = "topright", inset = c(0.05, 0.05),
+  show_errmin = FALSE, errmin_digits = 3, frame = TRUE, ...)
+plot_sep(fit, sep_obs = TRUE,  show_residuals = TRUE, show_errmin = TRUE, ...)

Arguments

@@ -242,12 +246,12 @@ plot_sep(fit, sep_obs = TRUE, show_residuals = TRUE, show_errmin = TRUE, … - - + @@ -258,8 +262,12 @@ plot_sep(fit, sep_obs = TRUE, show_residuals = TRUE, show_errmin = TRUE, … - - + + + + + +
lpos

Position(s) of the legend(s). Passed to legend as the first argument. +

Position(s) of the legend(s). Passed to legend as the first argument. If not length one, this should be of the same length as the obs_var argument.

inset

Passed to legend if applicable.

Passed to legend if applicable.

show_errmin

The number of significant digits for rounding the FOCUS chi2 error percentage.

Further arguments passed to plot.

frame

Should a frame be drawn around the plots?

...

Further arguments passed to plot.

@@ -269,21 +277,23 @@ plot_sep(fit, sep_obs = TRUE, show_residuals = TRUE, show_errmin = TRUE, …

Examples

-
# One parent compound, one metabolite, both single first order, path from -# parent to sink included -
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, error_model = "tc")
#> Warning: Observations with value of zero were removed from the data
plot(fit)
plot(fit, show_residuals = TRUE)
plot(fit, show_errplot = TRUE)
+
# One parent compound, one metabolite, both single first order, path from +# 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, error_model = "tc")
#> Warning: Observations with value of zero were removed from the data
plot(fit)
plot(fit, show_residuals = TRUE)
plot(fit, show_errplot = TRUE)
# Show the observed variables separately -plot(fit, sep_obs = TRUE, lpos = c("topright", "bottomright"))
+plot(fit, sep_obs = TRUE, lpos = c("topright", "bottomright"))
# Show the observed variables separately, with residuals -plot(fit, sep_obs = TRUE, show_residuals = TRUE, lpos = c("topright", "bottomright"), +plot(fit, sep_obs = TRUE, show_residuals = TRUE, lpos = c("topright", "bottomright"), show_errmin = TRUE)
# The same can be obtained with less typing, using the convenience function plot_sep -plot_sep(fit, lpos = c("topright", "bottomright")) +plot_sep(fit, lpos = c("topright", "bottomright")) # Show the observed variables separately, with the error model -plot(fit, sep_obs = TRUE, show_errplot = TRUE, lpos = c("topright", "bottomright"), - show_errmin = TRUE)
+plot(fit, sep_obs = TRUE, show_errplot = TRUE, lpos = c("topright", "bottomright"), + show_errmin = TRUE)
# } +
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/plot.mmkin.html b/docs/reference/plot.mmkin.html index ef734bc8..9a11108f 100644 --- a/docs/reference/plot.mmkin.html +++ b/docs/reference/plot.mmkin.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -51,6 +53,7 @@ If the current plot device is a tikz device, + @@ -120,6 +123,7 @@ If the current plot device is a tikz device, +
@@ -135,15 +139,15 @@ If the current plot device is a tikz device,

When x is a row selected from an mmkin object ([.mmkin), the same model fitted for at least one dataset is shown. When it is a column, the fit of at least one model to the same dataset is shown.

-

If the current plot device is a tikz device, +

If the current plot device is a tikz device, then latex is being used for the formatting of the chi2 error level.

# S3 method for mmkin
-plot(x, main = "auto", legends = 1,
-  resplot = c("time", "errmod"), errmin_var = "All data", errmin_digits = 3,
-  cex = 0.7, rel.height.middle = 0.9, ...)
+plot(x, main = "auto", legends = 1, + resplot = c("time", "errmod"), show_errmin = TRUE, errmin_var = "All data", + errmin_digits = 3, cex = 0.7, rel.height.middle = 0.9, ...)

Arguments

@@ -166,6 +170,10 @@ If the current plot device is a tikz device, or as squared residuals against predicted values, with the error model, using mkinerrplot.

+ + + + @@ -176,14 +184,14 @@ If the current plot device is a tikz device, - + - +
show_errmin

Should the chi2 error level be shown on top of the plots to the left?

errmin_var

The variable for which the FOCUS chi2 error value should be shown.

cex

Passed to the plot functions and mtext.

Passed to the plot functions and mtext.

rel.height.middle

The relative height of the middle plot, if more than two rows of plots are shown.

...

Further arguments passed to plot.mkinfit and mkinresplot.

@@ -194,17 +202,19 @@ If the current plot device is a tikz device,

Examples

-
# Only use one core not to offend CRAN checks - fits <- mmkin(c("FOMC", "HS"), - list("FOCUS B" = FOCUS_2006_B, "FOCUS C" = FOCUS_2006_C), # named list for titles +
# \dontrun{ + # Only use one core not to offend CRAN checks + fits <- mmkin(c("FOMC", "HS"), + list("FOCUS B" = FOCUS_2006_B, "FOCUS C" = FOCUS_2006_C), # named list for titles cores = 1, quiet = TRUE, error_model = "tc")
#> Warning: Optimisation did not converge: -#> iteration limit reached without convergence (10)
plot(fits[, "FOCUS C"])
plot(fits["FOMC", ])
+#> iteration limit reached without convergence (10)
plot(fits[, "FOCUS C"])
plot(fits["FOMC", ])
# We can also plot a single fit, if we like the way plot.mmkin works, but then the plot # height should be smaller than the plot width (this is not possible for the html pages # generated by pkgdown, as far as I know). - plot(fits["FOMC", "FOCUS C"]) # same as plot(fits[1, 2])
+ plot(fits["FOMC", "FOCUS C"]) # same as plot(fits[1, 2])
# Show the error models - plot(fits["FOMC", ], resplot = "errmod")
+ plot(fits["FOMC", ], resplot = "errmod")
# } +
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/plot.nafta.html b/docs/reference/plot.nafta.html index 55fea47c..c5eed391 100644 --- a/docs/reference/plot.nafta.html +++ b/docs/reference/plot.nafta.html @@ -18,13 +18,15 @@ - + + - - + + + @@ -51,6 +53,7 @@ + @@ -120,6 +123,7 @@ +
@@ -138,8 +142,8 @@
-
# S3 method for nafta
-plot(x, legend = FALSE, main = "auto", …)
+
# S3 method for nafta
+plot(x, legend = FALSE, main = "auto", ...)

Arguments

@@ -157,7 +161,7 @@ plot(x, legend = FALSE, main = "auto", …) - +

Possibility to override the main title of the plot.

...

Further arguments passed to plot.mmkin.

@@ -181,19 +185,23 @@ plot(x, legend = FALSE, main = "auto", …) +
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/print.mkinds.html b/docs/reference/print.mkinds.html index 5eb42e68..810123b8 100644 --- a/docs/reference/print.mkinds.html +++ b/docs/reference/print.mkinds.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -47,6 +49,7 @@ + @@ -116,6 +119,7 @@ +
@@ -133,7 +137,7 @@
# S3 method for mkinds
-print(x, ...)
+print(x, ...)

Arguments

@@ -143,7 +147,7 @@ - +

An mkinds object.

...

Not used.

@@ -159,19 +163,23 @@ +
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/print.mkinmod.html b/docs/reference/print.mkinmod.html index 96279b89..5a8feab8 100644 --- a/docs/reference/print.mkinmod.html +++ b/docs/reference/print.mkinmod.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -47,6 +49,7 @@ + @@ -116,6 +119,7 @@ +
@@ -133,7 +137,7 @@
# S3 method for mkinmod
-print(x, ...)
+print(x, ...)

Arguments

@@ -143,17 +147,17 @@ - +

An mkinmod object.

...

Not used.

Examples

-
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")
#> Successfully compiled differential equation model from auto-generated C code.
- print(m_synth_SFO_lin)
#> <mkinmod> model generated with +
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")
#> Successfully compiled differential equation model from auto-generated C code.
+ print(m_synth_SFO_lin)
#> <mkinmod> model generated with #> Use of formation fractions $use_of_ff: max #> Specification $spec: #> $parent @@ -180,19 +184,23 @@
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/print.nafta.html b/docs/reference/print.nafta.html index af0d9f65..fa8223ad 100644 --- a/docs/reference/print.nafta.html +++ b/docs/reference/print.nafta.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -49,6 +51,7 @@ + @@ -118,6 +121,7 @@ +
@@ -137,7 +141,7 @@
# S3 method for nafta
-print(x, quiet = TRUE, digits = 3, ...)
+print(x, quiet = TRUE, digits = 3, ...)

Arguments

@@ -155,7 +159,7 @@ - +

Number of digits to be used for printing parameters and dissipation times.

...

Not used.

@@ -171,19 +175,23 @@ +
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/schaefer07_complex_case.html b/docs/reference/schaefer07_complex_case.html index a9c64362..c6635409 100644 --- a/docs/reference/schaefer07_complex_case.html +++ b/docs/reference/schaefer07_complex_case.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -49,6 +51,7 @@ + @@ -118,6 +121,7 @@ +
@@ -147,7 +151,8 @@
B1

a numeric vector

C1

a numeric vector

A2

a numeric vector

-

The results are a data frame with 14 results for different parameter values

+ +

The results are a data frame with 14 results for different parameter values

References

@@ -160,12 +165,13 @@

Examples

data <- mkin_wide_to_long(schaefer07_complex_case, time = "time") model <- mkinmod( - parent = list(type = "SFO", to = c("A1", "B1", "C1"), sink = FALSE), - A1 = list(type = "SFO", to = "A2"), - B1 = list(type = "SFO"), - C1 = list(type = "SFO"), - A2 = list(type = "SFO"), use_of_ff = "max")
#> Successfully compiled differential equation model from auto-generated C code.
fit <- mkinfit(model, data, quiet = TRUE) - plot(fit)
endpoints(fit)
#> $ff + parent = list(type = "SFO", to = c("A1", "B1", "C1"), sink = FALSE), + A1 = list(type = "SFO", to = "A2"), + B1 = list(type = "SFO"), + C1 = list(type = "SFO"), + A2 = list(type = "SFO"), use_of_ff = "max")
#> Successfully compiled differential equation model from auto-generated C code.
# \dontrun{ + fit <- mkinfit(model, data, quiet = TRUE) + plot(fit)
endpoints(fit)
#> $ff #> parent_A1 parent_B1 parent_C1 parent_sink A1_A2 A1_sink #> 0.3809619 0.1954667 0.4235714 0.0000000 0.4479620 0.5520380 #> @@ -179,8 +185,9 @@ #> B1 37.26907 123.80517 #> C1 11.23131 37.30960 #> A2 28.50627 94.69577 -#>
# Compare with the results obtained in the original publication - print(schaefer07_complex_results)
#> compound parameter KinGUI ModelMaker deviation +#>
# } + # Compare with the results obtained in the original publication + print(schaefer07_complex_results)
#> compound parameter KinGUI ModelMaker deviation #> 1 parent degradation rate 0.0496 0.0506 2.0 #> 2 parent DT50 13.9900 13.6900 2.2 #> 3 metabolite A1 formation fraction 0.3803 0.3696 2.9 @@ -210,19 +217,23 @@
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/sigma_twocomp.html b/docs/reference/sigma_twocomp.html index cbf253f9..ee956f9f 100644 --- a/docs/reference/sigma_twocomp.html +++ b/docs/reference/sigma_twocomp.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -52,6 +54,7 @@ This is the error model used for example by Werner et al. (1978). The model + @@ -121,6 +124,7 @@ This is the error model used for example by Werner et al. (1978). The model +
@@ -189,19 +193,23 @@ This is the error model used for example by Werner et al. (1978). The model
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/summary.mkinfit.html b/docs/reference/summary.mkinfit.html index 1eec5820..fafca9ce 100644 --- a/docs/reference/summary.mkinfit.html +++ b/docs/reference/summary.mkinfit.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -50,6 +52,7 @@ + @@ -119,6 +122,7 @@ +
@@ -139,9 +143,9 @@
# S3 method for mkinfit
-summary(object, data = TRUE, distimes = TRUE, alpha = 0.05, ...)
+summary(object, data = TRUE, distimes = TRUE, alpha = 0.05, ...)
 # S3 method for summary.mkinfit
-print(x, digits = max(3, getOption("digits") - 3), ...)
+print(x, digits = max(3, getOption("digits") - 3), ...)

Arguments

@@ -171,7 +175,7 @@ - +

Number of digits to use for printing

...

optional arguments passed to methods like print.

@@ -209,17 +213,17 @@

Examples

-
summary(mkinfit(mkinmod(parent = mkinsub("SFO")), FOCUS_2006_A, quiet = TRUE))
#> mkin version used for fitting: 0.9.49.6 -#> R version used for fitting: 3.6.0 -#> Date of fit: Tue Jul 9 09:00:02 2019 -#> Date of summary: Tue Jul 9 09:00:02 2019 +
summary(mkinfit(mkinmod(parent = mkinsub("SFO")), FOCUS_2006_A, quiet = TRUE))
#> mkin version used for fitting: 0.9.49.6 +#> R version used for fitting: 3.6.1 +#> Date of fit: Wed Sep 18 12:57:18 2019 +#> Date of summary: Wed Sep 18 12:57:18 2019 #> #> Equations: #> d_parent/dt = - k_parent_sink * parent #> #> Model predictions using solution type analytical #> -#> Fitted using 131 model solutions performed in 0.278 s +#> Fitted using 131 model solutions performed in 0.267 s #> #> Error model: Constant variance #> @@ -302,19 +306,23 @@
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/synthetic_data_for_UBA.html b/docs/reference/synthetic_data_for_UBA.html index 1f8bc914..b3da0016 100644 --- a/docs/reference/synthetic_data_for_UBA.html +++ b/docs/reference/synthetic_data_for_UBA.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -62,6 +64,7 @@ Compare also the code in the example section to see the degradation models." /> + @@ -131,6 +134,7 @@ Compare also the code in the example section to see the degradation models." /> +
@@ -170,7 +174,9 @@ Compare also the code in the example section to see the degradation models." /> each containing, among others, the following components

title

The name of the dataset, e.g. SFO_lin_a

data

A data frame with the data in the form expected by mkinfit

-
+ + +

Source

@@ -181,109 +187,7 @@ Compare also the code in the example section to see the degradation models." />

Examples

-
# 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") - -# 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) - -# Construct names for datasets with errors -d_synth_names = paste0("d_synth_", c("SFO_lin", "SFO_par", - "DFOP_lin", "DFOP_par")) - -# Function for adding errors. The add_err function now published with this -# package is a slightly generalised version where the names of secondary -# compartments that should have an initial value of zero (M1 and M2 in this -# case) are not hardcoded any more. -add_err = function(d, sdfunc, LOD = 0.1, reps = 2, seed = 123456789) -{ - set.seed(seed) - d_long = mkin_wide_to_long(d, time = "time") - d_rep = data.frame(lapply(d_long, rep, each = 2)) - d_rep$value = rnorm(length(d_rep$value), d_rep$value, sdfunc(d_rep$value)) - - d_rep[d_rep$time == 0 & d_rep$name - d_NA <- transform(d_rep, value = ifelse(value < LOD, NA, value)) - d_NA$value <- round(d_NA$value, 1) - return(d_NA) -} - -# 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) -} - -# 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))) - -} - -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) -
#> Error: <text>:67:43: Unerwartete(s) SPECIAL -#> 66: -#> 67: d_rep[d_rep$time == 0 & d_rep$name <!-- %in% -#> ^
+

   
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/test_data_from_UBA_2014.html b/docs/reference/test_data_from_UBA_2014.html index 8899ed11..5c1a3bed 100644 --- a/docs/reference/test_data_from_UBA_2014.html +++ b/docs/reference/test_data_from_UBA_2014.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -48,6 +50,7 @@ + @@ -117,6 +120,7 @@ +
@@ -142,7 +146,9 @@ Each dataset has, among others, the following components

title

The name of the dataset, e.g. UBA_2014_WS_river

data

A data frame with the data in the form expected by mkinfit

-
+ + +

Source

@@ -151,7 +157,8 @@

Examples

-
# This is a level P-II evaluation of the dataset according to the FOCUS kinetics +
# \dontrun{ + # This is a level P-II evaluation of the dataset according to the FOCUS kinetics # guidance. Due to the strong correlation of the parameter estimates, the # covariance matrix is not returned. Note that level P-II evaluations are # generally considered deprecated due to the frequent occurrence of such @@ -159,7 +166,7 @@ # model). m_ws <- mkinmod(parent_w = mkinsub("SFO", "parent_s"), parent_s = mkinsub("SFO", "parent_w"))
#> Successfully compiled differential equation model from auto-generated C code.
f_river <- mkinfit(m_ws, test_data_from_UBA_2014[[1]]$data, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
plot_sep(f_river)
- summary(f_river)$bpar
#> Estimate se_notrans t value Pr(>t) + summary(f_river)$bpar
#> Estimate se_notrans t value Pr(>t) #> parent_w_0 9.598567e+01 2.12351789 4.520126e+01 9.476190e-18 #> k_parent_w_sink 3.603743e-01 0.03149282 1.144306e+01 4.126593e-09 #> k_parent_w_parent_s 6.031371e-02 0.01603582 3.761186e+00 9.436275e-04 @@ -178,12 +185,12 @@ #> parent_s 0.20882325 2 3
# This is the evaluation used for the validation of software packages # in the expertise from 2014 - m_soil <- mkinmod(parent = mkinsub("SFO", c("M1", "M2")), + m_soil <- mkinmod(parent = mkinsub("SFO", c("M1", "M2")), M1 = mkinsub("SFO", "M3"), M2 = mkinsub("SFO", "M3"), M3 = mkinsub("SFO"), use_of_ff = "max")
#> Successfully compiled differential equation model from auto-generated C code.
- f_soil <- mkinfit(m_soil, test_data_from_UBA_2014[[3]]$data, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
plot_sep(f_soil, lpos = c("topright", "topright", "topright", "bottomright"))
summary(f_soil)$bpar
#> Estimate se_notrans t value Pr(>t) Lower + f_soil <- mkinfit(m_soil, test_data_from_UBA_2014[[3]]$data, quiet = TRUE)
#> Warning: Observations with value of zero were removed from the data
plot_sep(f_soil, lpos = c("topright", "topright", "topright", "bottomright"))
summary(f_soil)$bpar
#> Estimate se_notrans t value Pr(>t) Lower #> parent_0 76.55425584 0.859186619 89.1008474 1.113866e-26 74.755959756 #> k_parent 0.12081956 0.004601922 26.2541544 1.077373e-16 0.111561582 #> k_M1 0.84258649 0.806231419 1.0450926 1.545475e-01 0.113839803 @@ -209,7 +216,8 @@ #> parent 0.04721283 2 6 #> M1 0.26551209 2 5 #> M2 0.20327575 2 5 -#> M3 0.05196549 3 4
+#> M3 0.05196549 3 4
# } +
+
-

Site built with pkgdown 1.3.0.

+

Site built with pkgdown 1.4.1.

+
+ + diff --git a/docs/reference/transform_odeparms.html b/docs/reference/transform_odeparms.html index 72b4c2a7..b1a952d9 100644 --- a/docs/reference/transform_odeparms.html +++ b/docs/reference/transform_odeparms.html @@ -16,13 +16,15 @@ - + + - - + + + @@ -55,6 +57,7 @@ The transformation of sets of formation fractions is fragile, as it supposes + @@ -124,6 +127,7 @@ The transformation of sets of formation fractions is fragile, as it supposes +
@@ -200,77 +204,81 @@ The transformation of sets of formation fractions is fragile, as it supposes

Examples

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) + 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) # Transformed and backtransformed parameters -print(fit.s$par, 3)
#> Estimate Std. Error Lower Upper +print(fit.s$par, 3)
#> Estimate Std. Error Lower Upper #> parent_0 99.60 1.5702 96.40 102.79 #> log_k_parent_sink -3.04 0.0763 -3.19 -2.88 #> log_k_parent_m1 -2.98 0.0403 -3.06 -2.90 #> log_k_m1_sink -5.25 0.1332 -5.52 -4.98 -#> sigma 3.13 0.3585 2.40 3.85
print(fit.s$bpar, 3)
#> Estimate se_notrans t value Pr(>t) Lower Upper +#> sigma 3.13 0.3585 2.40 3.85
print(fit.s$bpar, 3)
#> Estimate se_notrans t value Pr(>t) Lower Upper #> parent_0 99.59848 1.57022 63.43 2.30e-36 96.40384 102.7931 #> k_parent_sink 0.04792 0.00365 13.11 6.13e-15 0.04103 0.0560 #> k_parent_m1 0.05078 0.00205 24.80 3.27e-23 0.04678 0.0551 #> k_m1_sink 0.00526 0.00070 7.51 6.16e-09 0.00401 0.0069 #> sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.8549
-
# 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
fit.2.s <- summary(fit.2) -print(fit.2.s$par, 3)
#> Estimate Std. Error Lower Upper +# \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
fit.2.s <- summary(fit.2) +print(fit.2.s$par, 3)
#> Estimate Std. Error Lower Upper #> parent_0 99.59848 1.57022 96.40384 1.03e+02 #> k_parent_sink 0.04792 0.00365 0.04049 5.54e-02 #> k_parent_m1 0.05078 0.00205 0.04661 5.49e-02 #> k_m1_sink 0.00526 0.00070 0.00384 6.69e-03 -#> sigma 3.12550 0.35852 2.39609 3.85e+00
print(fit.2.s$bpar, 3)
#> Estimate se_notrans t value Pr(>t) Lower Upper +#> sigma 3.12550 0.35852 2.39609 3.85e+00
print(fit.2.s$bpar, 3)
#> Estimate se_notrans t value Pr(>t) Lower Upper #> parent_0 99.59848 1.57022 63.43 2.30e-36 96.40384 1.03e+02 #> k_parent_sink 0.04792 0.00365 13.11 6.13e-15 0.04049 5.54e-02 #> k_parent_m1 0.05078 0.00205 24.80 3.27e-23 0.04661 5.49e-02 #> k_m1_sink 0.00526 0.00070 7.51 6.16e-09 0.00384 6.69e-03 -#> sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.85e+00
+#> sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.85e+00
# } + initials <- fit$start$value -names(initials) <- rownames(fit$start) +names(initials) <- rownames(fit$start) transformed <- fit$start_transformed$value -names(transformed) <- rownames(fit$start_transformed) +names(transformed) <- rownames(fit$start_transformed) transform_odeparms(initials, SFO_SFO)
#> parent_0 log_k_parent_sink log_k_parent_m1 log_k_m1_sink #> 100.750000 -2.302585 -2.301586 -2.300587
backtransform_odeparms(transformed, SFO_SFO)
#> parent_0 k_parent_sink k_parent_m1 k_m1_sink #> 100.7500 0.1000 0.1001 0.1002
-
# The case of formation fractions +# \dontrun{ +# The case of formation fractions SFO_SFO.ff <- mkinmod( - parent = list(type = "SFO", to = "m1", sink = TRUE), - m1 = list(type = "SFO"), + 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) -print(fit.ff.s$par, 3)
#> Estimate Std. Error Lower Upper +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) +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 #> log_k_m1 -5.248 0.1332 -5.5184 -4.977 #> f_parent_ilr_1 0.041 0.0631 -0.0875 0.169 -#> sigma 3.126 0.3585 2.3961 3.855
print(fit.ff.s$bpar, 3)
#> Estimate se_notrans t value Pr(>t) Lower Upper +#> sigma 3.126 0.3585 2.3961 3.855
print(fit.ff.s$bpar, 3)
#> Estimate se_notrans t value Pr(>t) Lower Upper #> parent_0 99.59848 1.57022 63.43 2.30e-36 96.40384 102.7931 #> k_parent 0.09870 0.00403 24.47 4.96e-23 0.09082 0.1073 #> k_m1 0.00526 0.00070 7.51 6.16e-09 0.00401 0.0069 #> f_parent_to_m1 0.51448 0.02230 23.07 3.10e-22 0.46912 0.5596 -#> sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.8549
initials <- c("f_parent_to_m1" = 0.5) +#> sigma 3.12550 0.35852 8.72 2.24e-10 2.39609 3.8549
initials <- c("f_parent_to_m1" = 0.5) transformed <- transform_odeparms(initials, SFO_SFO.ff) backtransform_odeparms(transformed, SFO_SFO.ff)
#> f_parent_to_m1 #> 0.5
# And without sink SFO_SFO.ff.2 <- mkinmod( - parent = list(type = "SFO", to = "m1", sink = FALSE), - m1 = list(type = "SFO"), + parent = list(type = "SFO", to = "m1", sink = FALSE), + 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) -print(fit.ff.2.s$par, 3)
#> Estimate Std. Error Lower Upper +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) +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 #> log_k_m1 -4.21 0.123 -4.46 -3.96 -#> sigma 8.22 0.943 6.31 10.14
print(fit.ff.2.s$bpar, 3)
#> Estimate se_notrans t value Pr(>t) Lower Upper +#> sigma 8.22 0.943 6.31 10.14
print(fit.ff.2.s$bpar, 3)
#> Estimate se_notrans t value Pr(>t) Lower Upper #> parent_0 84.7916 3.01203 28.15 1.92e-25 78.6704 90.913 #> k_parent 0.0635 0.00521 12.19 2.91e-14 0.0538 0.075 #> k_m1 0.0148 0.00182 8.13 8.81e-10 0.0115 0.019 -#> sigma 8.2229 0.94323 8.72 1.73e-10 6.3060 10.140
+#> sigma 8.2229 0.94323 8.72 1.73e-10 6.3060 10.140
# } +
+ + + diff --git a/man/max_twa_parent.Rd b/man/max_twa_parent.Rd index f599eb1c..c601b768 100644 --- a/man/max_twa_parent.Rd +++ b/man/max_twa_parent.Rd @@ -1,5 +1,9 @@ \name{max_twa_parent} \alias{max_twa_parent} +\alias{max_twa_sfo} +\alias{max_twa_fomc} +\alias{max_twa_dfop} +\alias{max_twa_hs} \title{ Function to calculate maximum time weighted average concentrations from kinetic models fitted with mkinfit } @@ -11,6 +15,10 @@ using the analytical formulas given in the PEC soil section of the FOCUS guidance.} \usage{ max_twa_parent(fit, windows) + max_twa_sfo(M0 = 1, k, t) + max_twa_fomc(M0 = 1, alpha, beta, t) + max_twa_dfop(M0 = 1, k1, k2, g, t) + max_twa_hs(M0 = 1, k1, k2, tb, t) } \arguments{ \item{fit}{ @@ -19,13 +27,45 @@ guidance.} \item{windows}{ The width of the time windows for which the TWAs should be calculated. } + \item{M0}{ + The initial concentration for which the maximum time weighted + average over the decline curve should be calculated. The default + is to use a value of 1, which means that a relative maximum time + weighted average factor (f_twa) is calculated. + } + \item{k}{ + The rate constant in the case of SFO kinetics. + } + \item{t}{ + The width of the time window. + } + \item{alpha}{ + Parameter of the FOMC model. + } + \item{beta}{ + Parameter of the FOMC model. + } + \item{k1}{ + The first rate constant of the DFOP or the HS kinetics. + } + \item{k2}{ + The second rate constant of the DFOP or the HS kinetics. + } + \item{g}{ + Parameter of the DFOP model. + } + \item{tb}{ + Parameter of the HS model. + } } \value{ - A numeric vector, named using the \code{windows} argument. + For \code{max_twa_parent}, a numeric vector, named using the \code{windows} argument. + For the other functions, a numeric vector of length one (also known as 'a + number'). } \examples{ fit <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE) - max_twa_parent(fit, c(7, 21)) + max_twa_parent(fit, c(7, 21)) } \references{ FOCUS (2006) \dQuote{Guidance Document on Estimating Persistence and diff --git a/vignettes/mkin_benchmarks.rda b/vignettes/mkin_benchmarks.rda index fc996a73..b5132fa8 100644 Binary files a/vignettes/mkin_benchmarks.rda and b/vignettes/mkin_benchmarks.rda differ diff --git a/vignettes/twa.Rmd b/vignettes/twa.Rmd index 92a0cd4b..724775bc 100644 --- a/vignettes/twa.Rmd +++ b/vignettes/twa.Rmd @@ -73,6 +73,7 @@ $$f_\textrm{twa} = \frac{1}{t} \left( \frac{e^{- k_1 t_b}}{k_2} \left( 1 - e^{- k_2 (t - t_b)} \right) \right) $$ Note that a method for calculating maximum moving window time weighted average -concentrations for any model fitted by 'mkinfit', and also for metabolites in -such models, is integrated in the 'mkin' package, see the -[documentation](https://pkgdown.jrwb.de/pfm/reference/max_twa_parent.html) at my website. +concentrations for a model fitted by 'mkinfit' is include in the +'mkin' package (['max_twa_parent'](https://pkgdown.jrwb.de/mkin/reference/max_twa_parent.html). +If the same is needed for metabolites, the function +['max_twa'](https://pkgdown.jrwb.de/pfm/reference/max_twa.html) can be used. -- cgit v1.2.1