From 67c8163487e776e9a378c9dfcd39c74f6e6bc507 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 7 May 2020 09:10:33 +0200 Subject: Merge parent solutions to one file - Combine R/*.solution.R into R/parent_solutions.R - Create a roxygen family of related functions - Reduce redundancy by using the inherit tag - Change the parent.0 argument to parent_0 to match the corresponding parameter name used in mkinfit --- docs/pkgdown.yml | 2 +- docs/reference/FOMC.solution.html | 5 +++++ docs/reference/IORE.solution.html | 15 ++++++++++++--- docs/reference/logistic.solution-2.png | Bin 80598 -> 29336 bytes docs/reference/logistic.solution-3.png | Bin 0 -> 80598 bytes docs/reference/logistic.solution-4.png | Bin 0 -> 29336 bytes docs/reference/logistic.solution.html | 32 +++++++++++++++++++++++++++++--- 7 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 docs/reference/logistic.solution-3.png create mode 100644 docs/reference/logistic.solution-4.png (limited to 'docs') diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 5aec64b7..6489b012 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -10,7 +10,7 @@ articles: NAFTA_examples: web_only/NAFTA_examples.html benchmarks: web_only/benchmarks.html compiled_models: web_only/compiled_models.html -last_built: 2020-05-07T06:58Z +last_built: 2020-05-07T07:07Z urls: reference: https://pkgdown.jrwb.de/mkin/reference article: https://pkgdown.jrwb.de/mkin/articles diff --git a/docs/reference/FOMC.solution.html b/docs/reference/FOMC.solution.html index 8e2b154e..6c1f5229 100644 --- a/docs/reference/FOMC.solution.html +++ b/docs/reference/FOMC.solution.html @@ -190,6 +190,11 @@ in the original equation.

EU Registration” Report of the FOCUS Work Group on Degradation Kinetics, EC Document Reference Sanco/10058/2005 version 2.0, 434 pp, http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

+

FOCUS (2014) “Generic guidance for Estimating Persistence + and Degradation Kinetics from Environmental Fate Studies on Pesticides in + EU Registration” Report of the FOCUS Work Group on Degradation Kinetics, + Version 1.1, 18 December 2014 + http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics

Gustafson DI and Holden LR (1990) Nonlinear pesticide dissipation in soil: A new model based on spatial variability. Environmental Science and Technology 24, 1032-1038

diff --git a/docs/reference/IORE.solution.html b/docs/reference/IORE.solution.html index 677d4b43..f197cb08 100644 --- a/docs/reference/IORE.solution.html +++ b/docs/reference/IORE.solution.html @@ -196,11 +196,20 @@ units used.

Examples

plot(function(x) IORE.solution(x, 100, 0.2, 1.3), 0, 2, ylim = c(0, 100))
# \dontrun{ - fit.fomc <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE)
#> Error in (function (t, parent_0, alpha, beta) { parent = parent_0/(t/beta + 1)^alpha})(t = c(0, 1, 1.2020202020202, 2.4040404040404, 3, 3.60606060606061, 4.80808080808081, 6.01010101010101, 7, 7.21212121212121, 8.41414141414141, 9.61616161616162, 10.8181818181818, 12.020202020202, 13.2222222222222, 14, 14.4242424242424, 15.6262626262626, 16.8282828282828, 18.030303030303, 19.2323232323232, 20.4343434343434, 21.6363636363636, 22.8383838383838, 24.040404040404, 25.2424242424242, 26.4444444444444, 27.6464646464646, 28, 28.8484848484848, 30.050505050505, 31.2525252525253, 32.4545454545455, 33.6565656565657, 34.8585858585859, 36.0606060606061, 37.2626262626263, 38.4646464646465, 39.6666666666667, 40.8686868686869, 42.0707070707071, 43.2727272727273, 44.4747474747475, 45.6767676767677, 46.8787878787879, 48.0808080808081, 49.2828282828283, 50.4848484848485, 51.6868686868687, 52.8888888888889, 54.0909090909091, 55.2929292929293, 56.4949494949495, 57.6969696969697, 58.8989898989899, 60.1010101010101, 61.3030303030303, 62.5050505050505, 63, 63.7070707070707, 64.9090909090909, 66.1111111111111, 67.3131313131313, 68.5151515151515, 69.7171717171717, 70.9191919191919, 72.1212121212121, 73.3232323232323, 74.5252525252525, 75.7272727272727, 76.9292929292929, 78.1313131313131, 79.3333333333333, 80.5353535353535, 81.7373737373737, 82.9393939393939, 84.1414141414141, 85.3434343434343, 86.5454545454545, 87.7474747474747, 88.9494949494949, 90.1515151515152, 91, 91.3535353535353, 92.5555555555556, 93.7575757575758, 94.959595959596, 96.1616161616162, 97.3636363636364, 98.5656565656566, 99.7676767676768, 100.969696969697, 102.171717171717, 103.373737373737, 104.575757575758, 105.777777777778, 106.979797979798, 108.181818181818, 109.383838383838, 110.585858585859, 111.787878787879, 112.989898989899, 114.191919191919, 115.393939393939, 116.59595959596, 117.79797979798, 119), parent.0 = c(parent = 85.1), alpha = 1, beta = 10): unbenutztes Argument (parent.0 = 85.1)
#> Timing stopped at: 0.002 0 0.002
fit.iore <- mkinfit("IORE", FOCUS_2006_C, quiet = TRUE)
#> Error in (function (t, parent_0, k__iore, N) { parent = (parent_0^(1 - N) - (1 - N) * k__iore * t)^(1/(1 - N))})(t = c(0, 1, 1.2020202020202, 2.4040404040404, 3, 3.60606060606061, 4.80808080808081, 6.01010101010101, 7, 7.21212121212121, 8.41414141414141, 9.61616161616162, 10.8181818181818, 12.020202020202, 13.2222222222222, 14, 14.4242424242424, 15.6262626262626, 16.8282828282828, 18.030303030303, 19.2323232323232, 20.4343434343434, 21.6363636363636, 22.8383838383838, 24.040404040404, 25.2424242424242, 26.4444444444444, 27.6464646464646, 28, 28.8484848484848, 30.050505050505, 31.2525252525253, 32.4545454545455, 33.6565656565657, 34.8585858585859, 36.0606060606061, 37.2626262626263, 38.4646464646465, 39.6666666666667, 40.8686868686869, 42.0707070707071, 43.2727272727273, 44.4747474747475, 45.6767676767677, 46.8787878787879, 48.0808080808081, 49.2828282828283, 50.4848484848485, 51.6868686868687, 52.8888888888889, 54.0909090909091, 55.2929292929293, 56.4949494949495, 57.6969696969697, 58.8989898989899, 60.1010101010101, 61.3030303030303, 62.5050505050505, 63, 63.7070707070707, 64.9090909090909, 66.1111111111111, 67.3131313131313, 68.5151515151515, 69.7171717171717, 70.9191919191919, 72.1212121212121, 73.3232323232323, 74.5252525252525, 75.7272727272727, 76.9292929292929, 78.1313131313131, 79.3333333333333, 80.5353535353535, 81.7373737373737, 82.9393939393939, 84.1414141414141, 85.3434343434343, 86.5454545454545, 87.7474747474747, 88.9494949494949, 90.1515151515152, 91, 91.3535353535353, 92.5555555555556, 93.7575757575758, 94.959595959596, 96.1616161616162, 97.3636363636364, 98.5656565656566, 99.7676767676768, 100.969696969697, 102.171717171717, 103.373737373737, 104.575757575758, 105.777777777778, 106.979797979798, 108.181818181818, 109.383838383838, 110.585858585859, 111.787878787879, 112.989898989899, 114.191919191919, 115.393939393939, 116.59595959596, 117.79797979798, 119), parent.0 = c(parent = 85.1), k__iore = 0.1, N = 1.1): unbenutztes Argument (parent.0 = 85.1)
#> Timing stopped at: 0 0 0.001
fit.iore.deS <- mkinfit("IORE", FOCUS_2006_C, solution_type = "deSolve", quiet = TRUE) + fit.fomc <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE) + fit.iore <- mkinfit("IORE", FOCUS_2006_C, quiet = TRUE) + fit.iore.deS <- mkinfit("IORE", FOCUS_2006_C, solution_type = "deSolve", quiet = TRUE) print(data.frame(fit.fomc$par, fit.iore$par, fit.iore.deS$par, - row.names = paste("model par", 1:4)))
#> Error in data.frame(fit.fomc$par, fit.iore$par, fit.iore.deS$par, row.names = paste("model par", 1:4)): Objekt 'fit.fomc' nicht gefunden
print(rbind(fomc = endpoints(fit.fomc)$distimes, iore = endpoints(fit.iore)$distimes, - iore.deS = endpoints(fit.iore)$distimes))
#> Error in endpoints(fit.fomc): Objekt 'fit.fomc' nicht gefunden
# } + row.names = paste("model par", 1:4)))
#> fit.fomc.par fit.iore.par fit.iore.deS.par +#> model par 1 85.87489063 85.874890 85.874890 +#> model par 2 0.05192238 -4.826631 -4.826631 +#> model par 3 0.65096665 1.949403 1.949403 +#> model par 4 1.85744396 1.857444 1.857444
print(rbind(fomc = endpoints(fit.fomc)$distimes, iore = endpoints(fit.iore)$distimes, + iore.deS = endpoints(fit.iore)$distimes))
#> DT50 DT90 DT50back +#> fomc 1.785233 15.1479 4.559973 +#> iore 1.785233 15.1479 4.559973 +#> iore.deS 1.785233 15.1479 4.559973
# }
diff --git a/docs/reference/logistic.solution-2.png b/docs/reference/logistic.solution-2.png index fd11d0c0..78a31f93 100644 Binary files a/docs/reference/logistic.solution-2.png and b/docs/reference/logistic.solution-2.png differ diff --git a/docs/reference/logistic.solution-3.png b/docs/reference/logistic.solution-3.png new file mode 100644 index 00000000..fd11d0c0 Binary files /dev/null and b/docs/reference/logistic.solution-3.png differ diff --git a/docs/reference/logistic.solution-4.png b/docs/reference/logistic.solution-4.png new file mode 100644 index 00000000..78a31f93 Binary files /dev/null and b/docs/reference/logistic.solution-4.png differ diff --git a/docs/reference/logistic.solution.html b/docs/reference/logistic.solution.html index 3e87b90d..9697d420 100644 --- a/docs/reference/logistic.solution.html +++ b/docs/reference/logistic.solution.html @@ -234,7 +234,20 @@ an increasing rate constant, supposedly caused by microbial growth

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)
#> Error in (function (t, parent_0, kmax, k0, r) { parent = parent_0 * (kmax/(kmax - k0 + k0 * exp(r * t)))^(kmax/r)})(t = c(0, 1, 1.21212121212121, 2.42424242424242, 3, 3.63636363636364, 4.84848484848485, 6.06060606060606, 7, 7.27272727272727, 8.48484848484848, 9.6969696969697, 10.9090909090909, 12.1212121212121, 13.3333333333333, 14, 14.5454545454545, 15.7575757575758, 16.969696969697, 18.1818181818182, 19.3939393939394, 20.6060606060606, 21.8181818181818, 23.030303030303, 24.2424242424242, 25.4545454545455, 26.6666666666667, 27.8787878787879, 28, 29.0909090909091, 30.3030303030303, 31.5151515151515, 32.7272727272727, 33.9393939393939, 35.1515151515152, 36.3636363636364, 37.5757575757576, 38.7878787878788, 40, 41.2121212121212, 42.4242424242424, 43.6363636363636, 44.8484848484849, 46.0606060606061, 47.2727272727273, 48.4848484848485, 49.6969696969697, 50.9090909090909, 52.1212121212121, 53.3333333333333, 54.5454545454545, 55.7575757575758, 56.969696969697, 58.1818181818182, 59.3939393939394, 60, 60.6060606060606, 61.8181818181818, 63.030303030303, 64.2424242424242, 65.4545454545455, 66.6666666666667, 67.8787878787879, 69.0909090909091, 70.3030303030303, 71.5151515151515, 72.7272727272727, 73.9393939393939, 75.1515151515152, 76.3636363636364, 77.5757575757576, 78.7878787878788, 80, 81.2121212121212, 82.4242424242424, 83.6363636363636, 84.8484848484848, 86.0606060606061, 87.2727272727273, 88.4848484848485, 89.6969696969697, 90, 90.9090909090909, 92.1212121212121, 93.3333333333333, 94.5454545454545, 95.7575757575758, 96.969696969697, 98.1818181818182, 99.3939393939394, 100.606060606061, 101.818181818182, 103.030303030303, 104.242424242424, 105.454545454545, 106.666666666667, 107.878787878788, 109.090909090909, 110.30303030303, 111.515151515152, 112.727272727273, 113.939393939394, 115.151515151515, 116.363636363636, 117.575757575758, 118.787878787879, 120), parent.0 = c(parent = 101.95687), kmax = 0.1, k0 = 1e-04, r = 0.2): unbenutztes Argument (parent.0 = 101.95687)
#> Timing stopped at: 0.001 0 0.001
plot_sep(m)
#> Error in identical(fit$err_mod, "const"): Objekt 'm' nicht gefunden
summary(m)$bpar
#> Error in summary(m): Objekt 'm' nicht gefunden
endpoints(m)$distimes
#> Error in endpoints(m): Objekt 'm' nicht gefunden
+ 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.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.4448749 +#> r 1.1821120 +#> sigma 7.3256566
endpoints(m)$distimes
#> DT50 DT90 DT50_k0 DT50_kmax +#> parent 36.86533 62.41511 4297.853 10.83349
# Reproduce the plot on page 57 of FOCUS (2014) plot(function(x) logistic.solution(x, 100, 0.08, 0.0001, 0.2), @@ -246,7 +259,7 @@ an increasing rate constant, supposedly caused by microbial growth

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)
+ lty = 1:5, col = 1:5)
# Fit with synthetic data logistic <- mkinmod(parent = mkinsub("logistic")) @@ -259,7 +272,20 @@ an increasing rate constant, supposedly caused by microbial growth

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)
#> Error in (function (t, parent_0, kmax, k0, r) { parent = parent_0 * (kmax/(kmax - k0 + k0 * exp(r * t)))^(kmax/r)})(t = c(0, 1, 1.21212121212121, 2.42424242424242, 3, 3.63636363636364, 4.84848484848485, 6.06060606060606, 7, 7.27272727272727, 8.48484848484848, 9.6969696969697, 10.9090909090909, 12.1212121212121, 13.3333333333333, 14, 14.5454545454545, 15.7575757575758, 16.969696969697, 18.1818181818182, 19.3939393939394, 20.6060606060606, 21.8181818181818, 23.030303030303, 24.2424242424242, 25.4545454545455, 26.6666666666667, 27.8787878787879, 28, 29.0909090909091, 30.3030303030303, 31.5151515151515, 32.7272727272727, 33.9393939393939, 35.1515151515152, 36.3636363636364, 37.5757575757576, 38.7878787878788, 40, 41.2121212121212, 42.4242424242424, 43.6363636363636, 44.8484848484849, 46.0606060606061, 47.2727272727273, 48.4848484848485, 49.6969696969697, 50.9090909090909, 52.1212121212121, 53.3333333333333, 54.5454545454545, 55.7575757575758, 56.969696969697, 58.1818181818182, 59.3939393939394, 60, 60.6060606060606, 61.8181818181818, 63.030303030303, 64.2424242424242, 65.4545454545455, 66.6666666666667, 67.8787878787879, 69.0909090909091, 70.3030303030303, 71.5151515151515, 72.7272727272727, 73.9393939393939, 75.1515151515152, 76.3636363636364, 77.5757575757576, 78.7878787878788, 80, 81.2121212121212, 82.4242424242424, 83.6363636363636, 84.8484848484848, 86.0606060606061, 87.2727272727273, 88.4848484848485, 89.6969696969697, 90, 90.9090909090909, 92.1212121212121, 93.3333333333333, 94.5454545454545, 95.7575757575758, 96.969696969697, 98.1818181818182, 99.3939393939394, 100.606060606061, 101.818181818182, 103.030303030303, 104.242424242424, 105.454545454545, 106.666666666667, 107.878787878788, 109.090909090909, 110.30303030303, 111.515151515152, 112.727272727273, 113.939393939394, 115.151515151515, 116.363636363636, 117.575757575758, 118.787878787879, 120), parent.0 = c(parent = 101.95687), kmax = 0.1, k0 = 1e-04, r = 0.2): unbenutztes Argument (parent.0 = 101.95687)
#> Timing stopped at: 0 0 0
plot_sep(m)
#> Error in identical(fit$err_mod, "const"): Objekt 'm' nicht gefunden
summary(m)$bpar
#> Error in summary(m): Objekt 'm' nicht gefunden
endpoints(m)$distimes
#> Error in endpoints(m): Objekt 'm' nicht gefunden
+ 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.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.4448749 +#> r 1.1821120 +#> sigma 7.3256566
endpoints(m)$distimes
#> DT50 DT90 DT50_k0 DT50_kmax +#> parent 36.86533 62.41511 4297.853 10.83349