From a77a10ea6c607346778ba0700b3b66ac393101a2 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 27 May 2020 06:06:08 +0200 Subject: Create up to date pkgdown docs in development mode --- README.md | 2 +- _pkgdown.yml | 3 + docs/dev/404.html | 175 ++++ docs/dev/articles/FOCUS_D.html | 330 ++++++ .../articles/FOCUS_D_files/figure-html/plot-1.png | Bin 0 -> 101350 bytes .../FOCUS_D_files/figure-html/plot_2-1.png | Bin 0 -> 15733 bytes docs/dev/articles/FOCUS_L.html | 797 +++++++++++++++ .../figure-html/unnamed-chunk-10-1.png | Bin 0 -> 29158 bytes .../figure-html/unnamed-chunk-12-1.png | Bin 0 -> 54890 bytes .../figure-html/unnamed-chunk-13-1.png | Bin 0 -> 22017 bytes .../figure-html/unnamed-chunk-15-1.png | Bin 0 -> 38623 bytes .../figure-html/unnamed-chunk-4-1.png | Bin 0 -> 23429 bytes .../figure-html/unnamed-chunk-5-1.png | Bin 0 -> 14826 bytes .../figure-html/unnamed-chunk-6-1.png | Bin 0 -> 23884 bytes .../figure-html/unnamed-chunk-8-1.png | Bin 0 -> 27992 bytes .../figure-html/unnamed-chunk-9-1.png | Bin 0 -> 28432 bytes docs/dev/articles/index.html | 188 ++++ docs/dev/articles/mkin.html | 261 +++++ .../mkin_files/figure-html/unnamed-chunk-2-1.png | Bin 0 -> 116136 bytes docs/dev/articles/twa.html | 175 ++++ docs/dev/articles/web_only/FOCUS_Z.html | 364 +++++++ .../figure-html/FOCUS_2006_Z_fits_1-1.png | Bin 0 -> 88629 bytes .../figure-html/FOCUS_2006_Z_fits_10-1.png | Bin 0 -> 133239 bytes .../figure-html/FOCUS_2006_Z_fits_11-1.png | Bin 0 -> 132494 bytes .../figure-html/FOCUS_2006_Z_fits_11a-1.png | Bin 0 -> 99564 bytes .../figure-html/FOCUS_2006_Z_fits_11b-1.png | Bin 0 -> 22623 bytes .../figure-html/FOCUS_2006_Z_fits_2-1.png | Bin 0 -> 88629 bytes .../figure-html/FOCUS_2006_Z_fits_3-1.png | Bin 0 -> 88213 bytes .../figure-html/FOCUS_2006_Z_fits_5-1.png | Bin 0 -> 104162 bytes .../figure-html/FOCUS_2006_Z_fits_6-1.png | Bin 0 -> 133000 bytes .../figure-html/FOCUS_2006_Z_fits_7-1.png | Bin 0 -> 132462 bytes .../figure-html/FOCUS_2006_Z_fits_9-1.png | Bin 0 -> 110758 bytes docs/dev/articles/web_only/NAFTA_examples.html | 989 ++++++++++++++++++ .../NAFTA_examples_files/figure-html/p10-1.png | Bin 0 -> 53828 bytes .../NAFTA_examples_files/figure-html/p11-1.png | Bin 0 -> 51210 bytes .../NAFTA_examples_files/figure-html/p12a-1.png | Bin 0 -> 54489 bytes .../NAFTA_examples_files/figure-html/p12b-1.png | Bin 0 -> 47070 bytes .../NAFTA_examples_files/figure-html/p13-1.png | Bin 0 -> 51343 bytes .../NAFTA_examples_files/figure-html/p14-1.png | Bin 0 -> 53898 bytes .../NAFTA_examples_files/figure-html/p15a-1.png | Bin 0 -> 51113 bytes .../NAFTA_examples_files/figure-html/p15b-1.png | Bin 0 -> 52979 bytes .../NAFTA_examples_files/figure-html/p16-1.png | Bin 0 -> 62414 bytes .../NAFTA_examples_files/figure-html/p5a-1.png | Bin 0 -> 55286 bytes .../NAFTA_examples_files/figure-html/p5b-1.png | Bin 0 -> 53505 bytes .../NAFTA_examples_files/figure-html/p6-1.png | Bin 0 -> 54907 bytes .../NAFTA_examples_files/figure-html/p7-1.png | Bin 0 -> 66709 bytes .../NAFTA_examples_files/figure-html/p8-1.png | Bin 0 -> 61400 bytes .../NAFTA_examples_files/figure-html/p9a-1.png | Bin 0 -> 53005 bytes .../NAFTA_examples_files/figure-html/p9b-1.png | Bin 0 -> 49914 bytes docs/dev/articles/web_only/benchmarks.html | 391 ++++++++ docs/dev/articles/web_only/compiled_models.html | 221 ++++ docs/dev/authors.html | 186 ++++ docs/dev/bootstrap-toc.css | 60 ++ docs/dev/bootstrap-toc.js | 159 +++ docs/dev/docsearch.css | 148 +++ docs/dev/docsearch.js | 85 ++ docs/dev/index.html | 251 +++++ docs/dev/link.svg | 12 + docs/dev/news/index.html | 845 ++++++++++++++++ docs/dev/pkgdown.css | 367 +++++++ docs/dev/pkgdown.js | 108 ++ docs/dev/pkgdown.yml | 17 + docs/dev/reference/AIC.mmkin.html | 240 +++++ docs/dev/reference/CAKE_export.html | 261 +++++ docs/dev/reference/DFOP.solution-1.png | Bin 0 -> 19369 bytes docs/dev/reference/DFOP.solution.html | 236 +++++ docs/dev/reference/Extract.mmkin.html | 253 +++++ docs/dev/reference/FOCUS_2006_DFOP_ref_A_to_B.html | 212 ++++ docs/dev/reference/FOCUS_2006_FOMC_ref_A_to_F.html | 211 ++++ docs/dev/reference/FOCUS_2006_HS_ref_A_to_F.html | 212 ++++ docs/dev/reference/FOCUS_2006_SFO_ref_A_to_F.html | 210 ++++ docs/dev/reference/FOCUS_2006_datasets.html | 213 ++++ docs/dev/reference/FOMC.solution-1.png | Bin 0 -> 18630 bytes docs/dev/reference/FOMC.solution.html | 245 +++++ docs/dev/reference/HS.solution-1.png | Bin 0 -> 18893 bytes docs/dev/reference/HS.solution.html | 237 +++++ docs/dev/reference/IORE.solution-1.png | Bin 0 -> 18668 bytes docs/dev/reference/IORE.solution.html | 245 +++++ docs/dev/reference/NAFTA_SOP_2015-1.png | Bin 0 -> 41379 bytes docs/dev/reference/NAFTA_SOP_2015.html | 240 +++++ docs/dev/reference/NAFTA_SOP_Attachment-1.png | Bin 0 -> 42204 bytes docs/dev/reference/NAFTA_SOP_Attachment.html | 234 +++++ docs/dev/reference/SFO.solution-1.png | Bin 0 -> 18661 bytes docs/dev/reference/SFO.solution.html | 225 +++++ docs/dev/reference/SFORB.solution-1.png | Bin 0 -> 20190 bytes docs/dev/reference/SFORB.solution.html | 243 +++++ docs/dev/reference/add_err-1.png | Bin 0 -> 111278 bytes docs/dev/reference/add_err-2.png | Bin 0 -> 63031 bytes docs/dev/reference/add_err-3.png | Bin 0 -> 60608 bytes docs/dev/reference/add_err.html | 287 ++++++ docs/dev/reference/aw.html | 221 ++++ docs/dev/reference/confint.mkinfit.html | 419 ++++++++ docs/dev/reference/create_deg_func.html | 225 +++++ docs/dev/reference/endpoints.html | 232 +++++ docs/dev/reference/experimental_data_for_UBA-1.png | Bin 0 -> 107152 bytes docs/dev/reference/experimental_data_for_UBA.html | 300 ++++++ docs/dev/reference/get_deg_func.html | 185 ++++ docs/dev/reference/ilr.html | 220 ++++ docs/dev/reference/index.html | 699 +++++++++++++ docs/dev/reference/loftest-1.png | Bin 0 -> 27354 bytes docs/dev/reference/loftest-2.png | Bin 0 -> 27721 bytes docs/dev/reference/loftest-3.png | Bin 0 -> 78754 bytes docs/dev/reference/loftest-4.png | Bin 0 -> 76899 bytes docs/dev/reference/loftest-5.png | Bin 0 -> 75806 bytes docs/dev/reference/loftest.html | 349 +++++++ docs/dev/reference/logLik.mkinfit.html | 229 +++++ docs/dev/reference/logistic.solution-1.png | Bin 0 -> 80598 bytes docs/dev/reference/logistic.solution-2.png | Bin 0 -> 29336 bytes docs/dev/reference/logistic.solution.html | 275 +++++ docs/dev/reference/lrtest.mkinfit.html | 265 +++++ docs/dev/reference/max_twa_parent.html | 270 +++++ docs/dev/reference/mccall81_245T.html | 245 +++++ docs/dev/reference/mkin_long_to_wide.html | 233 +++++ docs/dev/reference/mkin_wide_to_long.html | 213 ++++ docs/dev/reference/mkinds.html | 253 +++++ docs/dev/reference/mkinerrmin.html | 233 +++++ docs/dev/reference/mkinerrplot-1.png | Bin 0 -> 41458 bytes docs/dev/reference/mkinerrplot.html | 272 +++++ docs/dev/reference/mkinfit.html | 1054 ++++++++++++++++++++ docs/dev/reference/mkinmod.html | 320 ++++++ docs/dev/reference/mkinparplot-1.png | Bin 0 -> 16468 bytes docs/dev/reference/mkinparplot.html | 203 ++++ docs/dev/reference/mkinplot.html | 198 ++++ docs/dev/reference/mkinpredict.html | 447 +++++++++ docs/dev/reference/mkinresplot-1.png | Bin 0 -> 14861 bytes docs/dev/reference/mkinresplot.html | 275 +++++ docs/dev/reference/mkinsub.html | 228 +++++ docs/dev/reference/mmkin-1.png | Bin 0 -> 115683 bytes docs/dev/reference/mmkin-2.png | Bin 0 -> 113464 bytes docs/dev/reference/mmkin-3.png | Bin 0 -> 100817 bytes docs/dev/reference/mmkin-4.png | Bin 0 -> 70430 bytes docs/dev/reference/mmkin-5.png | Bin 0 -> 66959 bytes docs/dev/reference/mmkin.html | 271 +++++ docs/dev/reference/nafta-1.png | Bin 0 -> 41379 bytes docs/dev/reference/nafta.html | 283 ++++++ docs/dev/reference/nlme-1.png | Bin 0 -> 71631 bytes docs/dev/reference/nlme.html | 281 ++++++ docs/dev/reference/nlme.mmkin-1.png | Bin 0 -> 81816 bytes docs/dev/reference/nlme.mmkin-2.png | Bin 0 -> 82384 bytes docs/dev/reference/nlme.mmkin-3.png | Bin 0 -> 82591 bytes docs/dev/reference/nlme.mmkin-4.png | Bin 0 -> 86006 bytes docs/dev/reference/nlme.mmkin-5.png | Bin 0 -> 85418 bytes docs/dev/reference/nlme.mmkin-6.png | Bin 0 -> 84796 bytes docs/dev/reference/nlme.mmkin-7.png | Bin 0 -> 84926 bytes docs/dev/reference/nlme.mmkin.html | 463 +++++++++ docs/dev/reference/nobs.mkinfit.html | 197 ++++ docs/dev/reference/parms.html | 292 ++++++ docs/dev/reference/plot.mkinfit-1.png | Bin 0 -> 53973 bytes docs/dev/reference/plot.mkinfit-2.png | Bin 0 -> 75079 bytes docs/dev/reference/plot.mkinfit-3.png | Bin 0 -> 70266 bytes docs/dev/reference/plot.mkinfit-4.png | Bin 0 -> 74166 bytes docs/dev/reference/plot.mkinfit-5.png | Bin 0 -> 68692 bytes docs/dev/reference/plot.mkinfit-6.png | Bin 0 -> 75012 bytes docs/dev/reference/plot.mkinfit-7.png | Bin 0 -> 75692 bytes docs/dev/reference/plot.mkinfit.html | 379 +++++++ docs/dev/reference/plot.mmkin-1.png | Bin 0 -> 34273 bytes docs/dev/reference/plot.mmkin-2.png | Bin 0 -> 34629 bytes docs/dev/reference/plot.mmkin-3.png | Bin 0 -> 32259 bytes docs/dev/reference/plot.mmkin-4.png | Bin 0 -> 25550 bytes docs/dev/reference/plot.mmkin-5.png | Bin 0 -> 38129 bytes docs/dev/reference/plot.mmkin.html | 287 ++++++ docs/dev/reference/plot.nafta.html | 210 ++++ docs/dev/reference/plot.nlme.mmkin-1.png | Bin 0 -> 35382 bytes docs/dev/reference/plot.nlme.mmkin-2.png | Bin 0 -> 35346 bytes docs/dev/reference/plot.nlme.mmkin.html | 275 +++++ docs/dev/reference/print.mkinds.html | 194 ++++ docs/dev/reference/print.mkinmod.html | 217 ++++ docs/dev/reference/reexports.html | 190 ++++ docs/dev/reference/residuals.mkinfit.html | 204 ++++ docs/dev/reference/saemix-1.png | Bin 0 -> 31551 bytes docs/dev/reference/saemix-2.png | Bin 0 -> 58815 bytes docs/dev/reference/saemix.html | 446 +++++++++ docs/dev/reference/schaefer07_complex_case-1.png | Bin 0 -> 67741 bytes docs/dev/reference/schaefer07_complex_case.html | 239 +++++ docs/dev/reference/sigma_twocomp.html | 219 ++++ docs/dev/reference/summary.mkinfit.html | 337 +++++++ .../reference/synthetic_data_for_UBA_2014-1.png | Bin 0 -> 70430 bytes .../dev/reference/synthetic_data_for_UBA_2014.html | 470 +++++++++ docs/dev/reference/test_data_from_UBA_2014-1.png | Bin 0 -> 59294 bytes docs/dev/reference/test_data_from_UBA_2014-2.png | Bin 0 -> 78194 bytes docs/dev/reference/test_data_from_UBA_2014.html | 251 +++++ docs/dev/reference/transform_odeparms.html | 319 ++++++ docs/dev/reference/update.mkinfit-1.png | Bin 0 -> 28678 bytes docs/dev/reference/update.mkinfit-2.png | Bin 0 -> 28541 bytes docs/dev/reference/update.mkinfit.html | 214 ++++ docs/dev/sitemap.xml | 222 +++++ vignettes/web_only/mkin_benchmarks.rda | Bin 856 -> 929 bytes 187 files changed, 24660 insertions(+), 1 deletion(-) create mode 100644 docs/dev/404.html create mode 100644 docs/dev/articles/FOCUS_D.html create mode 100644 docs/dev/articles/FOCUS_D_files/figure-html/plot-1.png create mode 100644 docs/dev/articles/FOCUS_D_files/figure-html/plot_2-1.png create mode 100644 docs/dev/articles/FOCUS_L.html create mode 100644 docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-10-1.png create mode 100644 docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-12-1.png create mode 100644 docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-13-1.png create mode 100644 docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-15-1.png create mode 100644 docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-4-1.png create mode 100644 docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-5-1.png create mode 100644 docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-6-1.png create mode 100644 docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-8-1.png create mode 100644 docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-9-1.png create mode 100644 docs/dev/articles/index.html create mode 100644 docs/dev/articles/mkin.html create mode 100644 docs/dev/articles/mkin_files/figure-html/unnamed-chunk-2-1.png create mode 100644 docs/dev/articles/twa.html create mode 100644 docs/dev/articles/web_only/FOCUS_Z.html create mode 100644 docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png create mode 100644 docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png create mode 100644 docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png create mode 100644 docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png create mode 100644 docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png create mode 100644 docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png create mode 100644 docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png create mode 100644 docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png create mode 100644 docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png create mode 100644 docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png create mode 100644 docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples.html create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p10-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p11-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p12a-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p12b-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p13-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p14-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p15a-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p15b-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p16-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p5a-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p5b-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p6-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p7-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p8-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p9a-1.png create mode 100644 docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p9b-1.png create mode 100644 docs/dev/articles/web_only/benchmarks.html create mode 100644 docs/dev/articles/web_only/compiled_models.html create mode 100644 docs/dev/authors.html create mode 100644 docs/dev/bootstrap-toc.css create mode 100644 docs/dev/bootstrap-toc.js create mode 100644 docs/dev/docsearch.css create mode 100644 docs/dev/docsearch.js create mode 100644 docs/dev/index.html create mode 100644 docs/dev/link.svg create mode 100644 docs/dev/news/index.html create mode 100644 docs/dev/pkgdown.css create mode 100644 docs/dev/pkgdown.js create mode 100644 docs/dev/pkgdown.yml create mode 100644 docs/dev/reference/AIC.mmkin.html create mode 100644 docs/dev/reference/CAKE_export.html create mode 100644 docs/dev/reference/DFOP.solution-1.png create mode 100644 docs/dev/reference/DFOP.solution.html create mode 100644 docs/dev/reference/Extract.mmkin.html create mode 100644 docs/dev/reference/FOCUS_2006_DFOP_ref_A_to_B.html create mode 100644 docs/dev/reference/FOCUS_2006_FOMC_ref_A_to_F.html create mode 100644 docs/dev/reference/FOCUS_2006_HS_ref_A_to_F.html create mode 100644 docs/dev/reference/FOCUS_2006_SFO_ref_A_to_F.html create mode 100644 docs/dev/reference/FOCUS_2006_datasets.html create mode 100644 docs/dev/reference/FOMC.solution-1.png create mode 100644 docs/dev/reference/FOMC.solution.html create mode 100644 docs/dev/reference/HS.solution-1.png create mode 100644 docs/dev/reference/HS.solution.html create mode 100644 docs/dev/reference/IORE.solution-1.png create mode 100644 docs/dev/reference/IORE.solution.html create mode 100644 docs/dev/reference/NAFTA_SOP_2015-1.png create mode 100644 docs/dev/reference/NAFTA_SOP_2015.html create mode 100644 docs/dev/reference/NAFTA_SOP_Attachment-1.png create mode 100644 docs/dev/reference/NAFTA_SOP_Attachment.html create mode 100644 docs/dev/reference/SFO.solution-1.png create mode 100644 docs/dev/reference/SFO.solution.html create mode 100644 docs/dev/reference/SFORB.solution-1.png create mode 100644 docs/dev/reference/SFORB.solution.html create mode 100644 docs/dev/reference/add_err-1.png create mode 100644 docs/dev/reference/add_err-2.png create mode 100644 docs/dev/reference/add_err-3.png create mode 100644 docs/dev/reference/add_err.html create mode 100644 docs/dev/reference/aw.html create mode 100644 docs/dev/reference/confint.mkinfit.html create mode 100644 docs/dev/reference/create_deg_func.html create mode 100644 docs/dev/reference/endpoints.html create mode 100644 docs/dev/reference/experimental_data_for_UBA-1.png create mode 100644 docs/dev/reference/experimental_data_for_UBA.html create mode 100644 docs/dev/reference/get_deg_func.html create mode 100644 docs/dev/reference/ilr.html create mode 100644 docs/dev/reference/index.html create mode 100644 docs/dev/reference/loftest-1.png create mode 100644 docs/dev/reference/loftest-2.png create mode 100644 docs/dev/reference/loftest-3.png create mode 100644 docs/dev/reference/loftest-4.png create mode 100644 docs/dev/reference/loftest-5.png create mode 100644 docs/dev/reference/loftest.html create mode 100644 docs/dev/reference/logLik.mkinfit.html create mode 100644 docs/dev/reference/logistic.solution-1.png create mode 100644 docs/dev/reference/logistic.solution-2.png create mode 100644 docs/dev/reference/logistic.solution.html create mode 100644 docs/dev/reference/lrtest.mkinfit.html create mode 100644 docs/dev/reference/max_twa_parent.html create mode 100644 docs/dev/reference/mccall81_245T.html create mode 100644 docs/dev/reference/mkin_long_to_wide.html create mode 100644 docs/dev/reference/mkin_wide_to_long.html create mode 100644 docs/dev/reference/mkinds.html create mode 100644 docs/dev/reference/mkinerrmin.html create mode 100644 docs/dev/reference/mkinerrplot-1.png create mode 100644 docs/dev/reference/mkinerrplot.html create mode 100644 docs/dev/reference/mkinfit.html create mode 100644 docs/dev/reference/mkinmod.html create mode 100644 docs/dev/reference/mkinparplot-1.png create mode 100644 docs/dev/reference/mkinparplot.html create mode 100644 docs/dev/reference/mkinplot.html create mode 100644 docs/dev/reference/mkinpredict.html create mode 100644 docs/dev/reference/mkinresplot-1.png create mode 100644 docs/dev/reference/mkinresplot.html create mode 100644 docs/dev/reference/mkinsub.html create mode 100644 docs/dev/reference/mmkin-1.png create mode 100644 docs/dev/reference/mmkin-2.png create mode 100644 docs/dev/reference/mmkin-3.png create mode 100644 docs/dev/reference/mmkin-4.png create mode 100644 docs/dev/reference/mmkin-5.png create mode 100644 docs/dev/reference/mmkin.html create mode 100644 docs/dev/reference/nafta-1.png create mode 100644 docs/dev/reference/nafta.html create mode 100644 docs/dev/reference/nlme-1.png create mode 100644 docs/dev/reference/nlme.html create mode 100644 docs/dev/reference/nlme.mmkin-1.png create mode 100644 docs/dev/reference/nlme.mmkin-2.png create mode 100644 docs/dev/reference/nlme.mmkin-3.png create mode 100644 docs/dev/reference/nlme.mmkin-4.png create mode 100644 docs/dev/reference/nlme.mmkin-5.png create mode 100644 docs/dev/reference/nlme.mmkin-6.png create mode 100644 docs/dev/reference/nlme.mmkin-7.png create mode 100644 docs/dev/reference/nlme.mmkin.html create mode 100644 docs/dev/reference/nobs.mkinfit.html create mode 100644 docs/dev/reference/parms.html create mode 100644 docs/dev/reference/plot.mkinfit-1.png create mode 100644 docs/dev/reference/plot.mkinfit-2.png create mode 100644 docs/dev/reference/plot.mkinfit-3.png create mode 100644 docs/dev/reference/plot.mkinfit-4.png create mode 100644 docs/dev/reference/plot.mkinfit-5.png create mode 100644 docs/dev/reference/plot.mkinfit-6.png create mode 100644 docs/dev/reference/plot.mkinfit-7.png create mode 100644 docs/dev/reference/plot.mkinfit.html create mode 100644 docs/dev/reference/plot.mmkin-1.png create mode 100644 docs/dev/reference/plot.mmkin-2.png create mode 100644 docs/dev/reference/plot.mmkin-3.png create mode 100644 docs/dev/reference/plot.mmkin-4.png create mode 100644 docs/dev/reference/plot.mmkin-5.png create mode 100644 docs/dev/reference/plot.mmkin.html create mode 100644 docs/dev/reference/plot.nafta.html create mode 100644 docs/dev/reference/plot.nlme.mmkin-1.png create mode 100644 docs/dev/reference/plot.nlme.mmkin-2.png create mode 100644 docs/dev/reference/plot.nlme.mmkin.html create mode 100644 docs/dev/reference/print.mkinds.html create mode 100644 docs/dev/reference/print.mkinmod.html create mode 100644 docs/dev/reference/reexports.html create mode 100644 docs/dev/reference/residuals.mkinfit.html create mode 100644 docs/dev/reference/saemix-1.png create mode 100644 docs/dev/reference/saemix-2.png create mode 100644 docs/dev/reference/saemix.html create mode 100644 docs/dev/reference/schaefer07_complex_case-1.png create mode 100644 docs/dev/reference/schaefer07_complex_case.html create mode 100644 docs/dev/reference/sigma_twocomp.html create mode 100644 docs/dev/reference/summary.mkinfit.html create mode 100644 docs/dev/reference/synthetic_data_for_UBA_2014-1.png create mode 100644 docs/dev/reference/synthetic_data_for_UBA_2014.html create mode 100644 docs/dev/reference/test_data_from_UBA_2014-1.png create mode 100644 docs/dev/reference/test_data_from_UBA_2014-2.png create mode 100644 docs/dev/reference/test_data_from_UBA_2014.html create mode 100644 docs/dev/reference/transform_odeparms.html create mode 100644 docs/dev/reference/update.mkinfit-1.png create mode 100644 docs/dev/reference/update.mkinfit-2.png create mode 100644 docs/dev/reference/update.mkinfit.html create mode 100644 docs/dev/sitemap.xml diff --git a/README.md b/README.md index bb26fc66..cd6eb5c7 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The R package **mkin** provides calculation routines for the analysis of chemical degradation data, including multicompartment kinetics as needed for modelling the formation and decline of transformation products, or -if several compartments are involved. +if several degradation compartments are involved. ## Installation diff --git a/_pkgdown.yml b/_pkgdown.yml index 8c5122e6..02cc34a8 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -2,6 +2,9 @@ url: https://pkgdown.jrwb.de/mkin title: mkin +development: + mode: devel + template: bootswatch: spacelab diff --git a/docs/dev/404.html b/docs/dev/404.html new file mode 100644 index 00000000..535f64b6 --- /dev/null +++ b/docs/dev/404.html @@ -0,0 +1,175 @@ + + + + + + + + +Page not found (404) • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + +Content not found. Please use links in the navbar. + +
+ + + +
+ + + +
+ + +
+

Site built with pkgdown 1.5.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/dev/articles/FOCUS_D.html b/docs/dev/articles/FOCUS_D.html new file mode 100644 index 00000000..0b3ae03a --- /dev/null +++ b/docs/dev/articles/FOCUS_D.html @@ -0,0 +1,330 @@ + + + + + + + +Example evaluation of FOCUS Example Dataset D • mkin + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +

This is just a very simple vignette showing how to fit a degradation model for a parent compound with one transformation product using mkin. After loading the library we look at the data. We have observed concentrations in the column named value at the times specified in column time for the two observed variables named parent and m1.

+
library(mkin, quietly = TRUE)
+print(FOCUS_2006_D)
+
##      name time  value
+## 1  parent    0  99.46
+## 2  parent    0 102.04
+## 3  parent    1  93.50
+## 4  parent    1  92.50
+## 5  parent    3  63.23
+## 6  parent    3  68.99
+## 7  parent    7  52.32
+## 8  parent    7  55.13
+## 9  parent   14  27.27
+## 10 parent   14  26.64
+## 11 parent   21  11.50
+## 12 parent   21  11.64
+## 13 parent   35   2.85
+## 14 parent   35   2.91
+## 15 parent   50   0.69
+## 16 parent   50   0.63
+## 17 parent   75   0.05
+## 18 parent   75   0.06
+## 19 parent  100     NA
+## 20 parent  100     NA
+## 21 parent  120     NA
+## 22 parent  120     NA
+## 23     m1    0   0.00
+## 24     m1    0   0.00
+## 25     m1    1   4.84
+## 26     m1    1   5.64
+## 27     m1    3  12.91
+## 28     m1    3  12.96
+## 29     m1    7  22.97
+## 30     m1    7  24.47
+## 31     m1   14  41.69
+## 32     m1   14  33.21
+## 33     m1   21  44.37
+## 34     m1   21  46.44
+## 35     m1   35  41.22
+## 36     m1   35  37.95
+## 37     m1   50  41.19
+## 38     m1   50  40.01
+## 39     m1   75  40.09
+## 40     m1   75  33.85
+## 41     m1  100  31.04
+## 42     m1  100  33.13
+## 43     m1  120  25.15
+## 44     m1  120  33.31
+

Next we specify the degradation model: The parent compound degrades with simple first-order kinetics (SFO) to one metabolite named m1, which also degrades with SFO kinetics.

+

The call to mkinmod returns a degradation model. The differential equations represented in R code can be found in the character vector $diffs of the mkinmod object. If a C compiler (gcc) is installed and functional, the differential equation model will be compiled from auto-generated C code.

+
SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
+
## Successfully compiled differential equation model from auto-generated C code.
+
print(SFO_SFO$diffs)
+
##                                                    parent 
+##                          "d_parent = - k_parent * parent" 
+##                                                        m1 
+## "d_m1 = + f_parent_to_m1 * k_parent * parent - k_m1 * m1"
+

We do the fitting without progress report (quiet = TRUE).

+
fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
+
## Warning in mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE): Observations with value
+## of zero were removed from the data
+

A plot of the fit including a residual plot for both observed variables is obtained using the plot_sep method for mkinfit objects, which shows separate graphs for all compounds and their residuals.

+
plot_sep(fit, lpos = c("topright", "bottomright"))
+

+

Confidence intervals for the parameter estimates are obtained using the mkinparplot function.

+ +

+

A comprehensive report of the results is obtained using the summary method for mkinfit objects.

+
summary(fit)
+
## mkin version used for fitting:    0.9.50.3 
+## R version used for fitting:       4.0.0 
+## Date of fit:     Wed May 27 06:02:21 2020 
+## Date of summary: Wed May 27 06:02:21 2020 
+## 
+## Equations:
+## d_parent/dt = - k_parent * parent
+## d_m1/dt = + f_parent_to_m1 * k_parent * parent - k_m1 * m1
+## 
+## Model predictions using solution type analytical 
+## 
+## Fitted using 421 model solutions performed in 0.177 s
+## 
+## Error model: Constant variance 
+## 
+## Error model algorithm: OLS 
+## 
+## Starting values for parameters to be optimised:
+##                   value   type
+## parent_0       100.7500  state
+## k_parent         0.1000 deparm
+## k_m1             0.1001 deparm
+## f_parent_to_m1   0.5000 deparm
+## 
+## Starting values for the transformed parameters actually optimised:
+##                     value lower upper
+## parent_0       100.750000  -Inf   Inf
+## log_k_parent    -2.302585  -Inf   Inf
+## log_k_m1        -2.301586  -Inf   Inf
+## f_parent_ilr_1   0.000000  -Inf   Inf
+## 
+## Fixed parameter values:
+##      value  type
+## m1_0     0 state
+## 
+## Results:
+## 
+##        AIC      BIC    logLik
+##   204.4486 212.6365 -97.22429
+## 
+## Optimised, transformed parameters with symmetric confidence intervals:
+##                Estimate Std. Error    Lower    Upper
+## parent_0       99.60000    1.57000 96.40000 102.8000
+## log_k_parent   -2.31600    0.04087 -2.39900  -2.2330
+## log_k_m1       -5.24800    0.13320 -5.51800  -4.9770
+## f_parent_ilr_1  0.04096    0.06312 -0.08746   0.1694
+## sigma           3.12600    0.35850  2.39600   3.8550
+## 
+## Parameter correlation:
+##                  parent_0 log_k_parent   log_k_m1 f_parent_ilr_1      sigma
+## parent_0        1.000e+00    5.174e-01 -1.688e-01     -5.471e-01 -3.190e-07
+## log_k_parent    5.174e-01    1.000e+00 -3.263e-01     -5.426e-01  3.168e-07
+## log_k_m1       -1.688e-01   -3.263e-01  1.000e+00      7.478e-01 -1.406e-07
+## f_parent_ilr_1 -5.471e-01   -5.426e-01  7.478e-01      1.000e+00 -1.587e-10
+## sigma          -3.190e-07    3.168e-07 -1.406e-07     -1.587e-10  1.000e+00
+## 
+## Backtransformed parameters:
+## Confidence intervals for internally transformed parameters are asymmetric.
+## t-test (unrealistically) based on the assumption of normal distribution
+## for estimators of untransformed parameters.
+##                 Estimate t value    Pr(>t)     Lower     Upper
+## parent_0       99.600000  63.430 2.298e-36 96.400000 1.028e+02
+## k_parent        0.098700  24.470 4.955e-23  0.090820 1.073e-01
+## k_m1            0.005261   7.510 6.165e-09  0.004012 6.898e-03
+## f_parent_to_m1  0.514500  23.070 3.104e-22  0.469100 5.596e-01
+## sigma           3.126000   8.718 2.235e-10  2.396000 3.855e+00
+## 
+## FOCUS Chi2 error levels in percent:
+##          err.min n.optim df
+## All data   6.398       4 15
+## parent     6.459       2  7
+## m1         4.690       2  8
+## 
+## Resulting formation fractions:
+##                 ff
+## parent_m1   0.5145
+## parent_sink 0.4855
+## 
+## Estimated disappearance times:
+##           DT50   DT90
+## parent   7.023  23.33
+## m1     131.761 437.70
+## 
+## Data:
+##  time variable observed predicted   residual
+##     0   parent    99.46  99.59848 -1.385e-01
+##     0   parent   102.04  99.59848  2.442e+00
+##     1   parent    93.50  90.23787  3.262e+00
+##     1   parent    92.50  90.23787  2.262e+00
+##     3   parent    63.23  74.07319 -1.084e+01
+##     3   parent    68.99  74.07319 -5.083e+00
+##     7   parent    52.32  49.91206  2.408e+00
+##     7   parent    55.13  49.91206  5.218e+00
+##    14   parent    27.27  25.01257  2.257e+00
+##    14   parent    26.64  25.01257  1.627e+00
+##    21   parent    11.50  12.53462 -1.035e+00
+##    21   parent    11.64  12.53462 -8.946e-01
+##    35   parent     2.85   3.14787 -2.979e-01
+##    35   parent     2.91   3.14787 -2.379e-01
+##    50   parent     0.69   0.71624 -2.624e-02
+##    50   parent     0.63   0.71624 -8.624e-02
+##    75   parent     0.05   0.06074 -1.074e-02
+##    75   parent     0.06   0.06074 -7.381e-04
+##     1       m1     4.84   4.80296  3.704e-02
+##     1       m1     5.64   4.80296  8.370e-01
+##     3       m1    12.91  13.02400 -1.140e-01
+##     3       m1    12.96  13.02400 -6.400e-02
+##     7       m1    22.97  25.04476 -2.075e+00
+##     7       m1    24.47  25.04476 -5.748e-01
+##    14       m1    41.69  36.69002  5.000e+00
+##    14       m1    33.21  36.69002 -3.480e+00
+##    21       m1    44.37  41.65310  2.717e+00
+##    21       m1    46.44  41.65310  4.787e+00
+##    35       m1    41.22  43.31312 -2.093e+00
+##    35       m1    37.95  43.31312 -5.363e+00
+##    50       m1    41.19  41.21831 -2.831e-02
+##    50       m1    40.01  41.21831 -1.208e+00
+##    75       m1    40.09  36.44703  3.643e+00
+##    75       m1    33.85  36.44703 -2.597e+00
+##   100       m1    31.04  31.98163 -9.416e-01
+##   100       m1    33.13  31.98163  1.148e+00
+##   120       m1    25.15  28.78984 -3.640e+00
+##   120       m1    33.31  28.78984  4.520e+00
+
+ + + +
+ + + +
+ +
+

Site built with pkgdown 1.5.1.

+
+ +
+
+ + + + + + diff --git a/docs/dev/articles/FOCUS_D_files/figure-html/plot-1.png b/docs/dev/articles/FOCUS_D_files/figure-html/plot-1.png new file mode 100644 index 00000000..306244b3 Binary files /dev/null and b/docs/dev/articles/FOCUS_D_files/figure-html/plot-1.png differ diff --git a/docs/dev/articles/FOCUS_D_files/figure-html/plot_2-1.png b/docs/dev/articles/FOCUS_D_files/figure-html/plot_2-1.png new file mode 100644 index 00000000..158e3c50 Binary files /dev/null and b/docs/dev/articles/FOCUS_D_files/figure-html/plot_2-1.png differ diff --git a/docs/dev/articles/FOCUS_L.html b/docs/dev/articles/FOCUS_L.html new file mode 100644 index 00000000..91043d0f --- /dev/null +++ b/docs/dev/articles/FOCUS_L.html @@ -0,0 +1,797 @@ + + + + + + + +Example evaluation of FOCUS Laboratory Data L1 to L3 • mkin + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +
+

+Laboratory Data L1

+

The following code defines example dataset L1 from the FOCUS kinetics report, p. 284:

+
library("mkin", quietly = TRUE)
+FOCUS_2006_L1 = data.frame(
+  t = rep(c(0, 1, 2, 3, 5, 7, 14, 21, 30), each = 2),
+  parent = c(88.3, 91.4, 85.6, 84.5, 78.9, 77.6,
+             72.0, 71.9, 50.3, 59.4, 47.0, 45.1,
+             27.7, 27.3, 10.0, 10.4, 2.9, 4.0))
+FOCUS_2006_L1_mkin <- mkin_wide_to_long(FOCUS_2006_L1)
+

Here we use the assumptions of simple first order (SFO), the case of declining rate constant over time (FOMC) and the case of two different phases of the kinetics (DFOP). For a more detailed discussion of the models, please see the FOCUS kinetics report.

+

Since mkin version 0.9-32 (July 2014), we can use shorthand notation like "SFO" for parent only degradation models. The following two lines fit the model and produce the summary report of the model fit. This covers the numerical analysis given in the FOCUS report.

+
m.L1.SFO <- mkinfit("SFO", FOCUS_2006_L1_mkin, quiet = TRUE)
+summary(m.L1.SFO)
+
## mkin version used for fitting:    0.9.50.3 
+## R version used for fitting:       4.0.0 
+## Date of fit:     Wed May 27 06:02:23 2020 
+## Date of summary: Wed May 27 06:02:23 2020 
+## 
+## Equations:
+## d_parent/dt = - k_parent_sink * parent
+## 
+## Model predictions using solution type analytical 
+## 
+## Fitted using 133 model solutions performed in 0.03 s
+## 
+## Error model: Constant variance 
+## 
+## Error model algorithm: OLS 
+## 
+## Starting values for parameters to be optimised:
+##               value   type
+## parent_0      89.85  state
+## k_parent_sink  0.10 deparm
+## 
+## Starting values for the transformed parameters actually optimised:
+##                       value lower upper
+## parent_0          89.850000  -Inf   Inf
+## log_k_parent_sink -2.302585  -Inf   Inf
+## 
+## Fixed parameter values:
+## None
+## 
+## Results:
+## 
+##        AIC     BIC    logLik
+##   93.88778 96.5589 -43.94389
+## 
+## Optimised, transformed parameters with symmetric confidence intervals:
+##                   Estimate Std. Error  Lower  Upper
+## parent_0            92.470    1.28200 89.740 95.200
+## log_k_parent_sink   -2.347    0.03763 -2.428 -2.267
+## sigma                2.780    0.46330  1.792  3.767
+## 
+## Parameter correlation:
+##                     parent_0 log_k_parent_sink      sigma
+## parent_0           1.000e+00         6.186e-01 -1.712e-09
+## log_k_parent_sink  6.186e-01         1.000e+00 -3.237e-09
+## sigma             -1.712e-09        -3.237e-09  1.000e+00
+## 
+## Backtransformed parameters:
+## Confidence intervals for internally transformed parameters are asymmetric.
+## t-test (unrealistically) based on the assumption of normal distribution
+## for estimators of untransformed parameters.
+##               Estimate t value    Pr(>t)    Lower   Upper
+## parent_0      92.47000   72.13 8.824e-21 89.74000 95.2000
+## k_parent_sink  0.09561   26.57 2.487e-14  0.08824  0.1036
+## sigma          2.78000    6.00 1.216e-05  1.79200  3.7670
+## 
+## FOCUS Chi2 error levels in percent:
+##          err.min n.optim df
+## All data   3.424       2  7
+## parent     3.424       2  7
+## 
+## Estimated disappearance times:
+##         DT50  DT90
+## parent 7.249 24.08
+## 
+## Data:
+##  time variable observed predicted residual
+##     0   parent     88.3    92.471  -4.1710
+##     0   parent     91.4    92.471  -1.0710
+##     1   parent     85.6    84.039   1.5610
+##     1   parent     84.5    84.039   0.4610
+##     2   parent     78.9    76.376   2.5241
+##     2   parent     77.6    76.376   1.2241
+##     3   parent     72.0    69.412   2.5884
+##     3   parent     71.9    69.412   2.4884
+##     5   parent     50.3    57.330  -7.0301
+##     5   parent     59.4    57.330   2.0699
+##     7   parent     47.0    47.352  -0.3515
+##     7   parent     45.1    47.352  -2.2515
+##    14   parent     27.7    24.247   3.4528
+##    14   parent     27.3    24.247   3.0528
+##    21   parent     10.0    12.416  -2.4163
+##    21   parent     10.4    12.416  -2.0163
+##    30   parent      2.9     5.251  -2.3513
+##    30   parent      4.0     5.251  -1.2513
+

A plot of the fit is obtained with the plot function for mkinfit objects.

+
plot(m.L1.SFO, show_errmin = TRUE, main = "FOCUS L1 - SFO")
+

+

The residual plot can be easily obtained by

+
mkinresplot(m.L1.SFO, ylab = "Observed", xlab = "Time")
+

+

For comparison, the FOMC model is fitted as well, and the \(\chi^2\) error level is checked.

+
m.L1.FOMC <- mkinfit("FOMC", FOCUS_2006_L1_mkin, quiet=TRUE)
+
## Warning in mkinfit("FOMC", FOCUS_2006_L1_mkin, quiet = TRUE): Optimisation did not converge:
+## false convergence (8)
+
plot(m.L1.FOMC, show_errmin = TRUE, main = "FOCUS L1 - FOMC")
+

+
summary(m.L1.FOMC, data = FALSE)
+
## Warning in sqrt(diag(covar)): NaNs produced
+
## Warning in sqrt(1/diag(V)): NaNs produced
+
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
+## doubtful
+
## mkin version used for fitting:    0.9.50.3 
+## R version used for fitting:       4.0.0 
+## Date of fit:     Wed May 27 06:02:24 2020 
+## Date of summary: Wed May 27 06:02:24 2020 
+## 
+## 
+## Warning: Optimisation did not converge:
+## false convergence (8) 
+## 
+## 
+## Equations:
+## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
+## 
+## Model predictions using solution type analytical 
+## 
+## Fitted using 899 model solutions performed in 0.204 s
+## 
+## Error model: Constant variance 
+## 
+## Error model algorithm: OLS 
+## 
+## Starting values for parameters to be optimised:
+##          value   type
+## parent_0 89.85  state
+## alpha     1.00 deparm
+## beta     10.00 deparm
+## 
+## Starting values for the transformed parameters actually optimised:
+##               value lower upper
+## parent_0  89.850000  -Inf   Inf
+## log_alpha  0.000000  -Inf   Inf
+## log_beta   2.302585  -Inf   Inf
+## 
+## Fixed parameter values:
+## None
+## 
+## Results:
+## 
+##        AIC      BIC    logLik
+##   95.88835 99.44984 -43.94418
+## 
+## Optimised, transformed parameters with symmetric confidence intervals:
+##           Estimate Std. Error  Lower  Upper
+## parent_0     92.47     1.2800 89.730 95.220
+## log_alpha    10.58        NaN    NaN    NaN
+## log_beta     12.93        NaN    NaN    NaN
+## sigma         2.78     0.4507  1.813  3.747
+## 
+## Parameter correlation:
+##           parent_0 log_alpha log_beta   sigma
+## parent_0   1.00000       NaN      NaN 0.01452
+## log_alpha      NaN         1      NaN     NaN
+## log_beta       NaN       NaN        1     NaN
+## sigma      0.01452       NaN      NaN 1.00000
+## 
+## Backtransformed parameters:
+## Confidence intervals for internally transformed parameters are asymmetric.
+## t-test (unrealistically) based on the assumption of normal distribution
+## for estimators of untransformed parameters.
+##           Estimate  t value    Pr(>t)  Lower  Upper
+## parent_0     92.47 72.13000 1.052e-19 89.730 95.220
+## alpha     39440.00  0.02397 4.906e-01     NA     NA
+## beta     412500.00  0.02397 4.906e-01     NA     NA
+## sigma         2.78  6.00000 1.628e-05  1.813  3.747
+## 
+## FOCUS Chi2 error levels in percent:
+##          err.min n.optim df
+## All data   3.619       3  6
+## parent     3.619       3  6
+## 
+## Estimated disappearance times:
+##         DT50  DT90 DT50back
+## parent 7.249 24.08    7.249
+

We get a warning that the default optimisation algorithm Port did not converge, which is an indication that the model is overparameterised, i.e. contains too many parameters that are ill-defined as a consequence.

+

And in fact, due to the higher number of parameters, and the lower number of degrees of freedom of the fit, the \(\chi^2\) error level is actually higher for the FOMC model (3.6%) than for the SFO model (3.4%). Additionally, the parameters log_alpha and log_beta internally fitted in the model have excessive confidence intervals, that span more than 25 orders of magnitude (!) when backtransformed to the scale of alpha and beta. Also, the t-test for significant difference from zero does not indicate such a significant difference, with p-values greater than 0.1, and finally, the parameter correlation of log_alpha and log_beta is 1.000, clearly indicating that the model is overparameterised.

+

The \(\chi^2\) error levels reported in Appendix 3 and Appendix 7 to the FOCUS kinetics report are rounded to integer percentages and partly deviate by one percentage point from the results calculated by mkin. The reason for this is not known. However, mkin gives the same \(\chi^2\) error levels as the kinfit package and the calculation routines of the kinfit package have been extensively compared to the results obtained by the KinGUI software, as documented in the kinfit package vignette. KinGUI was the first widely used standard package in this field. Also, the calculation of \(\chi^2\) error levels was compared with KinGUII, CAKE and DegKin manager in a project sponsored by the German Umweltbundesamt (Ranke 2014).

+
+
+

+Laboratory Data L2

+

The following code defines example dataset L2 from the FOCUS kinetics report, p. 287:

+
FOCUS_2006_L2 = data.frame(
+  t = rep(c(0, 1, 3, 7, 14, 28), each = 2),
+  parent = c(96.1, 91.8, 41.4, 38.7,
+             19.3, 22.3, 4.6, 4.6,
+             2.6, 1.2, 0.3, 0.6))
+FOCUS_2006_L2_mkin <- mkin_wide_to_long(FOCUS_2006_L2)
+
+

+SFO fit for L2

+

Again, the SFO model is fitted and the result is plotted. The residual plot can be obtained simply by adding the argument show_residuals to the plot command.

+
m.L2.SFO <- mkinfit("SFO", FOCUS_2006_L2_mkin, quiet=TRUE)
+plot(m.L2.SFO, show_residuals = TRUE, show_errmin = TRUE,
+     main = "FOCUS L2 - SFO")
+

+

The \(\chi^2\) error level of 14% suggests that the model does not fit very well. This is also obvious from the plots of the fit, in which we have included the residual plot.

+

In the FOCUS kinetics report, it is stated that there is no apparent systematic error observed from the residual plot up to the measured DT90 (approximately at day 5), and there is an underestimation beyond that point.

+

We may add that it is difficult to judge the random nature of the residuals just from the three samplings at days 0, 1 and 3. Also, it is not clear a priori why a consistent underestimation after the approximate DT90 should be irrelevant. However, this can be rationalised by the fact that the FOCUS fate models generally only implement SFO kinetics.

+
+
+

+FOMC fit for L2

+

For comparison, the FOMC model is fitted as well, and the \(\chi^2\) error level is checked.

+
m.L2.FOMC <- mkinfit("FOMC", FOCUS_2006_L2_mkin, quiet = TRUE)
+plot(m.L2.FOMC, show_residuals = TRUE,
+     main = "FOCUS L2 - FOMC")
+

+
summary(m.L2.FOMC, data = FALSE)
+
## mkin version used for fitting:    0.9.50.3 
+## R version used for fitting:       4.0.0 
+## Date of fit:     Wed May 27 06:02:24 2020 
+## Date of summary: Wed May 27 06:02:24 2020 
+## 
+## Equations:
+## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
+## 
+## Model predictions using solution type analytical 
+## 
+## Fitted using 239 model solutions performed in 0.047 s
+## 
+## Error model: Constant variance 
+## 
+## Error model algorithm: OLS 
+## 
+## Starting values for parameters to be optimised:
+##          value   type
+## parent_0 93.95  state
+## alpha     1.00 deparm
+## beta     10.00 deparm
+## 
+## Starting values for the transformed parameters actually optimised:
+##               value lower upper
+## parent_0  93.950000  -Inf   Inf
+## log_alpha  0.000000  -Inf   Inf
+## log_beta   2.302585  -Inf   Inf
+## 
+## Fixed parameter values:
+## None
+## 
+## Results:
+## 
+##        AIC      BIC    logLik
+##   61.78966 63.72928 -26.89483
+## 
+## Optimised, transformed parameters with symmetric confidence intervals:
+##           Estimate Std. Error    Lower   Upper
+## parent_0   93.7700     1.6130 90.05000 97.4900
+## log_alpha   0.3180     0.1559 -0.04149  0.6776
+## log_beta    0.2102     0.2493 -0.36460  0.7850
+## sigma       2.2760     0.4645  1.20500  3.3470
+## 
+## Parameter correlation:
+##             parent_0  log_alpha   log_beta      sigma
+## parent_0   1.000e+00 -1.151e-01 -2.085e-01 -7.637e-09
+## log_alpha -1.151e-01  1.000e+00  9.741e-01 -1.617e-07
+## log_beta  -2.085e-01  9.741e-01  1.000e+00 -1.387e-07
+## sigma     -7.637e-09 -1.617e-07 -1.387e-07  1.000e+00
+## 
+## Backtransformed parameters:
+## Confidence intervals for internally transformed parameters are asymmetric.
+## t-test (unrealistically) based on the assumption of normal distribution
+## for estimators of untransformed parameters.
+##          Estimate t value    Pr(>t)   Lower  Upper
+## parent_0   93.770  58.120 4.267e-12 90.0500 97.490
+## alpha       1.374   6.414 1.030e-04  0.9594  1.969
+## beta        1.234   4.012 1.942e-03  0.6945  2.192
+## sigma       2.276   4.899 5.977e-04  1.2050  3.347
+## 
+## FOCUS Chi2 error levels in percent:
+##          err.min n.optim df
+## All data   6.205       3  3
+## parent     6.205       3  3
+## 
+## Estimated disappearance times:
+##          DT50  DT90 DT50back
+## parent 0.8092 5.356    1.612
+

The error level at which the \(\chi^2\) test passes is much lower in this case. Therefore, the FOMC model provides a better description of the data, as less experimental error has to be assumed in order to explain the data.

+
+
+

+DFOP fit for L2

+

Fitting the four parameter DFOP model further reduces the \(\chi^2\) error level.

+
m.L2.DFOP <- mkinfit("DFOP", FOCUS_2006_L2_mkin, quiet = TRUE)
+plot(m.L2.DFOP, show_residuals = TRUE, show_errmin = TRUE,
+     main = "FOCUS L2 - DFOP")
+

+
summary(m.L2.DFOP, data = FALSE)
+
## mkin version used for fitting:    0.9.50.3 
+## R version used for fitting:       4.0.0 
+## Date of fit:     Wed May 27 06:02:24 2020 
+## Date of summary: Wed May 27 06:02:24 2020 
+## 
+## Equations:
+## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
+##            time)) / (g * exp(-k1 * time) + (1 - g) * exp(-k2 * time)))
+##            * parent
+## 
+## Model predictions using solution type analytical 
+## 
+## Fitted using 572 model solutions performed in 0.131 s
+## 
+## Error model: Constant variance 
+## 
+## Error model algorithm: OLS 
+## 
+## Starting values for parameters to be optimised:
+##          value   type
+## parent_0 93.95  state
+## k1        0.10 deparm
+## k2        0.01 deparm
+## g         0.50 deparm
+## 
+## Starting values for the transformed parameters actually optimised:
+##              value lower upper
+## parent_0 93.950000  -Inf   Inf
+## log_k1   -2.302585  -Inf   Inf
+## log_k2   -4.605170  -Inf   Inf
+## g_ilr     0.000000  -Inf   Inf
+## 
+## Fixed parameter values:
+## None
+## 
+## Results:
+## 
+##        AIC      BIC    logLik
+##   52.36695 54.79148 -21.18347
+## 
+## Optimised, transformed parameters with symmetric confidence intervals:
+##          Estimate Std. Error      Lower     Upper
+## parent_0  93.9500  9.998e-01    91.5900   96.3100
+## log_k1     3.1370  2.376e+03 -5616.0000 5622.0000
+## log_k2    -1.0880  6.285e-02    -1.2370   -0.9394
+## g_ilr     -0.2821  7.033e-02    -0.4484   -0.1158
+## sigma      1.4140  2.886e-01     0.7314    2.0960
+## 
+## Parameter correlation:
+##            parent_0     log_k1     log_k2      g_ilr      sigma
+## parent_0  1.000e+00  5.155e-07  2.371e-09  2.665e-01 -6.849e-09
+## log_k1    5.155e-07  1.000e+00  8.434e-05 -1.659e-04 -7.791e-06
+## log_k2    2.371e-09  8.434e-05  1.000e+00 -7.903e-01 -1.262e-08
+## g_ilr     2.665e-01 -1.659e-04 -7.903e-01  1.000e+00  3.241e-08
+## sigma    -6.849e-09 -7.791e-06 -1.262e-08  3.241e-08  1.000e+00
+## 
+## Backtransformed parameters:
+## Confidence intervals for internally transformed parameters are asymmetric.
+## t-test (unrealistically) based on the assumption of normal distribution
+## for estimators of untransformed parameters.
+##          Estimate   t value    Pr(>t)   Lower   Upper
+## parent_0  93.9500 9.397e+01 2.036e-12 91.5900 96.3100
+## k1        23.0400 4.303e-04 4.998e-01  0.0000     Inf
+## k2         0.3369 1.591e+01 4.697e-07  0.2904  0.3909
+## g          0.4016 1.680e+01 3.238e-07  0.3466  0.4591
+## sigma      1.4140 4.899e+00 8.776e-04  0.7314  2.0960
+## 
+## FOCUS Chi2 error levels in percent:
+##          err.min n.optim df
+## All data    2.53       4  2
+## parent      2.53       4  2
+## 
+## Estimated disappearance times:
+##          DT50  DT90 DT50_k1 DT50_k2
+## parent 0.5335 5.311 0.03009   2.058
+

Here, the DFOP model is clearly the best-fit model for dataset L2 based on the chi^2 error level criterion. However, the failure to calculate the covariance matrix indicates that the parameter estimates correlate excessively. Therefore, the FOMC model may be preferred for this dataset.

+
+
+
+

+Laboratory Data L3

+

The following code defines example dataset L3 from the FOCUS kinetics report, p. 290.

+
FOCUS_2006_L3 = data.frame(
+  t = c(0, 3, 7, 14, 30, 60, 91, 120),
+  parent = c(97.8, 60, 51, 43, 35, 22, 15, 12))
+FOCUS_2006_L3_mkin <- mkin_wide_to_long(FOCUS_2006_L3)
+
+

+Fit multiple models

+

As of mkin version 0.9-39 (June 2015), we can fit several models to one or more datasets in one call to the function mmkin. The datasets have to be passed in a list, in this case a named list holding only the L3 dataset prepared above.

+
# Only use one core here, not to offend the CRAN checks
+mm.L3 <- mmkin(c("SFO", "FOMC", "DFOP"), cores = 1,
+               list("FOCUS L3" = FOCUS_2006_L3_mkin), quiet = TRUE)
+plot(mm.L3)
+

+

The \(\chi^2\) error level of 21% as well as the plot suggest that the SFO model does not fit very well. The FOMC model performs better, with an error level at which the \(\chi^2\) test passes of 7%. Fitting the four parameter DFOP model further reduces the \(\chi^2\) error level considerably.

+
+
+

+Accessing mmkin objects

+

The objects returned by mmkin are arranged like a matrix, with models as a row index and datasets as a column index.

+

We can extract the summary and plot for e.g. the DFOP fit, using square brackets for indexing which will result in the use of the summary and plot functions working on mkinfit objects.

+
summary(mm.L3[["DFOP", 1]])
+
## mkin version used for fitting:    0.9.50.3 
+## R version used for fitting:       4.0.0 
+## Date of fit:     Wed May 27 06:02:25 2020 
+## Date of summary: Wed May 27 06:02:25 2020 
+## 
+## Equations:
+## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
+##            time)) / (g * exp(-k1 * time) + (1 - g) * exp(-k2 * time)))
+##            * parent
+## 
+## Model predictions using solution type analytical 
+## 
+## Fitted using 373 model solutions performed in 0.08 s
+## 
+## Error model: Constant variance 
+## 
+## Error model algorithm: OLS 
+## 
+## Starting values for parameters to be optimised:
+##          value   type
+## parent_0 97.80  state
+## k1        0.10 deparm
+## k2        0.01 deparm
+## g         0.50 deparm
+## 
+## Starting values for the transformed parameters actually optimised:
+##              value lower upper
+## parent_0 97.800000  -Inf   Inf
+## log_k1   -2.302585  -Inf   Inf
+## log_k2   -4.605170  -Inf   Inf
+## g_ilr     0.000000  -Inf   Inf
+## 
+## Fixed parameter values:
+## None
+## 
+## Results:
+## 
+##        AIC      BIC    logLik
+##   32.97732 33.37453 -11.48866
+## 
+## Optimised, transformed parameters with symmetric confidence intervals:
+##          Estimate Std. Error   Lower      Upper
+## parent_0  97.7500    1.01900 94.5000 101.000000
+## log_k1    -0.6612    0.10050 -0.9812  -0.341300
+## log_k2    -4.2860    0.04322 -4.4230  -4.148000
+## g_ilr     -0.1229    0.03727 -0.2415  -0.004343
+## sigma      1.0170    0.25430  0.2079   1.827000
+## 
+## Parameter correlation:
+##            parent_0     log_k1     log_k2      g_ilr      sigma
+## parent_0  1.000e+00  1.732e-01  2.282e-02  4.009e-01 -6.872e-07
+## log_k1    1.732e-01  1.000e+00  4.945e-01 -5.809e-01  3.200e-07
+## log_k2    2.282e-02  4.945e-01  1.000e+00 -6.812e-01  7.673e-07
+## g_ilr     4.009e-01 -5.809e-01 -6.812e-01  1.000e+00 -8.731e-07
+## sigma    -6.872e-07  3.200e-07  7.673e-07 -8.731e-07  1.000e+00
+## 
+## Backtransformed parameters:
+## Confidence intervals for internally transformed parameters are asymmetric.
+## t-test (unrealistically) based on the assumption of normal distribution
+## for estimators of untransformed parameters.
+##          Estimate t value    Pr(>t)    Lower     Upper
+## parent_0 97.75000  95.960 1.248e-06 94.50000 101.00000
+## k1        0.51620   9.947 1.081e-03  0.37490   0.71090
+## k2        0.01376  23.140 8.840e-05  0.01199   0.01579
+## g         0.45660  34.920 2.581e-05  0.41540   0.49850
+## sigma     1.01700   4.000 1.400e-02  0.20790   1.82700
+## 
+## FOCUS Chi2 error levels in percent:
+##          err.min n.optim df
+## All data   2.225       4  4
+## parent     2.225       4  4
+## 
+## Estimated disappearance times:
+##         DT50 DT90 DT50_k1 DT50_k2
+## parent 7.464  123   1.343   50.37
+## 
+## Data:
+##  time variable observed predicted residual
+##     0   parent     97.8     97.75  0.05396
+##     3   parent     60.0     60.45 -0.44933
+##     7   parent     51.0     49.44  1.56338
+##    14   parent     43.0     43.84 -0.83632
+##    30   parent     35.0     35.15 -0.14707
+##    60   parent     22.0     23.26 -1.25919
+##    91   parent     15.0     15.18 -0.18181
+##   120   parent     12.0     10.19  1.81395
+
plot(mm.L3[["DFOP", 1]], show_errmin = TRUE)
+

+

Here, a look to the model plot, the confidence intervals of the parameters and the correlation matrix suggest that the parameter estimates are reliable, and the DFOP model can be used as the best-fit model based on the \(\chi^2\) error level criterion for laboratory data L3.

+

This is also an example where the standard t-test for the parameter g_ilr is misleading, as it tests for a significant difference from zero. In this case, zero appears to be the correct value for this parameter, and the confidence interval for the backtransformed parameter g is quite narrow.

+
+
+
+

+Laboratory Data L4

+

The following code defines example dataset L4 from the FOCUS kinetics report, p. 293:

+
FOCUS_2006_L4 = data.frame(
+  t = c(0, 3, 7, 14, 30, 60, 91, 120),
+  parent = c(96.6, 96.3, 94.3, 88.8, 74.9, 59.9, 53.5, 49.0))
+FOCUS_2006_L4_mkin <- mkin_wide_to_long(FOCUS_2006_L4)
+

Fits of the SFO and FOMC models, plots and summaries are produced below:

+
# Only use one core here, not to offend the CRAN checks
+mm.L4 <- mmkin(c("SFO", "FOMC"), cores = 1,
+               list("FOCUS L4" = FOCUS_2006_L4_mkin),
+               quiet = TRUE)
+plot(mm.L4)
+

+

The \(\chi^2\) error level of 3.3% as well as the plot suggest that the SFO model fits very well. The error level at which the \(\chi^2\) test passes is slightly lower for the FOMC model. However, the difference appears negligible.

+
summary(mm.L4[["SFO", 1]], data = FALSE)
+
## mkin version used for fitting:    0.9.50.3 
+## R version used for fitting:       4.0.0 
+## Date of fit:     Wed May 27 06:02:25 2020 
+## Date of summary: Wed May 27 06:02:26 2020 
+## 
+## Equations:
+## d_parent/dt = - k_parent_sink * parent
+## 
+## Model predictions using solution type analytical 
+## 
+## Fitted using 142 model solutions performed in 0.029 s
+## 
+## Error model: Constant variance 
+## 
+## Error model algorithm: OLS 
+## 
+## Starting values for parameters to be optimised:
+##               value   type
+## parent_0       96.6  state
+## k_parent_sink   0.1 deparm
+## 
+## Starting values for the transformed parameters actually optimised:
+##                       value lower upper
+## parent_0          96.600000  -Inf   Inf
+## log_k_parent_sink -2.302585  -Inf   Inf
+## 
+## Fixed parameter values:
+## None
+## 
+## Results:
+## 
+##        AIC      BIC    logLik
+##   47.12133 47.35966 -20.56067
+## 
+## Optimised, transformed parameters with symmetric confidence intervals:
+##                   Estimate Std. Error  Lower   Upper
+## parent_0            96.440    1.69900 92.070 100.800
+## log_k_parent_sink   -5.030    0.07059 -5.211  -4.848
+## sigma                3.162    0.79050  1.130   5.194
+## 
+## Parameter correlation:
+##                    parent_0 log_k_parent_sink     sigma
+## parent_0          1.000e+00         5.938e-01 3.440e-07
+## log_k_parent_sink 5.938e-01         1.000e+00 5.885e-07
+## sigma             3.440e-07         5.885e-07 1.000e+00
+## 
+## Backtransformed parameters:
+## Confidence intervals for internally transformed parameters are asymmetric.
+## t-test (unrealistically) based on the assumption of normal distribution
+## for estimators of untransformed parameters.
+##                Estimate t value    Pr(>t)     Lower     Upper
+## parent_0      96.440000   56.77 1.604e-08 92.070000 1.008e+02
+## k_parent_sink  0.006541   14.17 1.578e-05  0.005455 7.842e-03
+## sigma          3.162000    4.00 5.162e-03  1.130000 5.194e+00
+## 
+## FOCUS Chi2 error levels in percent:
+##          err.min n.optim df
+## All data   3.287       2  6
+## parent     3.287       2  6
+## 
+## Estimated disappearance times:
+##        DT50 DT90
+## parent  106  352
+
summary(mm.L4[["FOMC", 1]], data = FALSE)
+
## mkin version used for fitting:    0.9.50.3 
+## R version used for fitting:       4.0.0 
+## Date of fit:     Wed May 27 06:02:25 2020 
+## Date of summary: Wed May 27 06:02:26 2020 
+## 
+## Equations:
+## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent
+## 
+## Model predictions using solution type analytical 
+## 
+## Fitted using 224 model solutions performed in 0.043 s
+## 
+## Error model: Constant variance 
+## 
+## Error model algorithm: OLS 
+## 
+## Starting values for parameters to be optimised:
+##          value   type
+## parent_0  96.6  state
+## alpha      1.0 deparm
+## beta      10.0 deparm
+## 
+## Starting values for the transformed parameters actually optimised:
+##               value lower upper
+## parent_0  96.600000  -Inf   Inf
+## log_alpha  0.000000  -Inf   Inf
+## log_beta   2.302585  -Inf   Inf
+## 
+## Fixed parameter values:
+## None
+## 
+## Results:
+## 
+##        AIC      BIC    logLik
+##   40.37255 40.69032 -16.18628
+## 
+## Optimised, transformed parameters with symmetric confidence intervals:
+##           Estimate Std. Error   Lower    Upper
+## parent_0   99.1400     1.2670 95.6300 102.7000
+## log_alpha  -0.3506     0.2616 -1.0770   0.3756
+## log_beta    4.1740     0.3938  3.0810   5.2670
+## sigma       1.8300     0.4575  0.5598   3.1000
+## 
+## Parameter correlation:
+##             parent_0  log_alpha   log_beta      sigma
+## parent_0   1.000e+00 -4.696e-01 -5.543e-01 -2.563e-07
+## log_alpha -4.696e-01  1.000e+00  9.889e-01  4.066e-08
+## log_beta  -5.543e-01  9.889e-01  1.000e+00  6.818e-08
+## sigma     -2.563e-07  4.066e-08  6.818e-08  1.000e+00
+## 
+## Backtransformed parameters:
+## Confidence intervals for internally transformed parameters are asymmetric.
+## t-test (unrealistically) based on the assumption of normal distribution
+## for estimators of untransformed parameters.
+##          Estimate t value    Pr(>t)   Lower   Upper
+## parent_0  99.1400  78.250 7.993e-08 95.6300 102.700
+## alpha      0.7042   3.823 9.365e-03  0.3407   1.456
+## beta      64.9800   2.540 3.201e-02 21.7800 193.900
+## sigma      1.8300   4.000 8.065e-03  0.5598   3.100
+## 
+## FOCUS Chi2 error levels in percent:
+##          err.min n.optim df
+## All data   2.029       3  5
+## parent     2.029       3  5
+## 
+## Estimated disappearance times:
+##         DT50 DT90 DT50back
+## parent 108.9 1644    494.9
+
+
+

+References

+
+
+

Ranke, Johannes. 2014. “Prüfung und Validierung von Modellierungssoftware als Alternative zu ModelMaker 4.0.” Umweltbundesamt Projektnummer 27452.

+
+
+
+
+ + + +
+ + + +
+ +
+

Site built with pkgdown 1.5.1.

+
+ +
+
+ + + + + + diff --git a/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-10-1.png b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-10-1.png new file mode 100644 index 00000000..88d03d24 Binary files /dev/null and b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-10-1.png differ diff --git a/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-12-1.png b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-12-1.png new file mode 100644 index 00000000..f23a4c97 Binary files /dev/null and b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-12-1.png differ diff --git a/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-13-1.png b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-13-1.png new file mode 100644 index 00000000..ed6a781d Binary files /dev/null and b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-13-1.png differ diff --git a/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-15-1.png b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-15-1.png new file mode 100644 index 00000000..2e5071d9 Binary files /dev/null and b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-15-1.png differ diff --git a/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-4-1.png b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-4-1.png new file mode 100644 index 00000000..04bee502 Binary files /dev/null and b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-4-1.png differ diff --git a/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-5-1.png b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-5-1.png new file mode 100644 index 00000000..86af1cf9 Binary files /dev/null and b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-5-1.png differ diff --git a/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-6-1.png b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-6-1.png new file mode 100644 index 00000000..16235059 Binary files /dev/null and b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-6-1.png differ diff --git a/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-8-1.png b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-8-1.png new file mode 100644 index 00000000..8b39f0fc Binary files /dev/null and b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-8-1.png differ diff --git a/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-9-1.png b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-9-1.png new file mode 100644 index 00000000..13019224 Binary files /dev/null and b/docs/dev/articles/FOCUS_L_files/figure-html/unnamed-chunk-9-1.png differ diff --git a/docs/dev/articles/index.html b/docs/dev/articles/index.html new file mode 100644 index 00000000..3d5dd360 --- /dev/null +++ b/docs/dev/articles/index.html @@ -0,0 +1,188 @@ + + + + + + + + +Articles • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ + + + +
+ + +
+

Site built with pkgdown 1.5.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/dev/articles/mkin.html b/docs/dev/articles/mkin.html new file mode 100644 index 00000000..2dd6dcb8 --- /dev/null +++ b/docs/dev/articles/mkin.html @@ -0,0 +1,261 @@ + + + + + + + +Introduction to mkin • mkin + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +

Wissenschaftlicher Berater, Kronacher Str. 12, 79639 Grenzach-Wyhlen, Germany
Privatdozent at the University of Bremen

+
+

+Abstract

+

In the regulatory evaluation of chemical substances like plant protection products (pesticides), biocides and other chemicals, degradation data play an important role. For the evaluation of pesticide degradation experiments, detailed guidance has been developed, based on nonlinear optimisation. The R add-on package mkin implements fitting some of the models recommended in this guidance from within R and calculates some statistical measures for data series within one or more compartments, for parent and metabolites.

+
library("mkin", quietly = TRUE)
+# Define the kinetic model
+m_SFO_SFO_SFO <- mkinmod(parent = mkinsub("SFO", "M1"),
+                         M1 = mkinsub("SFO", "M2"),
+                         M2 = mkinsub("SFO"),
+                         use_of_ff = "max", quiet = TRUE)
+
+
+# Produce model predictions using some arbitrary parameters
+sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120)
+d_SFO_SFO_SFO <- mkinpredict(m_SFO_SFO_SFO,
+  c(k_parent = 0.03,
+    f_parent_to_M1 = 0.5, k_M1 = log(2)/100,
+    f_M1_to_M2 = 0.9, k_M2 = log(2)/50),
+  c(parent = 100, M1 = 0, M2 = 0),
+  sampling_times)
+
+# Generate a dataset by adding normally distributed errors with
+# standard deviation 3, for two replicates at each sampling time
+d_SFO_SFO_SFO_err <- add_err(d_SFO_SFO_SFO, reps = 2,
+                             sdfunc = function(x) 3,
+                             n = 1, seed = 123456789 )
+
+# Fit the model to the dataset
+f_SFO_SFO_SFO <- mkinfit(m_SFO_SFO_SFO, d_SFO_SFO_SFO_err[[1]], quiet = TRUE)
+
+# Plot the results separately for parent and metabolites
+plot_sep(f_SFO_SFO_SFO, lpos = c("topright", "bottomright", "bottomright"))
+

+
+
+

+Background

+

Many approaches are possible regarding the evaluation of chemical degradation data.

+

The mkin package (Ranke 2019) implements the approach recommended in the kinetics report provided by the FOrum for Co-ordination of pesticide fate models and their USe (FOCUS Work Group on Degradation Kinetics 2006, 2014) for simple decline data series, data series with transformation products, commonly termed metabolites, and for data series for more than one compartment. It is also possible to include back reactions, so equilibrium reactions and equilibrium partitioning can be specified, although this oftentimes leads to an overparameterisation of the model.

+

When the first mkin code was published in 2010, the most commonly used tools for fitting more complex kinetic degradation models to experimental data were KinGUI (Schäfer et al. 2007), a MATLAB based tool with a graphical user interface that was specifically tailored to the task and included some output as proposed by the FOCUS Kinetics Workgroup, and ModelMaker, a general purpose compartment based tool providing infrastructure for fitting dynamic simulation models based on differential equations to data.

+

The code was first uploaded to the BerliOS platform. When this was taken down, the version control history was imported into the R-Forge site (see e.g. the initial commit on 11 May 2010), where the code is still occasionally updated.

+

At that time, the R package FME (Flexible Modelling Environment) (Soetaert and Petzoldt 2010) was already available, and provided a good basis for developing a package specifically tailored to the task. The remaining challenge was to make it as easy as possible for the users (including the author of this vignette) to specify the system of differential equations and to include the output requested by the FOCUS guidance, such as the relative standard deviation that has to be assumed for the residuals, such that the \(\chi^2\) goodness-of-fit test as defined by the FOCUS kinetics workgroup would pass using an significance level \(\alpha\) of 0.05. This relative error, expressed as a percentage, is often termed \(\chi^2\) error level or similar.

+

Also, mkin introduced using analytical solutions for parent only kinetics for improved optimization speed. Later, Eigenvalue based solutions were introduced to mkin for the case of linear differential equations (i.e. where the FOMC or DFOP models were not used for the parent compound), greatly improving the optimization speed for these cases. This, however, has become somehow obsolete, as the use of compiled code described below gives even smaller execution times.

+

The possibility to specify back-reactions and a biphasic model (SFORB) for metabolites were present in mkin from the very beginning.

+
+

+Derived software tools

+

Soon after the publication of mkin, two derived tools were published, namely KinGUII (available from Bayer Crop Science) and CAKE (commissioned to Tessella by Syngenta), which added a graphical user interface (GUI), and added fitting by iteratively reweighted least squares (IRLS) and characterisation of likely parameter distributions by Markov Chain Monte Carlo (MCMC) sampling.

+

CAKE focuses on a smooth use experience, sacrificing some flexibility in the model definition, originally allowing only two primary metabolites in parallel. The current version 3.3 of CAKE release in March 2016 uses a basic scheme for up to six metabolites in a flexible arrangement, but does not support back-reactions (non-instantaneous equilibria) or biphasic kinetics for metabolites.

+

KinGUI offers an even more flexible widget for specifying complex kinetic models. Back-reactions (non-instantaneous equilibria) were supported early on, but until 2014, only simple first-order models could be specified for transformation products. Starting with KinGUII version 2.1, biphasic modelling of metabolites was also available in KinGUII.

+

A further graphical user interface (GUI) that has recently been brought to a decent degree of maturity is the browser based GUI named gmkin. Please see its documentation page and manual for further information.

+

A comparison of scope, usability and numerical results obtained with these tools has been recently been published by Ranke, Wöltjen, and Meinecke (2018).

+
+
+

+Recent developments

+

Currently (July 2019), the main features available in mkin which are not present in KinGUII or CAKE, are the speed increase by using compiled code when a compiler is present, parallel model fitting on multicore machines using the mmkin function, and the estimation of parameter confidence intervals based on transformed parameters.

+

In addition, the possibility to use two alternative error models to constant variance have been integrated. The variance by variable error model introduced by Gao et al. (2011) has been available via an iteratively reweighted least squares (IRLS) procedure since mkin version 0.9-22. With release 0.9.49.5, the IRLS algorithm has been replaced by direct or step-wise maximisation of the likelihood function, which makes it possible not only to fit the variance by variable error model but also a two-component error model inspired by error models developed in analytical chemistry.

+
+
+
+

+Internal parameter transformations

+

For rate constants, the log transformation is used, as proposed by Bates and Watts (1988, 77, 149). Approximate intervals are constructed for the transformed rate constants (compare Bates and Watts 1988, 135), i.e. for their logarithms. Confidence intervals for the rate constants are then obtained using the appropriate backtransformation using the exponential function.

+

In the first version of mkin allowing for specifying models using formation fractions, a home-made reparameterisation was used in order to ensure that the sum of formation fractions would not exceed unity.

+

This method is still used in the current version of KinGUII (v2.1 from April 2014), with a modification that allows for fixing the pathway to sink to zero. CAKE uses penalties in the objective function in order to enforce this constraint.

+

In 2012, an alternative reparameterisation of the formation fractions was proposed together with René Lehmann (Ranke and Lehmann 2012), based on isometric logratio transformation (ILR). The aim was to improve the validity of the linear approximation of the objective function during the parameter estimation procedure as well as in the subsequent calculation of parameter confidence intervals.

+
+

+Confidence intervals based on transformed parameters

+

In the first attempt at providing improved parameter confidence intervals introduced to mkin in 2013, confidence intervals obtained from FME on the transformed parameters were simply all backtransformed one by one to yield asymmetric confidence intervals for the backtransformed parameters.

+

However, while there is a 1:1 relation between the rate constants in the model and the transformed parameters fitted in the model, the parameters obtained by the isometric logratio transformation are calculated from the set of formation fractions that quantify the paths to each of the compounds formed from a specific parent compound, and no such 1:1 relation exists.

+

Therefore, parameter confidence intervals for formation fractions obtained with this method only appear valid for the case of a single transformation product, where only one formation fraction is to be estimated, directly corresponding to one component of the ilr transformed parameter.

+

The confidence intervals obtained by backtransformation for the cases where a 1:1 relation between transformed and original parameter exist are considered by the author of this vignette to be more accurate than those obtained using a re-estimation of the Hessian matrix after backtransformation, as implemented in the FME package.

+
+
+

+Parameter t-test based on untransformed parameters

+

The standard output of many nonlinear regression software packages includes the results from a test for significant difference from zero for all parameters. Such a test is also recommended to check the validity of rate constants in the FOCUS guidance (FOCUS Work Group on Degradation Kinetics 2014, 96ff).

+

It has been argued that the precondition for this test, i.e. normal distribution of the estimator for the parameters, is not fulfilled in the case of nonlinear regression (Ranke and Lehmann 2015). However, this test is commonly used by industry, consultants and national authorities in order to decide on the reliability of parameter estimates, based on the FOCUS guidance mentioned above. Therefore, the results of this one-sided t-test are included in the summary output from mkin.

+

As it is not reasonable to test for significant difference of the transformed parameters (e.g. \(log(k)\)) from zero, the t-test is calculated based on the model definition before parameter transformation, i.e. in a similar way as in packages that do not apply such an internal parameter transformation. A note is included in the mkin output, pointing to the fact that the t-test is based on the unjustified assumption of normal distribution of the parameter estimators.

+
+
+
+

+References

+ +
+
+

Bates, D., and D. Watts. 1988. Nonlinear Regression and Its Applications. Wiley-Interscience.

+
+
+

FOCUS Work Group on Degradation Kinetics. 2006. Guidance Document on Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in Eu Registration. Report of the Focus Work Group on Degradation Kinetics. http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics.

+
+
+

———. 2014. Generic Guidance for Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in Eu Registration. 1.1 ed. http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics.

+
+
+

Gao, Z., J.W. Green, J. Vanderborght, and W. Schmitt. 2011. “Improving Uncertainty Analysis in Kinetic Evaluations Using Iteratively Reweighted Least Squares.” Journal. Environmental Science and Technology 45: 4429–37.

+
+
+

Ranke, J. 2019. ‘mkin‘: Kinetic Evaluation of Chemical Degradation Data. https://CRAN.R-project.org/package=mkin.

+
+
+

Ranke, J., and R. Lehmann. 2012. “Parameter Reliability in Kinetic Evaluation of Environmental Metabolism Data - Assessment and the Influence of Model Specification.” In SETAC World 20-24 May. Berlin.

+
+
+

———. 2015. “To T-Test or Not to T-Test, That Is the Question.” In XV Symposium on Pesticide Chemistry 2-4 September 2015. Piacenza. http://chem.uft.uni-bremen.de/ranke/posters/piacenza_2015.pdf.

+
+
+

Ranke, Johannes, Janina Wöltjen, and Stefan Meinecke. 2018. “Comparison of Software Tools for Kinetic Evaluation of Chemical Degradation Data.” Environmental Sciences Europe 30 (1): 17. https://doi.org/10.1186/s12302-018-0145-1.

+
+
+

Schäfer, D., B. Mikolasch, P. Rainbird, and B. Harvey. 2007. “KinGUI: A New Kinetic Software Tool for Evaluations According to FOCUS Degradation Kinetics.” In Proceedings of the Xiii Symposium Pesticide Chemistry, edited by Del Re A. A. M., Capri E., Fragoulis G., and Trevisan M., 916–23. Piacenza.

+
+
+

Soetaert, Karline, and Thomas Petzoldt. 2010. “Inverse Modelling, Sensitivity and Monte Carlo Analysis in R Using Package FME.” Journal of Statistical Software 33 (3): 1–28. http://www.jstatsoft.org/v33/i03/.

+
+
+
+
+ + + +
+ + + +
+ +
+

Site built with pkgdown 1.5.1.

+
+ +
+
+ + + + + + diff --git a/docs/dev/articles/mkin_files/figure-html/unnamed-chunk-2-1.png b/docs/dev/articles/mkin_files/figure-html/unnamed-chunk-2-1.png new file mode 100644 index 00000000..62ea16f2 Binary files /dev/null and b/docs/dev/articles/mkin_files/figure-html/unnamed-chunk-2-1.png differ diff --git a/docs/dev/articles/twa.html b/docs/dev/articles/twa.html new file mode 100644 index 00000000..d4754a1f --- /dev/null +++ b/docs/dev/articles/twa.html @@ -0,0 +1,175 @@ + + + + + + + +Calculation of time weighted average concentrations with mkin • mkin + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +

Since version 0.9.45.1 of the ‘mkin’ package, a function for calculating time weighted average concentrations for decline kinetics (i.e. only for the compound applied in the experiment) is included. Strictly speaking, they are maximum moving window time weighted average concentrations, i.e. the maximum time weighted average concentration that can be found when moving a time window of a specified width over the decline curve.

+

Time weighted average concentrations for the SFO, FOMC and the DFOP model are calculated using the formulas given in the FOCUS kinetics guidance (FOCUS Work Group on Degradation Kinetics 2014, 251):

+

SFO:

+

\[c_\textrm{twa} = c_0 \frac{\left( 1 - e^{- k t} \right)}{ k t} \]

+

FOMC:

+

\[c_\textrm{twa} = c_0 \frac{\beta}{t (1 - \alpha)} + \left( \left(\frac{t}{\beta} + 1 \right)^{1 - \alpha} - 1 \right) \]

+

DFOP:

+

\[c_\textrm{twa} = \frac{c_0}{t} \left( + \frac{g}{k_1} \left( 1 - e^{- k_1 t} \right) + + \frac{1-g}{k_2} \left( 1 - e^{- k_2 t} \right) \right) \]

+

HS for \(t > t_b\):

+

\[c_\textrm{twa} = \frac{c_0}{t} \left( + \frac{1}{k_1} \left( 1 - e^{- k_1 t_b} \right) + + \frac{e^{- k_1 t_b}}{k_2} \left( 1 - e^{- k_2 (t - t_b)} \right) \right) \]

+

Often, the ratio between the time weighted average concentration \(c_\textrm{twa}\) and the initial concentration \(c_0\)

+

\[f_\textrm{twa} = \frac{c_\textrm{twa}}{c_0}\]

+

is needed. This can be calculated from the fitted initial concentration \(c_0\) and the time weighted average concentration \(c_\textrm{twa}\), or directly from the model parameters using the following formulas:

+

SFO:

+

\[f_\textrm{twa} = \frac{\left( 1 - e^{- k t} \right)}{k t} \]

+

FOMC:

+

\[f_\textrm{twa} = \frac{\beta}{t (1 - \alpha)} + \left( \left(\frac{t}{\beta} + 1 \right)^{1 - \alpha} - 1 \right) \]

+

DFOP:

+

\[f_\textrm{twa} = \frac{1}{t} \left( + \frac{g}{k_1} \left( 1 - e^{- k_1 t} \right) + + \frac{1-g}{k_2} \left( 1 - e^{- k_2 t} \right) \right) \]

+

HS for \(t > t_b\):

+

\[f_\textrm{twa} = \frac{1}{t} \left( + \frac{1}{k_1} \left( 1 - e^{- k_1 t_b} \right) + + \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 a model fitted by ‘mkinfit’ or from parent decline model parameters is included in the max_twa_parent() function. If the same is needed for metabolites, the function pfm::max_twa() from the ‘pfm’ package can be used.

+
+
+

FOCUS Work Group on Degradation Kinetics. 2014. Generic Guidance for Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in Eu Registration. 1.1 ed. http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics.

+
+
+
+ + + +
+ + + +
+ +
+

Site built with pkgdown 1.5.1.

+
+ +
+
+ + + + + + diff --git a/docs/dev/articles/web_only/FOCUS_Z.html b/docs/dev/articles/web_only/FOCUS_Z.html new file mode 100644 index 00000000..7fca4e49 --- /dev/null +++ b/docs/dev/articles/web_only/FOCUS_Z.html @@ -0,0 +1,364 @@ + + + + + + + +Example evaluation of FOCUS dataset Z • mkin + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +

Wissenschaftlicher Berater, Kronacher Str. 12, 79639 Grenzach-Wyhlen, Germany
Privatdozent at the University of Bremen

+
+

+The data

+

The following code defines the example dataset from Appendix 7 to the FOCUS kinetics report (FOCUS Work Group on Degradation Kinetics 2014, 354).

+
library(mkin, quietly = TRUE)
+LOD = 0.5
+FOCUS_2006_Z = data.frame(
+  t = c(0, 0.04, 0.125, 0.29, 0.54, 1, 2, 3, 4, 7, 10, 14, 21,
+        42, 61, 96, 124),
+  Z0 = c(100, 81.7, 70.4, 51.1, 41.2, 6.6, 4.6, 3.9, 4.6, 4.3, 6.8,
+         2.9, 3.5, 5.3, 4.4, 1.2, 0.7),
+  Z1 = c(0, 18.3, 29.6, 46.3, 55.1, 65.7, 39.1, 36, 15.3, 5.6, 1.1,
+         1.6, 0.6, 0.5 * LOD, NA, NA, NA),
+  Z2 = c(0, NA, 0.5 * LOD, 2.6, 3.8, 15.3, 37.2, 31.7, 35.6, 14.5,
+         0.8, 2.1, 1.9, 0.5 * LOD, NA, NA, NA),
+  Z3 = c(0, NA, NA, NA, NA, 0.5 * LOD, 9.2, 13.1, 22.3, 28.4, 32.5,
+         25.2, 17.2, 4.8, 4.5, 2.8, 4.4))
+
+FOCUS_2006_Z_mkin <- mkin_wide_to_long(FOCUS_2006_Z)
+
+
+

+Parent and one metabolite

+

The next step is to set up the models used for the kinetic analysis. As the simultaneous fit of parent and the first metabolite is usually straightforward, Step 1 (SFO for parent only) is skipped here. We start with the model 2a, with formation and decline of metabolite Z1 and the pathway from parent directly to sink included (default in mkin).

+
Z.2a <- mkinmod(Z0 = mkinsub("SFO", "Z1"),
+                Z1 = mkinsub("SFO"))
+
## Successfully compiled differential equation model from auto-generated C code.
+
m.Z.2a <- mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE)
+
## Warning in mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
+## value of zero were removed from the data
+
plot_sep(m.Z.2a)
+

+
summary(m.Z.2a, data = FALSE)$bpar
+
##            Estimate se_notrans t value     Pr(>t)    Lower    Upper
+## Z0_0       97.01488   3.301084 29.3888 3.2971e-21 91.66556 102.3642
+## k_Z0        2.23601   0.207078 10.7979 3.3309e-11  1.95303   2.5600
+## k_Z1        0.48212   0.063265  7.6207 2.8154e-08  0.40341   0.5762
+## f_Z0_to_Z1  1.00000   0.094764 10.5525 5.3560e-11  0.00000   1.0000
+## sigma       4.80411   0.635638  7.5579 3.2592e-08  3.52677   6.0815
+

As obvious from the parameter summary (the component of the summary), the kinetic rate constant from parent compound Z to sink is very small and the t-test for this parameter suggests that it is not significantly different from zero. This suggests, in agreement with the analysis in the FOCUS kinetics report, to simplify the model by removing the pathway to sink.

+

A similar result can be obtained when formation fractions are used in the model formulation:

+
Z.2a.ff <- mkinmod(Z0 = mkinsub("SFO", "Z1"),
+                   Z1 = mkinsub("SFO"),
+                   use_of_ff = "max")
+
## Successfully compiled differential equation model from auto-generated C code.
+
m.Z.2a.ff <- mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE)
+
## Warning in mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
+## value of zero were removed from the data
+
plot_sep(m.Z.2a.ff)
+

+
summary(m.Z.2a.ff, data = FALSE)$bpar
+
##            Estimate se_notrans t value     Pr(>t)    Lower    Upper
+## Z0_0       97.01488   3.301084 29.3888 3.2971e-21 91.66556 102.3642
+## k_Z0        2.23601   0.207078 10.7979 3.3309e-11  1.95303   2.5600
+## k_Z1        0.48212   0.063265  7.6207 2.8154e-08  0.40341   0.5762
+## f_Z0_to_Z1  1.00000   0.094764 10.5525 5.3560e-11  0.00000   1.0000
+## sigma       4.80411   0.635638  7.5579 3.2592e-08  3.52677   6.0815
+

Here, the ilr transformed formation fraction fitted in the model takes a very large value, and the backtransformed formation fraction from parent Z to Z1 is practically unity. Here, the covariance matrix used for the calculation of confidence intervals is not returned as the model is overparameterised.

+

A simplified model is obtained by removing the pathway to the sink.

+

In the following, we use the parameterisation with formation fractions in order to be able to compare with the results in the FOCUS guidance, and as it makes it easier to use parameters obtained in a previous fit when adding a further metabolite.

+
Z.3 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
+               Z1 = mkinsub("SFO"), use_of_ff = "max")
+
## Successfully compiled differential equation model from auto-generated C code.
+
m.Z.3 <- mkinfit(Z.3, FOCUS_2006_Z_mkin, quiet = TRUE)
+
## Warning in mkinfit(Z.3, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
+## value of zero were removed from the data
+
plot_sep(m.Z.3)
+

+
summary(m.Z.3, data = FALSE)$bpar
+
##       Estimate se_notrans t value     Pr(>t)    Lower    Upper
+## Z0_0  97.01488   2.597342  37.352 2.0106e-24 91.67597 102.3538
+## k_Z0   2.23601   0.146904  15.221 9.1477e-15  1.95354   2.5593
+## k_Z1   0.48212   0.041727  11.554 4.8268e-12  0.40355   0.5760
+## sigma  4.80411   0.620208   7.746 1.6110e-08  3.52925   6.0790
+

As there is only one transformation product for Z0 and no pathway to sink, the formation fraction is internally fixed to unity.

+
+
+

+Metabolites Z2 and Z3

+

As suggested in the FOCUS report, the pathway to sink was removed for metabolite Z1 as well in the next step. While this step appears questionable on the basis of the above results, it is followed here for the purpose of comparison. Also, in the FOCUS report, it is assumed that there is additional empirical evidence that Z1 quickly and exclusively hydrolyses to Z2.

+
Z.5 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
+               Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+               Z2 = mkinsub("SFO"), use_of_ff = "max")
+
## Successfully compiled differential equation model from auto-generated C code.
+
m.Z.5 <- mkinfit(Z.5, FOCUS_2006_Z_mkin, quiet = TRUE)
+
## Warning in mkinfit(Z.5, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
+## value of zero were removed from the data
+
plot_sep(m.Z.5)
+

+

Finally, metabolite Z3 is added to the model. We use the optimised differential equation parameter values from the previous fit in order to accelerate the optimization.

+
Z.FOCUS <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
+                   Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+                   Z2 = mkinsub("SFO", "Z3"),
+                   Z3 = mkinsub("SFO"),
+                   use_of_ff = "max")
+
## Successfully compiled differential equation model from auto-generated C code.
+
m.Z.FOCUS <- mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin,
+                     parms.ini = m.Z.5$bparms.ode,
+                     quiet = TRUE)
+
## Warning in mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin, parms.ini = m.Z.5$bparms.ode, :
+## Observations with value of zero were removed from the data
+
## Warning in mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin, parms.ini = m.Z.5$bparms.ode, : Optimisation did not converge:
+## false convergence (8)
+
plot_sep(m.Z.FOCUS)
+

+
summary(m.Z.FOCUS, data = FALSE)$bpar
+
##             Estimate se_notrans t value     Pr(>t)     Lower     Upper
+## Z0_0       96.840695   1.994285 48.5591 4.0254e-42 92.828744 100.85265
+## k_Z0        2.215467   0.118463 18.7018 1.0417e-23  1.989524   2.46707
+## k_Z1        0.478325   0.028259 16.9265 6.2441e-22  0.424725   0.53869
+## k_Z2        0.451638   0.042139 10.7177 1.6309e-14  0.374346   0.54489
+## k_Z3        0.058692   0.015245  3.8498 1.7807e-04  0.034806   0.09897
+## f_Z2_to_Z3  0.471484   0.058348  8.0805 9.6599e-11  0.357736   0.58827
+## sigma       3.984431   0.383402 10.3923 4.5576e-14  3.213126   4.75574
+
endpoints(m.Z.FOCUS)
+
## $ff
+##   Z2_Z3 Z2_sink 
+## 0.47148 0.52852 
+## 
+## $distimes
+##        DT50    DT90
+## Z0  0.31287  1.0393
+## Z1  1.44911  4.8138
+## Z2  1.53474  5.0983
+## Z3 11.80989 39.2316
+

This fit corresponds to the final result chosen in Appendix 7 of the FOCUS report. Confidence intervals returned by mkin are based on internally transformed parameters, however.

+
+
+

+Using the SFORB model

+

As the FOCUS report states, there is a certain tailing of the time course of metabolite Z3. Also, the time course of the parent compound is not fitted very well using the SFO model, as residues at a certain low level remain.

+

Therefore, an additional model is offered here, using the single first-order reversible binding (SFORB) model for metabolite Z3. As expected, the \(\chi^2\) error level is lower for metabolite Z3 using this model and the graphical fit for Z3 is improved. However, the covariance matrix is not returned.

+
Z.mkin.1 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE),
+                    Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+                    Z2 = mkinsub("SFO", "Z3"),
+                    Z3 = mkinsub("SFORB"))
+
## Successfully compiled differential equation model from auto-generated C code.
+
m.Z.mkin.1 <- mkinfit(Z.mkin.1, FOCUS_2006_Z_mkin, quiet = TRUE)
+
## Warning in mkinfit(Z.mkin.1, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
+## value of zero were removed from the data
+
plot_sep(m.Z.mkin.1)
+

+
summary(m.Z.mkin.1, data = FALSE)$cov.unscaled
+
## NULL
+

Therefore, a further stepwise model building is performed starting from the stage of parent and two metabolites, starting from the assumption that the model fit for the parent compound can be improved by using the SFORB model.

+
Z.mkin.3 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
+                    Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+                    Z2 = mkinsub("SFO"))
+
## Successfully compiled differential equation model from auto-generated C code.
+
m.Z.mkin.3 <- mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE)
+
## Warning in mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE): Observations with
+## value of zero were removed from the data
+
plot_sep(m.Z.mkin.3)
+

+

This results in a much better representation of the behaviour of the parent compound Z0.

+

Finally, Z3 is added as well. These models appear overparameterised (no covariance matrix returned) if the sink for Z1 is left in the models.

+
Z.mkin.4 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
+                    Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+                    Z2 = mkinsub("SFO", "Z3"),
+                    Z3 = mkinsub("SFO"))
+
## Successfully compiled differential equation model from auto-generated C code.
+
m.Z.mkin.4 <- mkinfit(Z.mkin.4, FOCUS_2006_Z_mkin,
+                      parms.ini = m.Z.mkin.3$bparms.ode,
+                      quiet = TRUE)
+
## Warning in mkinfit(Z.mkin.4, FOCUS_2006_Z_mkin, parms.ini = m.Z.mkin.
+## 3$bparms.ode, : Observations with value of zero were removed from the data
+
plot_sep(m.Z.mkin.4)
+

+

The error level of the fit, but especially of metabolite Z3, can be improved if the SFORB model is chosen for this metabolite, as this model is capable of representing the tailing of the metabolite decline phase.

+
Z.mkin.5 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE),
+                    Z1 = mkinsub("SFO", "Z2", sink = FALSE),
+                    Z2 = mkinsub("SFO", "Z3"),
+                    Z3 = mkinsub("SFORB"))
+
## Successfully compiled differential equation model from auto-generated C code.
+
m.Z.mkin.5 <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin,
+                      parms.ini = m.Z.mkin.4$bparms.ode[1:4],
+                      quiet = TRUE)
+
## Warning in mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin, parms.ini = m.Z.mkin.
+## 4$bparms.ode[1:4], : Observations with value of zero were removed from the data
+
plot_sep(m.Z.mkin.5)
+

+

The summary view of the backtransformed parameters shows that we get no confidence intervals due to overparameterisation. As the optimized is excessively small, it seems reasonable to fix it to zero.

+
m.Z.mkin.5a <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin,
+                       parms.ini = c(m.Z.mkin.5$bparms.ode[1:7],
+                                     k_Z3_bound_free = 0),
+                       fixed_parms = "k_Z3_bound_free",
+                       quiet = TRUE)
+
## Warning in mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin, parms.ini = c(m.Z.mkin.
+## 5$bparms.ode[1:7], : Observations with value of zero were removed from the data
+
plot_sep(m.Z.mkin.5a)
+

+

As expected, the residual plots for Z0 and Z3 are more random than in the case of the all SFO model for which they were shown above. In conclusion, the model is proposed as the best-fit model for the dataset from Appendix 7 of the FOCUS report.

+

A graphical representation of the confidence intervals can finally be obtained.

+
mkinparplot(m.Z.mkin.5a)
+

+

The endpoints obtained with this model are

+
endpoints(m.Z.mkin.5a)
+
## $ff
+## Z0_free   Z2_Z3 Z2_sink Z3_free 
+## 1.00000 0.53656 0.46344 1.00000 
+## 
+## $SFORB
+##     Z0_b1     Z0_b2     Z3_b1     Z3_b2 
+## 2.4471337 0.0075125 0.0800071 0.0000000 
+## 
+## $distimes
+##      DT50   DT90 DT50_Z0_b1 DT50_Z0_b2 DT50_Z3_b1 DT50_Z3_b2
+## Z0 0.3043 1.1848    0.28325     92.266         NA         NA
+## Z1 1.5148 5.0320         NA         NA         NA         NA
+## Z2 1.6414 5.4526         NA         NA         NA         NA
+## Z3     NA     NA         NA         NA     8.6636        Inf
+

It is clear the degradation rate of Z3 towards the end of the experiment is very low as DT50_Z3_b2 (the second Eigenvalue of the system of two differential equations representing the SFORB system for Z3, corresponding to the slower rate constant of the DFOP model) is reported to be infinity. However, this appears to be a feature of the data.

+
+
+

+References

+ +
+
+

FOCUS Work Group on Degradation Kinetics. 2014. Generic Guidance for Estimating Persistence and Degradation Kinetics from Environmental Fate Studies on Pesticides in Eu Registration. 1.1 ed. http://esdac.jrc.ec.europa.eu/projects/degradation-kinetics.

+
+
+
+
+ + + +
+ + + +
+ +
+

Site built with pkgdown 1.5.1.

+
+ +
+
+ + + + + + diff --git a/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png new file mode 100644 index 00000000..23d051ce Binary files /dev/null and b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png differ diff --git a/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png new file mode 100644 index 00000000..96738dd0 Binary files /dev/null and b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png differ diff --git a/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png new file mode 100644 index 00000000..4f3c2554 Binary files /dev/null and b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png differ diff --git a/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png new file mode 100644 index 00000000..b8c3ed26 Binary files /dev/null and b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png differ diff --git a/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png new file mode 100644 index 00000000..132a7317 Binary files /dev/null and b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png differ diff --git a/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png new file mode 100644 index 00000000..23d051ce Binary files /dev/null and b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png differ diff --git a/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png new file mode 100644 index 00000000..6e9f4efa Binary files /dev/null and b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png differ diff --git a/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png new file mode 100644 index 00000000..146acea9 Binary files /dev/null and b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png differ diff --git a/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png new file mode 100644 index 00000000..b25bf26a Binary files /dev/null and b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png differ diff --git a/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png new file mode 100644 index 00000000..7db8b07d Binary files /dev/null and b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png differ diff --git a/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png new file mode 100644 index 00000000..dd5d89cd Binary files /dev/null and b/docs/dev/articles/web_only/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples.html b/docs/dev/articles/web_only/NAFTA_examples.html new file mode 100644 index 00000000..29f4cd8b --- /dev/null +++ b/docs/dev/articles/web_only/NAFTA_examples.html @@ -0,0 +1,989 @@ + + + + + + + +Evaluation of example datasets from Attachment 1 to the US EPA SOP for the NAFTA guidance • mkin + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +
+

+Introduction

+

In this document, the example evaluations provided in Attachment 1 to the SOP of US EPA for using the NAFTA guidance (US EPA 2015) are repeated using mkin. The original evaluations reported in the attachment were performed using PestDF in version 0.8.4. Note that PestDF 0.8.13 is the version distributed at the US EPA website today (2019-02-26).

+

The datasets are now distributed with the mkin package.

+
+
+

+Examples where DFOP did not converge with PestDF 0.8.4

+

In attachment 1, it is reported that the DFOP model does not converge for these datasets when PestDF 0.8.4 was used. For all four datasets, the DFOP model can be fitted with mkin (see below). The negative half-life given by PestDF 0.8.4 for these fits appears to be the result of a bug. The results for the other two models (SFO and IORE) are the same.

+
+

+Example on page 5, upper panel

+
p5a <- nafta(NAFTA_SOP_Attachment[["p5a"]])
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p5a)
+

+
print(p5a)
+
## Sums of squares:
+##       SFO      IORE      DFOP 
+## 465.21753  56.27506  32.06401 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 64.4304
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)  Lower   Upper
+## parent_0       95.8401 4.67e-21 92.245 99.4357
+## k_parent_sink   0.0102 3.92e-12  0.009  0.0117
+## sigma           4.8230 3.81e-06  3.214  6.4318
+## 
+## $IORE
+##                     Estimate Pr(>t)    Lower    Upper
+## parent_0            1.01e+02     NA 9.91e+01 1.02e+02
+## k__iore_parent_sink 1.54e-05     NA 4.08e-06 5.84e-05
+## N_parent            2.57e+00     NA 2.25e+00 2.89e+00
+## sigma               1.68e+00     NA 1.12e+00 2.24e+00
+## 
+## $DFOP
+##          Estimate   Pr(>t)   Lower    Upper
+## parent_0 9.99e+01 1.41e-26 98.8116 101.0810
+## k1       2.67e-02 5.05e-06  0.0243   0.0295
+## k2       2.86e-12 5.00e-01  0.0000      Inf
+## g        6.47e-01 3.67e-06  0.6248   0.6677
+## sigma    1.27e+00 8.91e-06  0.8395   1.6929
+## 
+## 
+## DTx values:
+##      DT50     DT90 DT50_rep
+## SFO  67.7 2.25e+02 6.77e+01
+## IORE 58.2 1.07e+03 3.22e+02
+## DFOP 55.5 4.42e+11 2.42e+11
+## 
+## Representative half-life:
+## [1] 321.51
+
+
+

+Example on page 5, lower panel

+
p5b <- nafta(NAFTA_SOP_Attachment[["p5b"]])
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p5b)
+

+
print(p5b)
+
## Sums of squares:
+##      SFO     IORE     DFOP 
+## 94.81123 10.10936  7.55871 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 11.77879
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)    Lower    Upper
+## parent_0        96.497 2.32e-24 94.85271 98.14155
+## k_parent_sink    0.008 3.42e-14  0.00737  0.00869
+## sigma            2.295 1.22e-05  1.47976  3.11036
+## 
+## $IORE
+##                     Estimate   Pr(>t)    Lower    Upper
+## parent_0            9.85e+01 1.17e-28 9.79e+01 9.92e+01
+## k__iore_parent_sink 1.53e-04 6.50e-03 7.21e-05 3.26e-04
+## N_parent            1.94e+00 5.88e-13 1.76e+00 2.12e+00
+## sigma               7.49e-01 1.63e-05 4.82e-01 1.02e+00
+## 
+## $DFOP
+##          Estimate   Pr(>t)   Lower   Upper
+## parent_0 9.84e+01 1.24e-27 97.8078 98.9187
+## k1       1.55e-02 4.10e-04  0.0143  0.0167
+## k2       1.16e-11 5.00e-01  0.0000     Inf
+## g        6.89e-01 2.92e-03  0.6626  0.7142
+## sigma    6.48e-01 2.38e-05  0.4147  0.8813
+## 
+## 
+## DTx values:
+##      DT50     DT90 DT50_rep
+## SFO  86.6 2.88e+02 8.66e+01
+## IORE 85.5 7.17e+02 2.16e+02
+## DFOP 83.6 9.80e+10 5.98e+10
+## 
+## Representative half-life:
+## [1] 215.87
+
+
+

+Example on page 6

+
p6 <- nafta(NAFTA_SOP_Attachment[["p6"]])
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p6)
+

+
print(p6)
+
## Sums of squares:
+##       SFO      IORE      DFOP 
+## 188.45361  51.00699  42.46931 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 58.39888
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)   Lower   Upper
+## parent_0       94.7759 7.29e-24 92.3478 97.2039
+## k_parent_sink   0.0179 8.02e-16  0.0166  0.0194
+## sigma           3.0696 3.81e-06  2.0456  4.0936
+## 
+## $IORE
+##                     Estimate   Pr(>t)    Lower    Upper
+## parent_0            97.12446 2.63e-26 95.62461 98.62431
+## k__iore_parent_sink  0.00252 1.95e-03  0.00134  0.00472
+## N_parent             1.49587 4.07e-13  1.33896  1.65279
+## sigma                1.59698 5.05e-06  1.06169  2.13227
+## 
+## $DFOP
+##          Estimate   Pr(>t)   Lower   Upper
+## parent_0 9.66e+01 1.57e-25 95.3476 97.8979
+## k1       2.55e-02 7.33e-06  0.0233  0.0278
+## k2       4.90e-11 5.00e-01  0.0000     Inf
+## g        8.61e-01 7.55e-06  0.8314  0.8867
+## sigma    1.46e+00 6.93e-06  0.9661  1.9483
+## 
+## 
+## DTx values:
+##      DT50     DT90 DT50_rep
+## SFO  38.6 1.28e+02 3.86e+01
+## IORE 34.0 1.77e+02 5.32e+01
+## DFOP 34.1 6.66e+09 1.41e+10
+## 
+## Representative half-life:
+## [1] 53.17
+
+
+

+Example on page 7

+
p7 <- nafta(NAFTA_SOP_Attachment[["p7"]])
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p7)
+

+
print(p7)
+
## Sums of squares:
+##      SFO     IORE     DFOP 
+## 3661.661 3195.030 3174.145 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 3334.194
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)    Lower    Upper
+## parent_0      96.41796 4.80e-53 93.32245 99.51347
+## k_parent_sink  0.00735 7.64e-21  0.00641  0.00843
+## sigma          7.94557 1.83e-15  6.46713  9.42401
+## 
+## $IORE
+##                     Estimate Pr(>t)    Lower    Upper
+## parent_0            9.92e+01     NA 9.55e+01 1.03e+02
+## k__iore_parent_sink 1.60e-05     NA 1.45e-07 1.77e-03
+## N_parent            2.45e+00     NA 1.35e+00 3.54e+00
+## sigma               7.42e+00     NA 6.04e+00 8.80e+00
+## 
+## $DFOP
+##          Estimate   Pr(>t)   Lower    Upper
+## parent_0 9.89e+01 9.44e-49 95.4640 102.2573
+## k1       1.81e-02 1.75e-01  0.0116   0.0281
+## k2       1.97e-10 5.00e-01  0.0000      Inf
+## g        6.06e-01 2.19e-01  0.4826   0.7178
+## sigma    7.40e+00 2.97e-15  6.0201   8.7754
+## 
+## 
+## DTx values:
+##      DT50     DT90 DT50_rep
+## SFO  94.3 3.13e+02 9.43e+01
+## IORE 96.7 1.51e+03 4.55e+02
+## DFOP 96.4 6.97e+09 3.52e+09
+## 
+## Representative half-life:
+## [1] 454.55
+
+
+
+

+Examples where the representative half-life deviates from the observed DT50

+
+

+Example on page 8

+

For this dataset, the IORE fit does not converge when the default starting values used by mkin for the IORE model are used. Therefore, a lower value for the rate constant is used here.

+
p8 <- nafta(NAFTA_SOP_Attachment[["p8"]], parms.ini = c(k__iore_parent_sink = 1e-3))
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p8)
+

+
print(p8)
+
## Sums of squares:
+##       SFO      IORE      DFOP 
+## 1996.9408  444.9237  547.5616 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 477.4924
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)    Lower    Upper
+## parent_0      88.16549 6.53e-29 83.37344 92.95754
+## k_parent_sink  0.00803 1.67e-13  0.00674  0.00957
+## sigma          7.44786 4.17e-10  5.66209  9.23363
+## 
+## $IORE
+##                     Estimate   Pr(>t)    Lower    Upper
+## parent_0            9.77e+01 7.03e-35 9.44e+01 1.01e+02
+## k__iore_parent_sink 6.14e-05 3.20e-02 2.12e-05 1.78e-04
+## N_parent            2.27e+00 4.23e-18 2.00e+00 2.54e+00
+## sigma               3.52e+00 5.36e-10 2.67e+00 4.36e+00
+## 
+## $DFOP
+##          Estimate   Pr(>t)    Lower    Upper
+## parent_0 95.70619 8.99e-32 91.87941 99.53298
+## k1        0.02500 5.25e-04  0.01422  0.04394
+## k2        0.00273 6.84e-03  0.00125  0.00597
+## g         0.58835 2.84e-06  0.36595  0.77970
+## sigma     3.90001 6.94e-10  2.96260  4.83741
+## 
+## 
+## DTx values:
+##      DT50 DT90 DT50_rep
+## SFO  86.3  287     86.3
+## IORE 53.4  668    201.0
+## DFOP 55.6  517    253.0
+## 
+## Representative half-life:
+## [1] 201.03
+
+
+
+

+Examples where SFO was not selected for an abiotic study

+
+

+Example on page 9, upper panel

+
p9a <- nafta(NAFTA_SOP_Attachment[["p9a"]])
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p9a)
+

+
print(p9a)
+
## Sums of squares:
+##       SFO      IORE      DFOP 
+## 839.35238  88.57064   9.93363 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 105.5678
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)   Lower   Upper
+## parent_0       88.1933 3.06e-12 79.9447 96.4419
+## k_parent_sink   0.0409 2.07e-07  0.0324  0.0516
+## sigma           7.2429 3.92e-05  4.4768 10.0090
+## 
+## $IORE
+##                     Estimate   Pr(>t)    Lower    Upper
+## parent_0            9.89e+01 1.12e-16 9.54e+01 1.02e+02
+## k__iore_parent_sink 1.93e-05 1.13e-01 3.49e-06 1.06e-04
+## N_parent            2.91e+00 1.45e-09 2.50e+00 3.32e+00
+## sigma               2.35e+00 5.31e-05 1.45e+00 3.26e+00
+## 
+## $DFOP
+##          Estimate   Pr(>t)  Lower  Upper
+## parent_0 9.85e+01 2.54e-20 97.390 99.672
+## k1       1.38e-01 3.52e-05  0.131  0.146
+## k2       6.02e-13 5.00e-01  0.000    Inf
+## g        6.52e-01 8.13e-06  0.642  0.661
+## sigma    7.88e-01 6.13e-02  0.481  1.095
+## 
+## 
+## DTx values:
+##      DT50     DT90 DT50_rep
+## SFO  16.9 5.63e+01 1.69e+01
+## IORE 11.6 3.37e+02 1.01e+02
+## DFOP 10.5 2.07e+12 1.15e+12
+## 
+## Representative half-life:
+## [1] 101.43
+

In this example, the residuals of the SFO indicate a lack of fit of this model, so even if it was an abiotic experiment, the data do not suggest a simple exponential decline.

+
+
+

+Example on page 9, lower panel

+
p9b <- nafta(NAFTA_SOP_Attachment[["p9b"]])
+
## Warning in sqrt(diag(covar)): NaNs produced
+
## Warning in sqrt(diag(covar_notrans)): NaNs produced
+
## Warning in sqrt(1/diag(V)): NaNs produced
+
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
+## doubtful
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p9b)
+

+
print(p9b)
+
## Sums of squares:
+##      SFO     IORE     DFOP 
+## 35.64867 23.22334 35.64867 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 28.54188
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)  Lower   Upper
+## parent_0       94.7123 2.15e-19 93.178 96.2464
+## k_parent_sink   0.0389 4.47e-14  0.037  0.0408
+## sigma           1.5957 1.28e-04  0.932  2.2595
+## 
+## $IORE
+##                     Estimate   Pr(>t)   Lower  Upper
+## parent_0              93.863 2.32e-18 92.4565 95.269
+## k__iore_parent_sink    0.127 1.85e-02  0.0504  0.321
+## N_parent               0.711 1.88e-05  0.4843  0.937
+## sigma                  1.288 1.76e-04  0.7456  1.830
+## 
+## $DFOP
+##          Estimate   Pr(>t)   Lower   Upper
+## parent_0  94.7123 1.61e-16 93.1355 96.2891
+## k1         0.0389 1.43e-06  0.0312  0.0485
+## k2         0.0389 6.67e-03  0.0186  0.0812
+## g          0.7742      NaN      NA      NA
+## sigma      1.5957 2.50e-04  0.9135  2.2779
+## 
+## 
+## DTx values:
+##      DT50 DT90 DT50_rep
+## SFO  17.8 59.2     17.8
+## IORE 18.4 49.2     14.8
+## DFOP 17.8 59.2     17.8
+## 
+## Representative half-life:
+## [1] 14.8
+

Here, mkin gives a longer slow DT50 for the DFOP model (17.8 days) than PestDF (13.5 days). Presumably, this is related to the fact that PestDF gives a negative value for the proportion of the fast degradation which should be between 0 and 1, inclusive. This parameter is called f in PestDF and g in mkin. In mkin, it is restricted to the interval from 0 to 1.

+
+
+

+Example on page 10

+
p10 <- nafta(NAFTA_SOP_Attachment[["p10"]])
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p10)
+

+
print(p10)
+
## Sums of squares:
+##      SFO     IORE     DFOP 
+## 899.4089 336.4348 899.4089 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 413.4841
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)   Lower    Upper
+## parent_0      101.7315 6.42e-11 91.9259 111.5371
+## k_parent_sink   0.0495 1.70e-07  0.0404   0.0607
+## sigma           8.0152 1.28e-04  4.6813  11.3491
+## 
+## $IORE
+##                     Estimate   Pr(>t)  Lower   Upper
+## parent_0               96.86 3.32e-12 90.848 102.863
+## k__iore_parent_sink     2.96 7.91e-02  0.687  12.761
+## N_parent                0.00 5.00e-01 -0.372   0.372
+## sigma                   4.90 1.77e-04  2.837   6.968
+## 
+## $DFOP
+##          Estimate   Pr(>t)   Lower    Upper
+## parent_0 101.7315 1.41e-09 91.6534 111.8097
+## k1         0.0495 6.42e-04  0.0301   0.0814
+## k2         0.0495 1.66e-02  0.0200   0.1225
+## g          0.6634 5.00e-01  0.0000   1.0000
+## sigma      8.0152 2.50e-04  4.5886  11.4418
+## 
+## 
+## DTx values:
+##      DT50 DT90 DT50_rep
+## SFO  14.0 46.5    14.00
+## IORE 16.4 29.4     8.86
+## DFOP 14.0 46.5    14.00
+## 
+## Representative half-life:
+## [1] 8.86
+

Here, a value below N is given for the IORE model, because the data suggests a faster decline towards the end of the experiment, which appears physically rather unlikely in the case of a photolysis study. It seems PestDF does not constrain N to values above zero, thus the slight difference in IORE model parameters between PestDF and mkin.

+
+
+
+

+The DT50 was not observed during the study

+
+

+Example on page 11

+
p11 <- nafta(NAFTA_SOP_Attachment[["p11"]])
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p11)
+

+
print(p11)
+
## Sums of squares:
+##      SFO     IORE     DFOP 
+## 579.6805 204.7932 144.7783 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 251.6944
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)    Lower    Upper
+## parent_0      96.15820 4.83e-13 90.24934 1.02e+02
+## k_parent_sink  0.00321 4.71e-05  0.00222 4.64e-03
+## sigma          6.43473 1.28e-04  3.75822 9.11e+00
+## 
+## $IORE
+##                     Estimate Pr(>t)    Lower    Upper
+## parent_0            1.05e+02     NA 9.90e+01 1.10e+02
+## k__iore_parent_sink 3.11e-17     NA 1.35e-20 7.18e-14
+## N_parent            8.36e+00     NA 6.62e+00 1.01e+01
+## sigma               3.82e+00     NA 2.21e+00 5.44e+00
+## 
+## $DFOP
+##          Estimate   Pr(>t)    Lower    Upper
+## parent_0 1.05e+02 9.47e-13  99.9990 109.1224
+## k1       4.41e-02 5.95e-03   0.0296   0.0658
+## k2       7.25e-13 5.00e-01   0.0000      Inf
+## g        3.22e-01 1.45e-03   0.2814   0.3650
+## sigma    3.22e+00 3.52e-04   1.8410   4.5906
+## 
+## 
+## DTx values:
+##          DT50     DT90 DT50_rep
+## SFO  2.16e+02 7.18e+02 2.16e+02
+## IORE 9.73e+02 1.37e+08 4.11e+07
+## DFOP 4.21e+11 2.64e+12 9.56e+11
+## 
+## Representative half-life:
+## [1] 41148169
+

In this case, the DFOP fit reported for PestDF resulted in a negative value for the slower rate constant, which is not possible in mkin. The other results are in agreement.

+
+
+
+

+N is less than 1 and the DFOP rate constants are like the SFO rate constant

+

In the following three examples, the same results are obtained with mkin as reported for PestDF. As in the case on page 10, the N values below 1 are deemed unrealistic and appear to be the result of an overparameterisation.

+
+

+Example on page 12, upper panel

+
p12a <- nafta(NAFTA_SOP_Attachment[["p12a"]])
+
## Warning in summary.mkinfit(x): Could not calculate correlation; no covariance
+## matrix
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p12a)
+

+
print(p12a)
+
## Sums of squares:
+##      SFO     IORE     DFOP 
+## 695.4440 220.0685 695.4440 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 270.4679
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)  Lower   Upper
+## parent_0       100.521 8.75e-12 92.461 108.581
+## k_parent_sink    0.124 3.61e-08  0.104   0.148
+## sigma            7.048 1.28e-04  4.116   9.980
+## 
+## $IORE
+##                     Estimate Pr(>t) Lower Upper
+## parent_0              96.823     NA    NA    NA
+## k__iore_parent_sink    2.436     NA    NA    NA
+## N_parent               0.263     NA    NA    NA
+## sigma                  3.965     NA    NA    NA
+## 
+## $DFOP
+##          Estimate   Pr(>t)   Lower   Upper
+## parent_0  100.521 2.74e-10 92.2366 108.805
+## k1          0.124 5.74e-06  0.0958   0.161
+## k2          0.124 6.61e-02  0.0319   0.484
+## g           0.877 5.00e-01  0.0000   1.000
+## sigma       7.048 2.50e-04  4.0349  10.061
+## 
+## 
+## DTx values:
+##      DT50 DT90 DT50_rep
+## SFO  5.58 18.5     5.58
+## IORE 6.49 13.2     3.99
+## DFOP 5.58 18.5     5.58
+## 
+## Representative half-life:
+## [1] 3.99
+
+
+

+Example on page 12, lower panel

+
p12b <- nafta(NAFTA_SOP_Attachment[["p12b"]])
+
## Warning in sqrt(diag(covar)): NaNs produced
+
## Warning in qt(alpha/2, rdf): NaNs produced
+
## Warning in qt(1 - alpha/2, rdf): NaNs produced
+
## Warning in sqrt(diag(covar_notrans)): NaNs produced
+
## Warning in pt(abs(tval), rdf, lower.tail = FALSE): NaNs produced
+
## Warning in sqrt(1/diag(V)): NaNs produced
+
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
+## doubtful
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p12b)
+

+
print(p12b)
+
## Sums of squares:
+##      SFO     IORE     DFOP 
+## 58.90242 19.06353 58.90242 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 51.51756
+## 
+## Parameters:
+## $SFO
+##               Estimate  Pr(>t)   Lower    Upper
+## parent_0       97.6840 0.00039 85.9388 109.4292
+## k_parent_sink   0.0589 0.00261  0.0431   0.0805
+## sigma           3.4323 0.04356 -1.2377   8.1023
+## 
+## $IORE
+##                     Estimate Pr(>t)     Lower  Upper
+## parent_0              95.523 0.0055 74.539157 116.51
+## k__iore_parent_sink    0.333 0.1433  0.000717 154.57
+## N_parent               0.568 0.0677 -0.989464   2.13
+## sigma                  1.953 0.0975 -5.893100   9.80
+## 
+## $DFOP
+##          Estimate Pr(>t) Lower Upper
+## parent_0  97.6840    NaN   NaN   NaN
+## k1         0.0589    NaN    NA    NA
+## k2         0.0589    NaN    NA    NA
+## g          0.6902    NaN    NA    NA
+## sigma      3.4323    NaN   NaN   NaN
+## 
+## 
+## DTx values:
+##      DT50 DT90 DT50_rep
+## SFO  11.8 39.1    11.80
+## IORE 12.9 31.4     9.46
+## DFOP 11.8 39.1    11.80
+## 
+## Representative half-life:
+## [1] 9.46
+
+
+

+Example on page 13

+
p13 <- nafta(NAFTA_SOP_Attachment[["p13"]])
+
## Warning in sqrt(diag(covar)): NaNs produced
+
## Warning in sqrt(1/diag(V)): NaNs produced
+
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
+## doubtful
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p13)
+

+
print(p13)
+
## Sums of squares:
+##      SFO     IORE     DFOP 
+## 174.5971 142.3951 174.5971 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 172.131
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)    Lower    Upper
+## parent_0      92.73500 5.99e-17 89.61936 95.85065
+## k_parent_sink  0.00258 2.42e-09  0.00223  0.00299
+## sigma          3.41172 7.07e-05  2.05455  4.76888
+## 
+## $IORE
+##                     Estimate   Pr(>t)    Lower  Upper
+## parent_0             91.6016 6.34e-16 88.53086 94.672
+## k__iore_parent_sink   0.0396 2.36e-01  0.00207  0.759
+## N_parent              0.3541 1.46e-01 -0.35153  1.060
+## sigma                 3.0811 9.64e-05  1.84296  4.319
+## 
+## $DFOP
+##          Estimate   Pr(>t)    Lower    Upper
+## parent_0 92.73500 9.25e-15 8.95e+01 9.59e+01
+## k1        0.00258 4.28e-01 1.70e-08 3.92e+02
+## k2        0.00258 3.69e-08 2.20e-03 3.03e-03
+## g         0.00442 5.00e-01       NA       NA
+## sigma     3.41172 1.35e-04 2.02e+00 4.80e+00
+## 
+## 
+## DTx values:
+##      DT50 DT90 DT50_rep
+## SFO   269  892      269
+## IORE  261  560      169
+## DFOP  269  892      269
+## 
+## Representative half-life:
+## [1] 168.51
+
+
+
+

+DT50 not observed in the study and DFOP problems in PestDF

+
p14 <- nafta(NAFTA_SOP_Attachment[["p14"]])
+
## Warning in sqrt(diag(covar)): NaNs produced
+
## Warning in sqrt(1/diag(V)): NaNs produced
+
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
+## doubtful
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p14)
+

+
print(p14)
+
## Sums of squares:
+##      SFO     IORE     DFOP 
+## 48.43249 28.67746 27.26248 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 32.83337
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)    Lower    Upper
+## parent_0      99.47124 2.06e-30 98.42254 1.01e+02
+## k_parent_sink  0.00279 3.75e-15  0.00256 3.04e-03
+## sigma          1.55616 3.81e-06  1.03704 2.08e+00
+## 
+## $IORE
+##                     Estimate Pr(>t) Lower Upper
+## parent_0            1.00e+02     NA   NaN   NaN
+## k__iore_parent_sink 9.44e-08     NA   NaN   NaN
+## N_parent            3.31e+00     NA   NaN   NaN
+## sigma               1.20e+00     NA 0.796   1.6
+## 
+## $DFOP
+##          Estimate   Pr(>t)    Lower    Upper
+## parent_0 1.00e+02 2.96e-28 99.40280 101.2768
+## k1       9.53e-03 1.20e-01  0.00638   0.0143
+## k2       7.29e-12 5.00e-01  0.00000      Inf
+## g        3.98e-01 2.19e-01  0.30481   0.4998
+## sigma    1.17e+00 7.68e-06  0.77406   1.5610
+## 
+## 
+## DTx values:
+##          DT50     DT90 DT50_rep
+## SFO  2.48e+02 8.25e+02 2.48e+02
+## IORE 4.34e+02 2.22e+04 6.70e+03
+## DFOP 2.54e+10 2.46e+11 9.51e+10
+## 
+## Representative half-life:
+## [1] 6697.44
+

The slower rate constant reported by PestDF is negative, which is not physically realistic, and not possible in mkin. The other fits give the same results in mkin and PestDF.

+
+
+

+N is less than 1 and DFOP fraction parameter is below zero

+
p15a <- nafta(NAFTA_SOP_Attachment[["p15a"]])
+
## Warning in sqrt(diag(covar)): NaNs produced
+
## Warning in sqrt(diag(covar_notrans)): NaNs produced
+
## Warning in sqrt(1/diag(V)): NaNs produced
+
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
+## doubtful
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p15a)
+

+
print(p15a)
+
## Sums of squares:
+##      SFO     IORE     DFOP 
+## 245.5248 135.0132 245.5248 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 165.9335
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)    Lower   Upper
+## parent_0      97.96751 2.00e-15 94.32049 101.615
+## k_parent_sink  0.00952 4.93e-09  0.00824   0.011
+## sigma          4.18778 1.28e-04  2.44588   5.930
+## 
+## $IORE
+##                     Estimate   Pr(>t)  Lower  Upper
+## parent_0              95.874 2.94e-15 92.937 98.811
+## k__iore_parent_sink    0.629 2.11e-01  0.044  8.982
+## N_parent               0.000 5.00e-01 -0.642  0.642
+## sigma                  3.105 1.78e-04  1.795  4.416
+## 
+## $DFOP
+##          Estimate   Pr(>t)    Lower    Upper
+## parent_0 97.96752 2.85e-13 94.21914 101.7159
+## k1        0.00952 6.80e-02  0.00277   0.0327
+## k2        0.00952 3.82e-06  0.00902   0.0100
+## g         0.17247      NaN       NA       NA
+## sigma     4.18778 2.50e-04  2.39747   5.9781
+## 
+## 
+## DTx values:
+##      DT50 DT90 DT50_rep
+## SFO  72.8  242     72.8
+## IORE 76.3  137     41.3
+## DFOP 72.8  242     72.8
+## 
+## Representative half-life:
+## [1] 41.33
+
p15b <- nafta(NAFTA_SOP_Attachment[["p15b"]])
+
## Warning in sqrt(diag(covar)): NaNs produced
+
## Warning in sqrt(1/diag(V)): NaNs produced
+
## Warning in cov2cor(ans$covar): diag(.) had 0 or NA entries; non-finite result is
+## doubtful
+
## The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
+
## The half-life obtained from the IORE model may be used
+
plot(p15b)
+

+
print(p15b)
+
## Sums of squares:
+##       SFO      IORE      DFOP 
+## 106.91629  68.55574 106.91629 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 84.25618
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)    Lower    Upper
+## parent_0      1.01e+02 3.06e-17 98.31594 1.03e+02
+## k_parent_sink 4.86e-03 2.48e-10  0.00435 5.42e-03
+## sigma         2.76e+00 1.28e-04  1.61402 3.91e+00
+## 
+## $IORE
+##                     Estimate   Pr(>t)    Lower  Upper
+## parent_0               99.83 1.81e-16 97.51349 102.14
+## k__iore_parent_sink     0.38 3.22e-01  0.00352  41.05
+## N_parent                0.00 5.00e-01 -1.07695   1.08
+## sigma                   2.21 2.57e-04  1.23245   3.19
+## 
+## $DFOP
+##          Estimate Pr(>t)    Lower    Upper
+## parent_0 1.01e+02     NA 9.82e+01 1.04e+02
+## k1       4.86e-03     NA 6.75e-04 3.49e-02
+## k2       4.86e-03     NA 3.37e-03 6.99e-03
+## g        1.50e-01     NA       NA       NA
+## sigma    2.76e+00     NA 1.58e+00 3.94e+00
+## 
+## 
+## DTx values:
+##      DT50 DT90 DT50_rep
+## SFO   143  474    143.0
+## IORE  131  236     71.2
+## DFOP  143  474    143.0
+## 
+## Representative half-life:
+## [1] 71.18
+

In mkin, only the IORE fit is affected (deemed unrealistic), as the fraction parameter of the DFOP model is restricted to the interval between 0 and 1 in mkin. The SFO fits give the same results for both mkin and PestDF.

+
+
+

+The DFOP fraction parameter is greater than 1

+
p16 <- nafta(NAFTA_SOP_Attachment[["p16"]])
+
## 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
+
plot(p16)
+

+
print(p16)
+
## Sums of squares:
+##      SFO     IORE     DFOP 
+## 3831.804 2062.008 1550.980 
+## 
+## Critical sum of squares for checking the SFO model:
+## [1] 2247.348
+## 
+## Parameters:
+## $SFO
+##               Estimate   Pr(>t)  Lower Upper
+## parent_0        71.953 2.33e-13 60.509 83.40
+## k_parent_sink    0.159 4.86e-05  0.102  0.25
+## sigma           11.302 1.25e-08  8.308 14.30
+## 
+## $IORE
+##                     Estimate   Pr(>t)    Lower    Upper
+## parent_0            8.74e+01 2.48e-16 7.72e+01 97.52972
+## k__iore_parent_sink 4.55e-04 2.16e-01 3.48e-05  0.00595
+## N_parent            2.70e+00 1.21e-08 1.99e+00  3.40046
+## sigma               8.29e+00 1.61e-08 6.09e+00 10.49062
+## 
+## $DFOP
+##          Estimate   Pr(>t)   Lower  Upper
+## parent_0  88.5333 7.40e-18 79.9836 97.083
+## k1        18.5561 5.00e-01  0.0000    Inf
+## k2         0.0776 1.41e-05  0.0518  0.116
+## g          0.4733 1.41e-09  0.3674  0.582
+## sigma      7.1902 2.11e-08  5.2785  9.102
+## 
+## 
+## DTx values:
+##      DT50 DT90 DT50_rep
+## SFO  4.35 14.4     4.35
+## IORE 1.48 32.1     9.67
+## DFOP 0.67 21.4     8.93
+## 
+## Representative half-life:
+## [1] 8.93
+

In PestDF, the DFOP fit seems to have stuck in a local minimum, as mkin finds a solution with a much lower \(\chi^2\) error level. As the half-life from the slower rate constant of the DFOP model is larger than the IORE derived half-life, the NAFTA recommendation obtained with mkin is to use the DFOP representative half-life of 8.9 days.

+
+
+

+Conclusions

+

The results obtained with mkin deviate from the results obtained with PestDF either in cases where one of the interpretive rules would apply, i.e. the IORE parameter N is less than one or the DFOP k values obtained with PestDF are equal to the SFO k values, or in cases where the DFOP model did not converge, which often lead to negative rate constants returned by PestDF.

+

Therefore, mkin appears to suitable for kinetic evaluations according to the NAFTA guidance.

+
+
+

+References

+
+
+

US EPA. 2015. “Standard Operating Procedure for Using the NAFTA Guidance to Calculate Representative Half-Life Values and Characterizing Pesticide Degradation.”

+
+
+
+
+ + + +
+ + + +
+ +
+

Site built with pkgdown 1.5.1.

+
+ +
+
+ + + + + + diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p10-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p10-1.png new file mode 100644 index 00000000..291b48e1 Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p10-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p11-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p11-1.png new file mode 100644 index 00000000..149cf24c Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p11-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p12a-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p12a-1.png new file mode 100644 index 00000000..85ea5f4e Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p12a-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p12b-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p12b-1.png new file mode 100644 index 00000000..0ae354c4 Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p12b-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p13-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p13-1.png new file mode 100644 index 00000000..d0f89858 Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p13-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p14-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p14-1.png new file mode 100644 index 00000000..84b53d01 Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p14-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p15a-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p15a-1.png new file mode 100644 index 00000000..a09b2e3d Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p15a-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p15b-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p15b-1.png new file mode 100644 index 00000000..5a51714c Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p15b-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p16-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p16-1.png new file mode 100644 index 00000000..36999356 Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p16-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p5a-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p5a-1.png new file mode 100644 index 00000000..596a33b2 Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p5a-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p5b-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p5b-1.png new file mode 100644 index 00000000..e6f9716e Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p5b-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p6-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p6-1.png new file mode 100644 index 00000000..f8576168 Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p6-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p7-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p7-1.png new file mode 100644 index 00000000..218a790f Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p7-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p8-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p8-1.png new file mode 100644 index 00000000..fa8621e7 Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p8-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p9a-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p9a-1.png new file mode 100644 index 00000000..aac3600b Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p9a-1.png differ diff --git a/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p9b-1.png b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p9b-1.png new file mode 100644 index 00000000..cb52aecd Binary files /dev/null and b/docs/dev/articles/web_only/NAFTA_examples_files/figure-html/p9b-1.png differ diff --git a/docs/dev/articles/web_only/benchmarks.html b/docs/dev/articles/web_only/benchmarks.html new file mode 100644 index 00000000..b46b873c --- /dev/null +++ b/docs/dev/articles/web_only/benchmarks.html @@ -0,0 +1,391 @@ + + + + + + + +Benchmark timings for mkin • mkin + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +

Each system is characterized by its CPU type, the operating system type and the mkin version. Currently only values for one system are available. A compiler was available, so if no analytical solution was available, compiled ODE models are used.

+
+

+Test cases

+

Parent only:

+
FOCUS_C <- FOCUS_2006_C
+FOCUS_D <- subset(FOCUS_2006_D, value != 0)
+parent_datasets <- list(FOCUS_C, FOCUS_D)
+
+t1 <- system.time(mmkin_bench(c("SFO", "FOMC", "DFOP", "HS"), parent_datasets))[["elapsed"]]
+t2 <- system.time(mmkin_bench(c("SFO", "FOMC", "DFOP", "HS"), parent_datasets,
+    error_model = "tc"))[["elapsed"]]
+

One metabolite:

+
SFO_SFO <- mkinmod(
+  parent = mkinsub("SFO", "m1"),
+  m1 = mkinsub("SFO"))
+FOMC_SFO <- mkinmod(
+  parent = mkinsub("FOMC", "m1"),
+  m1 = mkinsub("SFO"))
+DFOP_SFO <- mkinmod(
+  parent = mkinsub("FOMC", "m1"),
+  m1 = mkinsub("SFO"))
+t3 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D)))[["elapsed"]]
+t4 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D),
+    error_model = "tc"))[["elapsed"]]
+t5 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D),
+    error_model = "obs"))[["elapsed"]]
+

Two metabolites, synthetic data:

+
m_synth_SFO_lin <- mkinmod(parent = mkinsub("SFO", "M1"),
+                           M1 = mkinsub("SFO", "M2"),
+                           M2 = mkinsub("SFO"),
+                           use_of_ff = "max", quiet = TRUE)
+
+m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")),
+                           M1 = mkinsub("SFO"),
+                           M2 = mkinsub("SFO"),
+                           use_of_ff = "max", quiet = TRUE)
+
+SFO_lin_a <- synthetic_data_for_UBA_2014[[1]]$data
+
+DFOP_par_c <- synthetic_data_for_UBA_2014[[12]]$data
+
+t6 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a)))[["elapsed"]]
+t7 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c)))[["elapsed"]]
+
+t8 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a),
+    error_model = "tc"))[["elapsed"]]
+t9 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c),
+    error_model = "tc"))[["elapsed"]]
+
+t10 <- system.time(mmkin_bench(list(m_synth_SFO_lin), list(SFO_lin_a),
+    error_model = "obs"))[["elapsed"]]
+t11 <- system.time(mmkin_bench(list(m_synth_DFOP_par), list(DFOP_par_c),
+    error_model = "obs"))[["elapsed"]]
+
mkin_benchmarks[system_string, paste0("t", 1:11)] <-
+  c(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11)
+save(mkin_benchmarks, file = "~/git/mkin/vignettes/web_only/mkin_benchmarks.rda")
+
+
+

+Results

+

Currently, we only have benchmark information on one system, therefore only the mkin version is shown with the results below. Timings are in seconds, shorter is better. All results were obtained by serial, i.e. not using multiple computing cores.

+

Benchmarks for all available error models are shown.

+
+

+Parent only

+

Constant variance (t1) and two-component error model (t2) for four models fitted to two datasets, i.e. eight fits for each test.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
mkin versiont1 [s]t2 [s]
0.9.48.13.61011.019
0.9.49.18.18422.889
0.9.49.27.06412.558
0.9.49.37.29621.239
0.9.49.45.93620.545
0.9.50.21.7143.971
0.9.50.31.7523.728
+
+
+

+One metabolite

+

Constant variance (t3), two-component error model (t4), and variance by variable (t5) for three models fitted to one dataset, i.e. three fits for each test.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
mkin versiont3 [s]t4 [s]t5 [s]
0.9.48.13.76414.3479.495
0.9.49.14.64913.7896.395
0.9.49.24.7868.4615.675
0.9.49.34.51013.8057.386
0.9.49.44.44615.3356.002
0.9.50.21.4026.1742.764
0.9.50.31.3896.5792.740
+
+
+

+Two metabolites

+

Constant variance (t6 and t7), two-component error model (t8 and t9), and variance by variable (t10 and t11) for one model fitted to one dataset, i.e. one fit for each test.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
mkin versiont6 [s]t7 [s]t8 [s]t9 [s]t10 [s]t11 [s]
0.9.48.12.6234.5877.52516.6218.57631.267
0.9.49.12.5424.1284.6328.1713.6765.636
0.9.49.22.7234.4784.8627.6183.5795.574
0.9.49.32.6434.3747.02011.1245.3887.365
0.9.49.42.6354.2594.7377.7633.4275.626
0.9.50.20.7771.2361.3322.8722.0692.987
0.9.50.30.7601.2521.4574.2012.0072.979
+
+
+
+ + + +
+ + + +
+ +
+

Site built with pkgdown 1.5.1.

+
+ +
+
+ + + + + + diff --git a/docs/dev/articles/web_only/compiled_models.html b/docs/dev/articles/web_only/compiled_models.html new file mode 100644 index 00000000..7b5dc8ca --- /dev/null +++ b/docs/dev/articles/web_only/compiled_models.html @@ -0,0 +1,221 @@ + + + + + + + +Performance benefit by using compiled model definitions in mkin • mkin + + + + + + + + + + + +
+
+ + + + +
+
+ + + + +
+

+How to benefit from compiled models

+

When using an mkin version equal to or greater than 0.9-36 and a C compiler is available, you will see a message that the model is being compiled from autogenerated C code when defining a model using mkinmod. Starting from version 0.9.49.9, the mkinmod() function checks for presence of a compiler using

+
pkgbuild::has_compiler()
+

In previous versions, it used Sys.which("gcc") for this check.

+

On Linux, you need to have the essential build tools like make and gcc or clang installed. On Debian based linux distributions, these will be pulled in by installing the build-essential package.

+

On MacOS, which I do not use personally, I have had reports that a compiler is available by default.

+

On Windows, you need to install Rtools and have the path to its bin directory in your PATH variable. You do not need to modify the PATH variable when installing Rtools. Instead, I would recommend to put the line

+
Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
+

into your .Rprofile startup file. This is just a text file with some R code that is executed when your R session starts. It has to be named .Rprofile and has to be located in your home directory, which will generally be your Documents folder. You can check the location of the home directory used by R by issuing

+
Sys.getenv("HOME")
+
+
+

+Comparison with other solution methods

+

First, we build a simple degradation model for a parent compound with one metabolite, and we remove zero values from the dataset.

+
library("mkin", quietly = TRUE)
+SFO_SFO <- mkinmod(
+  parent = mkinsub("SFO", "m1"),
+  m1 = mkinsub("SFO"))
+
## Successfully compiled differential equation model from auto-generated C code.
+
FOCUS_D <- subset(FOCUS_2006_D, value != 0)
+

We can compare the performance of the Eigenvalue based solution against the compiled version and the R implementation of the differential equations using the benchmark package. In the output of below code, the warnings about zero being removed from the FOCUS D dataset are suppressed. Since mkin version 0.9.49.11, an analytical solution is also implemented, which is included in the tests below.

+
if (require(rbenchmark)) {
+  b.1 <- benchmark(
+    "deSolve, not compiled" = mkinfit(SFO_SFO, FOCUS_D,
+       solution_type = "deSolve",
+       use_compiled = FALSE, quiet = TRUE),
+    "Eigenvalue based" = mkinfit(SFO_SFO, FOCUS_D,
+       solution_type = "eigen", quiet = TRUE),
+    "deSolve, compiled" = mkinfit(SFO_SFO, FOCUS_D,
+       solution_type = "deSolve", quiet = TRUE),
+    "analytical" = mkinfit(SFO_SFO, FOCUS_D,
+       solution_type = "analytical",
+       use_compiled = FALSE, quiet = TRUE),
+    replications = 1, order = "relative",
+    columns = c("test", "replications", "relative", "elapsed"))
+  print(b.1)
+} else {
+  print("R package rbenchmark is not available")
+}
+
##                    test replications relative elapsed
+## 4            analytical            1    1.000   0.202
+## 3     deSolve, compiled            1    1.703   0.344
+## 2      Eigenvalue based            1    1.990   0.402
+## 1 deSolve, not compiled            1   40.173   8.115
+

We see that using the compiled model is by more than a factor of 10 faster than using deSolve without compiled code.

+
+
+

+Model without analytical solution

+

This evaluation is also taken from the example section of mkinfit. No analytical solution is available for this system, and now Eigenvalue based solution is possible, so only deSolve using with or without compiled code is available.

+
if (require(rbenchmark)) {
+  FOMC_SFO <- mkinmod(
+    parent = mkinsub("FOMC", "m1"),
+    m1 = mkinsub( "SFO"))
+
+  b.2 <- benchmark(
+    "deSolve, not compiled" = mkinfit(FOMC_SFO, FOCUS_D,
+                                      use_compiled = FALSE, quiet = TRUE),
+    "deSolve, compiled" = mkinfit(FOMC_SFO, FOCUS_D, quiet = TRUE),
+    replications = 1, order = "relative",
+    columns = c("test", "replications", "relative", "elapsed"))
+  print(b.2)
+  factor_FOMC_SFO <- round(b.2["1", "relative"])
+} else {
+  factor_FOMC_SFO <- NA
+  print("R package benchmark is not available")
+}
+
## Successfully compiled differential equation model from auto-generated C code.
+
##                    test replications relative elapsed
+## 2     deSolve, compiled            1    1.000   0.469
+## 1 deSolve, not compiled            1   30.384  14.250
+

Here we get a performance benefit of a factor of 30 using the version of the differential equation model compiled from C code!

+

This vignette was built with mkin 0.9.50.3 on

+
## R version 4.0.0 (2020-04-24)
+## Platform: x86_64-pc-linux-gnu (64-bit)
+## Running under: Debian GNU/Linux 10 (buster)
+
## CPU model: AMD Ryzen 7 1700 Eight-Core Processor
+
+
+ + + +
+ + + +
+ +
+

Site built with pkgdown 1.5.1.

+
+ +
+
+ + + + + + diff --git a/docs/dev/authors.html b/docs/dev/authors.html new file mode 100644 index 00000000..167a8d06 --- /dev/null +++ b/docs/dev/authors.html @@ -0,0 +1,186 @@ + + + + + + + + +Authors • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+
+ + +
    +
  • +

    Johannes Ranke. Author, maintainer, copyright holder. +

    +
  • +
  • +

    Katrin Lindenberger. Contributor. +

    +
  • +
  • +

    René Lehmann. Contributor. +

    +
  • +
  • +

    Eurofins Regulatory AG. Copyright holder. +

    +
  • +
+ +
+ +
+ + + +
+ + +
+

Site built with pkgdown 1.5.1.

+
+ +
+
+ + + + + + + + diff --git a/docs/dev/bootstrap-toc.css b/docs/dev/bootstrap-toc.css new file mode 100644 index 00000000..5a859415 --- /dev/null +++ b/docs/dev/bootstrap-toc.css @@ -0,0 +1,60 @@ +/*! + * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ + +/* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ + +/* All levels of nav */ +nav[data-toggle='toc'] .nav > li > a { + display: block; + padding: 4px 20px; + font-size: 13px; + font-weight: 500; + color: #767676; +} +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 19px; + color: #563d7c; + text-decoration: none; + background-color: transparent; + border-left: 1px solid #563d7c; +} +nav[data-toggle='toc'] .nav > .active > a, +nav[data-toggle='toc'] .nav > .active:hover > a, +nav[data-toggle='toc'] .nav > .active:focus > a { + padding-left: 18px; + font-weight: bold; + color: #563d7c; + background-color: transparent; + border-left: 2px solid #563d7c; +} + +/* Nav: second level (shown on .active) */ +nav[data-toggle='toc'] .nav .nav { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} +nav[data-toggle='toc'] .nav .nav > li > a { + padding-top: 1px; + padding-bottom: 1px; + padding-left: 30px; + font-size: 12px; + font-weight: normal; +} +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 29px; +} +nav[data-toggle='toc'] .nav .nav > .active > a, +nav[data-toggle='toc'] .nav .nav > .active:hover > a, +nav[data-toggle='toc'] .nav .nav > .active:focus > a { + padding-left: 28px; + font-weight: 500; +} + +/* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ +nav[data-toggle='toc'] .nav > .active > ul { + display: block; +} diff --git a/docs/dev/bootstrap-toc.js b/docs/dev/bootstrap-toc.js new file mode 100644 index 00000000..1cdd573b --- /dev/null +++ b/docs/dev/bootstrap-toc.js @@ -0,0 +1,159 @@ +/*! + * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) + * Copyright 2015 Aidan Feldman + * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ +(function() { + 'use strict'; + + window.Toc = { + helpers: { + // return all matching elements in the set, or their descendants + findOrFilter: function($el, selector) { + // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/ + // http://stackoverflow.com/a/12731439/358804 + var $descendants = $el.find(selector); + return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])'); + }, + + generateUniqueIdBase: function(el) { + var text = $(el).text(); + var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-'); + return anchor || el.tagName.toLowerCase(); + }, + + generateUniqueId: function(el) { + var anchorBase = this.generateUniqueIdBase(el); + for (var i = 0; ; i++) { + var anchor = anchorBase; + if (i > 0) { + // add suffix + anchor += '-' + i; + } + // check if ID already exists + if (!document.getElementById(anchor)) { + return anchor; + } + } + }, + + generateAnchor: function(el) { + if (el.id) { + return el.id; + } else { + var anchor = this.generateUniqueId(el); + el.id = anchor; + return anchor; + } + }, + + createNavList: function() { + return $(''); + }, + + createChildNavList: function($parent) { + var $childList = this.createNavList(); + $parent.append($childList); + return $childList; + }, + + generateNavEl: function(anchor, text) { + var $a = $(''); + $a.attr('href', '#' + anchor); + $a.text(text); + var $li = $('
  • '); + $li.append($a); + return $li; + }, + + generateNavItem: function(headingEl) { + var anchor = this.generateAnchor(headingEl); + var $heading = $(headingEl); + var text = $heading.data('toc-text') || $heading.text(); + return this.generateNavEl(anchor, text); + }, + + // Find the first heading level (`

    `, then `

    `, etc.) that has more than one element. Defaults to 1 (for `

    `). + getTopLevel: function($scope) { + for (var i = 1; i <= 6; i++) { + var $headings = this.findOrFilter($scope, 'h' + i); + if ($headings.length > 1) { + return i; + } + } + + return 1; + }, + + // returns the elements for the top level, and the next below it + getHeadings: function($scope, topLevel) { + var topSelector = 'h' + topLevel; + + var secondaryLevel = topLevel + 1; + var secondarySelector = 'h' + secondaryLevel; + + return this.findOrFilter($scope, topSelector + ',' + secondarySelector); + }, + + getNavLevel: function(el) { + return parseInt(el.tagName.charAt(1), 10); + }, + + populateNav: function($topContext, topLevel, $headings) { + var $context = $topContext; + var $prevNav; + + var helpers = this; + $headings.each(function(i, el) { + var $newNav = helpers.generateNavItem(el); + var navLevel = helpers.getNavLevel(el); + + // determine the proper $context + if (navLevel === topLevel) { + // use top level + $context = $topContext; + } else if ($prevNav && $context === $topContext) { + // create a new level of the tree and switch to it + $context = helpers.createChildNavList($prevNav); + } // else use the current $context + + $context.append($newNav); + + $prevNav = $newNav; + }); + }, + + parseOps: function(arg) { + var opts; + if (arg.jquery) { + opts = { + $nav: arg + }; + } else { + opts = arg; + } + opts.$scope = opts.$scope || $(document.body); + return opts; + } + }, + + // accepts a jQuery object, or an options object + init: function(opts) { + opts = this.helpers.parseOps(opts); + + // ensure that the data attribute is in place for styling + opts.$nav.attr('data-toggle', 'toc'); + + var $topContext = this.helpers.createChildNavList(opts.$nav); + var topLevel = this.helpers.getTopLevel(opts.$scope); + var $headings = this.helpers.getHeadings(opts.$scope, topLevel); + this.helpers.populateNav($topContext, topLevel, $headings); + } + }; + + $(function() { + $('nav[data-toggle="toc"]').each(function(i, el) { + var $nav = $(el); + Toc.init($nav); + }); + }); +})(); diff --git a/docs/dev/docsearch.css b/docs/dev/docsearch.css new file mode 100644 index 00000000..e5f1fe1d --- /dev/null +++ b/docs/dev/docsearch.css @@ -0,0 +1,148 @@ +/* Docsearch -------------------------------------------------------------- */ +/* + Source: https://github.com/algolia/docsearch/ + License: MIT +*/ + +.algolia-autocomplete { + display: block; + -webkit-box-flex: 1; + -ms-flex: 1; + flex: 1 +} + +.algolia-autocomplete .ds-dropdown-menu { + width: 100%; + min-width: none; + max-width: none; + padding: .75rem 0; + background-color: #fff; + background-clip: padding-box; + border: 1px solid rgba(0, 0, 0, .1); + box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); +} + +@media (min-width:768px) { + .algolia-autocomplete .ds-dropdown-menu { + width: 175% + } +} + +.algolia-autocomplete .ds-dropdown-menu::before { + display: none +} + +.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { + padding: 0; + background-color: rgb(255,255,255); + border: 0; + max-height: 80vh; +} + +.algolia-autocomplete .ds-dropdown-menu .ds-suggestions { + margin-top: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion { + padding: 0; + overflow: visible +} + +.algolia-autocomplete .algolia-docsearch-suggestion--category-header { + padding: .125rem 1rem; + margin-top: 0; + font-size: 1.3em; + font-weight: 500; + color: #00008B; + border-bottom: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--wrapper { + float: none; + padding-top: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { + float: none; + width: auto; + padding: 0; + text-align: left +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content { + float: none; + width: auto; + padding: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content::before { + display: none +} + +.algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { + padding-top: .75rem; + margin-top: .75rem; + border-top: 1px solid rgba(0, 0, 0, .1) +} + +.algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { + display: block; + padding: .1rem 1rem; + margin-bottom: 0.1; + font-size: 1.0em; + font-weight: 400 + /* display: none */ +} + +.algolia-autocomplete .algolia-docsearch-suggestion--title { + display: block; + padding: .25rem 1rem; + margin-bottom: 0; + font-size: 0.9em; + font-weight: 400 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--text { + padding: 0 1rem .5rem; + margin-top: -.25rem; + font-size: 0.8em; + font-weight: 400; + line-height: 1.25 +} + +.algolia-autocomplete .algolia-docsearch-footer { + width: 110px; + height: 20px; + z-index: 3; + margin-top: 10.66667px; + float: right; + font-size: 0; + line-height: 0; +} + +.algolia-autocomplete .algolia-docsearch-footer--logo { + background-image: url("data:image/svg+xml;utf8,"); + background-repeat: no-repeat; + background-position: 50%; + background-size: 100%; + overflow: hidden; + text-indent: -9000px; + width: 100%; + height: 100%; + display: block; + transform: translate(-8px); +} + +.algolia-autocomplete .algolia-docsearch-suggestion--highlight { + color: #FF8C00; + background: rgba(232, 189, 54, 0.1) +} + + +.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { + box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) +} + +.algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { + background-color: rgba(192, 192, 192, .15) +} diff --git a/docs/dev/docsearch.js b/docs/dev/docsearch.js new file mode 100644 index 00000000..b35504cd --- /dev/null +++ b/docs/dev/docsearch.js @@ -0,0 +1,85 @@ +$(function() { + + // register a handler to move the focus to the search bar + // upon pressing shift + "/" (i.e. "?") + $(document).on('keydown', function(e) { + if (e.shiftKey && e.keyCode == 191) { + e.preventDefault(); + $("#search-input").focus(); + } + }); + + $(document).ready(function() { + // do keyword highlighting + /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ + var mark = function() { + + var referrer = document.URL ; + var paramKey = "q" ; + + if (referrer.indexOf("?") !== -1) { + var qs = referrer.substr(referrer.indexOf('?') + 1); + var qs_noanchor = qs.split('#')[0]; + var qsa = qs_noanchor.split('&'); + var keyword = ""; + + for (var i = 0; i < qsa.length; i++) { + var currentParam = qsa[i].split('='); + + if (currentParam.length !== 2) { + continue; + } + + if (currentParam[0] == paramKey) { + keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); + } + } + + if (keyword !== "") { + $(".contents").unmark({ + done: function() { + $(".contents").mark(keyword); + } + }); + } + } + }; + + mark(); + }); +}); + +/* Search term highlighting ------------------------------*/ + +function matchedWords(hit) { + var words = []; + + var hierarchy = hit._highlightResult.hierarchy; + // loop to fetch from lvl0, lvl1, etc. + for (var idx in hierarchy) { + words = words.concat(hierarchy[idx].matchedWords); + } + + var content = hit._highlightResult.content; + if (content) { + words = words.concat(content.matchedWords); + } + + // return unique words + var words_uniq = [...new Set(words)]; + return words_uniq; +} + +function updateHitURL(hit) { + + var words = matchedWords(hit); + var url = ""; + + if (hit.anchor) { + url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; + } else { + url = hit.url + '?q=' + escape(words.join(" ")); + } + + return url; +} diff --git a/docs/dev/index.html b/docs/dev/index.html new file mode 100644 index 00000000..4a71b99b --- /dev/null +++ b/docs/dev/index.html @@ -0,0 +1,251 @@ + + + + + + + +Kinetic Evaluation of Chemical Degradation Data • mkin + + + + + + + + + + + +
    +
    + + + + +
    +
    +
    + + +

    The R package mkin provides calculation routines for the analysis of chemical degradation data, including multicompartment kinetics as needed for modelling the formation and decline of transformation products, or if several degradation compartments are involved.

    +
    +

    +Installation

    +

    You can install the latest released version from CRAN from within R:

    + +
    +
    +

    +Background

    +

    In the regulatory evaluation of chemical substances like plant protection products (pesticides), biocides and other chemicals, degradation data play an important role. For the evaluation of pesticide degradation experiments, detailed guidance and helpful tools have been developed as detailed in ‘Credits and historical remarks’ below.

    +
    +
    +

    +Usage

    +

    For a start, have a look at the code examples provided for plot.mkinfit and plot.mmkin, and at the package vignettes FOCUS L and FOCUS D.

    +
    +
    +

    +Documentation

    +

    The HTML documentation is available at jrwb.de, at github and at R-Forge.

    +
    +
    +

    +Features

    +
      +
    • Highly flexible model specification using mkinmod, including equilibrium reactions and using the single first-order reversible binding (SFORB) model, which will automatically create two latent state variables for the observed variable.
    • +
    • As of version 0.9-39, fitting of several models to several datasets, optionally in parallel, is supported, see for example plot.mmkin.
    • +
    • Model solution (forward modelling) in the function mkinpredict is performed either using the analytical solution for the case of parent only degradation, an eigenvalue based solution if only simple first-order (SFO) or SFORB kinetics are used in the model, or using a numeric solver from the deSolve package (default is lsoda).
    • +
    • If a C compiler is installed, the kinetic models are compiled from automatically generated C code, see vignette compiled_models. The autogeneration of C code was inspired by the ccSolve package. Thanks to Karline Soetaert for her work on that.
    • +
    • By default, kinetic rate constants and kinetic formation fractions are transformed internally using transform_odeparms so their estimators can more reasonably be expected to follow a normal distribution. This has the side effect that no constraints are needed in the optimisation. Thanks to René Lehmann for the nice cooperation on this, especially the isometric log-ratio transformation that is now used for the formation fractions.
    • +
    • A side effect of this is that when parameter estimates are backtransformed to match the model definition, confidence intervals calculated from standard errors are also backtransformed to the correct scale, and will not include meaningless values like negative rate constants or formation fractions adding up to more than 1, which can not occur in a single experiment with a single defined radiolabel position.
    • +
    • The usual one-sided t-test for significant difference from zero is nevertheless shown based on estimators for the untransformed parameters.
    • +
    • Summary and plotting functions. The summary of an mkinfit object is in fact a full report that should give enough information to be able to approximately reproduce the fit with other tools.
    • +
    • The chi-squared error level as defined in the FOCUS kinetics guidance (see below) is calculated for each observed variable.
    • +
    • When a metabolite decline phase is not described well by SFO kinetics, SFORB kinetics can be used for the metabolite.
    • +
    • Three different error models can be selected using the argument error_model to the mkinfit function.
    • +
    • The ‘variance by variable’ error model which is often fitted using Iteratively Reweighted Least Squares (IRLS) should now be specified as error_model = "obs".
    • +
    • A two-component error model similar to the one proposed by Rocke and Lorenzato can be selected using the argument error_model = "tc".
    • +
    • Nonlinear mixed-effects models can be created from fits of the same degradation model to different datasets for the same compound by using the nlme.mmkin method.
    • +
    +
    +
    +

    +GUI

    +

    There is a graphical user interface that may be useful. Please refer to its documentation page for installation instructions and a manual.

    +
    +
    +

    +News

    +

    There is a ChangeLog, for the latest CRAN release and one for the github master branch.

    +
    +
    +

    +Credits and historical remarks

    +

    mkin would not be possible without the underlying software stack consisting of, among others, R and the package deSolve. In previous version, mkin was also using the functionality of the FME package. Please refer to the package page on CRAN for the full list of imported and suggested R packages. Also, Debian Linux, the vim editor and the Nvim-R plugin have been invaluable in its development.

    +

    mkin could not have been written without me being introduced to regulatory fate modelling of pesticides by Adrian Gurney during my time at Harlan Laboratories Ltd (formerly RCC Ltd). mkin greatly profits from and largely follows the work done by the FOCUS Degradation Kinetics Workgroup, as detailed in their guidance document from 2006, slightly updated in 2011 and in 2014.

    +

    Also, it was inspired by the first version of KinGUI developed by BayerCropScience, which is based on the MatLab runtime environment.

    +

    The companion package kinfit (now deprecated) was started in 2008 and first published on CRAN on 01 May 2010.

    +

    The first mkin code was published on 11 May 2010 and the first CRAN version on 18 May 2010.

    +

    In 2011, Bayer Crop Science started to distribute an R based successor to KinGUI named KinGUII whose R code is based on mkin, but which added, among other refinements, a closed source graphical user interface (GUI), iteratively reweighted least squares (IRLS) optimisation of the variance for each of the observed variables, and Markov Chain Monte Carlo (MCMC) simulation functionality, similar to what is available e.g. in the FME package.

    +

    Somewhat in parallel, Syngenta has sponsored the development of an mkin and KinGUII based GUI application called CAKE, which also adds IRLS and MCMC, is more limited in the model formulation, but puts more weight on usability. CAKE is available for download from the CAKE website, where you can also find a zip archive of the R scripts derived from mkin, published under the GPL license.

    +

    Finally, there is KineticEval, which contains a further development of the scripts used for KinGUII, so the different tools will hopefully be able to learn from each other in the future as well.

    +
    +
    +

    +References

    + + + + + + + +
    +Ranke J, Meinecke S (2019) Error Models for the Kinetic Evaluation of Chemical Degradation Data Environments 6 (12) 124 doi:10.3390/environments6120124 +
    +Ranke J, Wöltjen J, Meinecke S (2018) Comparison of software tools for kinetic evaluation of chemical degradation data Environmental Sciences Europe 30 17 doi:10.1186/s12302-018-0145-1 +
    +
    +
    +

    +Development

    +

    Contributions are welcome!

    +
    +
    +
    + + +
    + + +
    + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + diff --git a/docs/dev/link.svg b/docs/dev/link.svg new file mode 100644 index 00000000..88ad8276 --- /dev/null +++ b/docs/dev/link.svg @@ -0,0 +1,12 @@ + + + + + + diff --git a/docs/dev/news/index.html b/docs/dev/news/index.html new file mode 100644 index 00000000..36f7025a --- /dev/null +++ b/docs/dev/news/index.html @@ -0,0 +1,845 @@ + + + + + + + + +Changelog • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    +mkin 0.9.50.3 (unreleased) Unreleased +

    +
      +
    • ‘parms’: Add a method for mmkin objects

    • +
    • ‘saemix_model’, ‘saemix_data’: Helper functions to fit nonlinear mixed-effects models for mmkin row objects using the saemix package

    • +
    • ‘mmkin’ and ‘confint(method = ’profile’): Use all cores detected by parallel::detectCores() per default

    • +
    • ‘confint(method = ’profile’): Choose accuracy based on ‘rel_tol’ argument, relative to the bounds obtained by the quadratic approximation

    • +
    +
    +
    +

    +mkin 0.9.50.2 (2020-05-12) 2020-05-12 +

    +
      +
    • Increase tolerance for a platform specific test results on the Solaris test machine on CRAN

    • +
    • Updates and corrections (using the spelling package) to the documentation

    • +
    +
    +
    +

    +mkin 0.9.50.1 (2020-05-11) 2020-05-11 +

    +
      +
    • Support SFORB with formation fractions

    • +
    • ‘mkinmod’: Make ‘use_of_ff’ = “max” the default

    • +
    • Improve performance by a) avoiding expensive calls in the cost function like merge() and data.frame(), and b) by implementing analytical solutions for SFO-SFO and DFOP-SFO

    • +
    +
    +
    +

    +mkin 0.9.49.11 (2020-04-20) 2020-04-20 +

    +
      +
    • Increase a test tolerance to make it pass on all CRAN check machines
    • +
    +
    +
    +

    +mkin 0.9.49.10 (2020-04-18) 2020-04-18 +

    +
      +
    • ‘nlme.mmkin’: An nlme method for mmkin row objects and an associated S3 class with print, plot, anova and endpoint methods

    • +
    • ‘mean_degparms, nlme_data, nlme_function’: Three new functions to facilitate building nlme models from mmkin row objects

    • +
    • ‘endpoints’: Don’t return the SFORB list component if it’s empty. This reduces distraction and complies with the documentation

    • +
    • Article in compiled models: Add some platform specific code and suppress warnings about zero values being removed from the FOCUS D dataset

    • +
    • ‘plot.mmkin’: Add the argument ‘standardized’ to avoid warnings that occurred when it was passed as part of the additional arguments captured by the dots (…)

    • +
    • ‘summary.mkinfit’: Add AIC, BIC and log likelihood to the summary

    • +
    +
    +
    +

    +mkin 0.9.49.9 (2020-03-31) 2020-03-31 +

    +
      +
    • ‘mkinmod’: Use pkgbuild::has_compiler instead of Sys.which(‘gcc’), as the latter will often fail even if Rtools are installed

    • +
    • ‘mkinds’: Use roxygen for documenting fields and methods of this R6 class

    • +
    +
    +
    +

    +mkin 0.9.49.8 (2020-01-09) 2020-01-09 +

    +
      +
    • ‘aw’: Generic function for calculating Akaike weights, methods for mkinfit objects and mmkin columns

    • +
    • ‘loftest’: Add a lack-of-fit test

    • +
    • ‘plot_res’, ‘plot_sep’ and ‘mkinerrplot’: Add the possibility to show standardized residuals and make it the default for fits with error models other than ‘const’

    • +
    • ‘lrtest.mkinfit’: Improve naming of the compared fits in the case of fixed parameters

    • +
    • ‘confint.mkinfit’: Make the quadratic approximation the default, as the likelihood profiling takes a lot of time, especially if the fit has more than three parameters

    • +
    +
    +
    +

    +mkin 0.9.49.7 (2019-11-01) 2019-11-02 +

    +
      +
    • Fix a bug introduced in 0.9.49.6 that occurred if the direct optimisation yielded a higher likelihood than the three-step optimisation in the d_3 algorithm, which caused the fitted parameters of the three-step optimisation to be returned instead of the parameters of the direct optimisation

    • +
    • Add a ‘nobs’ method for mkinfit objects, enabling the default ‘BIC’ method from the stats package. Also, add a ‘BIC’ method for mmkin column objects.

    • +
    +
    +
    +

    +mkin 0.9.49.6 (2019-10-31) 2019-10-31 +

    +
      +
    • Implement a likelihood ratio test as a method for ‘lrtest’ from the lmtest package

    • +
    • Add an ‘update’ method for mkinfit objects which remembers fitted parameters if appropriate

    • +
    • Add a ‘residuals’ method for mkinfit objects that supports scaling based on the error model

    • +
    • Fix a bug in ‘mkinfit’ that prevented summaries of objects fitted with fixed parameters to be generated

    • +
    • Add ‘parms’ and ‘confint’ methods for mkinfit objects. Confidence intervals based on the quadratic approximation as in the summary, and based on the profile likelihood

    • +
    • Move long-running tests to tests/testthat/slow with a separate test log. They currently take around 7 minutes on my system

    • +
    • ‘mkinfit’: Clean the code and return functions to calculate the log-likelihood and the sum of squared residuals

    • +
    • Vignette ‘twa.html’: Add the maximum time weighted average formulas for the hockey stick model

    • +
    • Support frameless plots (‘frame = FALSE’)

    • +
    • Support to suppress the chi2 error level (‘show_errmin = FALSE’) in ‘plot.mmkin’

    • +
    • Update README and the introductory vignette

    • +
    • Report ‘OLS’ as error_model_algorithm in the summary in the case that the default error_model (‘const’) is used

    • +
    • Support summarizing ‘mkinfit’ objects generated with versions < 0.9.49.5

    • +
    +
    +
    +

    +mkin 0.9.49.5 (2019-07-04) 2019-07-04 +

    +
      +
    • Several algorithms for minimization of the negative log-likelihood for non-constant error models (two-component and variance by variable). In the case the error model is constant variance, least squares is used as this is more stable. The default algorithm ‘d_3’ tries direct minimization and a three-step procedure, and returns the model with the highest likelihood.

    • +
    • The argument ‘reweight.method’ to mkinfit and mmkin is now obsolete, use ‘error_model’ and ‘error_model_algorithm’ instead

    • +
    • Add a test that checks if we get the best known AIC for parent only fits to 12 test datasets. Add these test datasets for this purpose.

    • +
    • New function ‘mkinerrplot’. This function is also used for residual plots in ‘plot.mmkin’ if the argument ‘resplot = “errmod”’ is given, and in ‘plot.mkinfit’ if ‘show_errplot’ is set to TRUE.

    • +
    • Remove dependency on FME, only use nlminb for optimisation (‘Port’ algorithm). I cannot remember cases where one of the other optimisation algorithms was preferable, except that I sometime used Levenberg-Marquardt for speed in cases where I did not expect to get trapped in a local minimum.

    • +
    • Use the numDeriv package to calculate hessians. This results in slightly different confidence intervals, takes a bit longer, but is apparently more robust

    • +
    • Add a simple benchmark vignette to document the impact on performance.

    • +
    • The code for manual weighting was removed. This functionality might get added again at a later time. For the time being, please use an earlier version, e.g. 0.9.48.1 if you want to do manual weighting.

    • +
    • The fitting time reported in the summary now includes the time used for calculation of the hessians

    • +
    • Adapt tests

    • +
    • Fix an error in the FOCUS chi2 error level calculations that occurred if parameters were specified in parms.ini that were not in the model. A warning was already issued, but when fitting in parallel via mmkin this could go unnoticed.

    • +
    • Add example datasets obtained from risk assessment reports published by the European Food Safety Agency.

    • +
    +
    +
    +

    +mkin 0.9.48.1 (2019-03-04) 2019-03-04 +

    +
      +
    • Add the function ‘logLik.mkinfit’ which makes it possible to calculate an AIC for mkinfit objects

    • +
    • Add the function ‘AIC.mmkin’ to make it easy to compare columns of mmkin objects

    • +
    • ‘add_err’: Respect the argument giving the number of replicates in the synthetic dataset

    • +
    • ‘max_twa_parent’: Support maximum time weighted average concentration calculations for the hockey stick (HS) model

    • +
    • ‘mkinpredict’: Make the function generic and create a method for mkinfit objects

    • +
    • ‘mkinfit’: Improve the correctness of the fitted two component error model by fitting the mean absolute deviance at each observation against the observed values, weighting with the current two-component error model

    • +
    • ‘tests/testthat/test_irls.R’: Test if the components of the error model used to generate the data can be reproduced with moderate accuracy

    • +
    • Add the function ‘CAKE_export’ to facilitate cross-checking of results

    • +
    • Implement the logistic model (only tested for parent fits)

    • +
    • ‘nafta’: Add evaluations according to the NAFTA guidance

    • +
    +
    +
    +

    +mkin 0.9.47.5 (2018-09-14) 2018-09-14 +

    +
      +
    • Make the two-component error model stop in cases where it is inadequate to avoid nls crashes on windows

    • +
    • Move two vignettes to a location where they will not be built on CRAN (to avoid more NOTES from long execution times)

    • +
    • Exclude more example code from testing on CRAN to avoid NOTES from long execution times

    • +
    +
    +
    +

    +mkin 0.9.47.3 Unreleased +

    +
      +
    • ‘mkinfit’: Improve fitting the error model for reweight.method = ‘tc’. Add ‘manual’ to possible arguments for ‘weight’

    • +
    • Test that FOCUS_2006_C can be evaluated with DFOP and reweight.method = ‘tc’

    • +
    +
    +
    +

    +mkin 0.9.47.2 (2018-07-19) 2018-07-19 +

    +
      +
    • ‘sigma_twocomp’: Rename ‘sigma_rl’ to ‘sigma_twocomp’ as the Rocke and Lorenzato model assumes lognormal distribution for large y. Correct references to the Rocke and Lorenzato model accordingly.

    • +
    • ‘mkinfit’: Use 1.1 as starting value for N parameter of IORE models to obtain convergence in more difficult cases. Show parameter names when ‘trace_parms’ is ‘TRUE’.

    • +
    +
    +
    +

    +mkin 0.9.47.1 (2018-02-06) 2018-02-06 +

    +
      +
    • Skip some tests on CRAN and winbuilder to avoid timeouts

    • +
    • ‘test_data_from_UBA_2014’: Added this list of datasets containing experimental data used in the expertise from 2014

    • +
    • ‘mkinfit’: Added the iterative reweighting method ‘tc’ using the two-component error model from Rocke and Lorenzato. NA values in the data are not returned any more.

    • +
    • ‘mkinfit’: Work around a bug in the current FME version that prevented the convergence message to be returned in the case of non-convergence.

    • +
    • ‘summary.mkinfit’: Improved output regarding weighting method. No predictions are returned for NA values in the model (see above).

    • +
    • ‘summary.mkinfit’: Show versions of mkin and R used for fitting (not the ones used for the summary) if the fit was generated with mkin >= 0.9.47.1

    • +
    +
    +
    +

    +mkin 0.9.46.3 (2017-11-16) 2017-11-16 +

    +
      +
    • README.md, vignettes/mkin.Rmd: URLs were updated

    • +
    • synthetic_data_for_UBA: Add the code used to generate the data in the interest of reproducibility

    • +
    +
    +
    +

    +mkin 0.9.46.2 (2017-10-10) 2017-10-10 +

    +
      +
    • Converted the vignette FOCUS_Z from tex/pdf to markdown/html

    • +
    • DESCRIPTION: Add ORCID

    • +
    +
    +
    +

    +mkin 0.9.46.1 (2017-09-14) 2017-09-14 +

    +
      +
    • plot.mkinfit: Fix scaling of residual plots for the case of separate plots for each observed variable

    • +
    • plot.mkinfit: Use all data points of the fitted curve for y axis scaling for the case of separate plots for each observed variable

    • +
    • Documentation updates

    • +
    +
    +
    +

    +mkin 0.9.46 (2017-07-24) 2017-07-29 +

    +
      +
    • Remove test_FOMC_ill-defined.R as it is too platform dependent
    • +
    +
    +
    +

    +mkin 0.9.45.2 (2017-07-24) 2017-07-22 +

    +
      +
    • Rename twa to max_twa_parent to avoid conflict with twa from my pfm package

    • +
    • Update URLs in documentation

    • +
    • Limit test code to one core to pass on windows

    • +
    • Switch from microbenchmark to rbenchmark as the former is not supported on all platforms

    • +
    +
    +
    +

    +mkin 0.9.45.1 (2016-12-20) Unreleased +

    +
    +

    +New features

    +
      +
    • A twa function, calculating maximum time weighted average concentrations for the parent (SFO, FOMC and DFOP).
    • +
    +
    +
    +
    +

    +mkin 0.9.45 (2016-12-08) 2016-12-08 +

    +
    +

    +Minor changes

    +
      +
    • plot.mkinfit and plot.mmkin: If the plotting device is tikz, LaTeX markup is being used for the chi2 error in the graphs.

    • +
    • Use pkgdown, the successor of staticdocs for generating static HTML documentation. Include example output and graphs also for dontrun sections.

    • +
    • plot.mkinfit: Plotting does not fail any more when the compiled model is not available, e.g. because it was removed from the temporary directory. In this case, the uncompiled model is now used for plotting

    • +
    +
    +
    +
    +

    +mkin 0.9.44 (2016-06-29) 2016-06-29 +

    +
    +

    +Bug fixes

    +
      +
    • The test test_FOMC_ill-defined failed on several architectures, so the test is now skipped
    • +
    +
    +
    +
    +

    +mkin 0.9.43 (2016-06-28) 2016-06-28 +

    +
    +

    +Major changes

    +
      +
    • The title was changed to Kinetic evaluations of chemical degradation data

    • +
    • plot.mkinfit: Add the possibility to show fits (and residual plots if requested) separately for the observed variables

    • +
    • plot.mkinfit: Add the possibility to show the chi2 error levels in the plot, similar to the way they are shown in plot.mmkin

    • +
    • plot_sep: Add this function as a convenience wrapper for plotting observed variables of mkinfit objects separately, with chi2 error values and residual plots.

    • +
    • Vignettes: The main vignette mkin was converted to R markdown and updated. The other vignettes were also updated to show current improved functionality.

    • +
    • The function add_err was added to the package, making it easy to generate simulated data using an error model based on the normal distribution

    • +
    +
    +
    +

    +Minor changes

    +
      +
    • Remove an outdated reference to the inline package in the compiled_models vignette

    • +
    • mkinfit: Do not error out in cases where the fit converges, but the Jacobian for the untransformed model cost can not be estimated. Give a warning instead and return NA for the t-test results.

    • +
    • summary.mkinfit: Give a warning message when the covariance matrix can not be obtained.

    • +
    • A test has been added to containing a corresponding edge case to check that the warnings are correctly issued and the fit does not terminate.

    • +
    • plot.mmkin: Round the chi2 error value to three significant digits, instead of two decimal digits.

    • +
    • mkinfit: Return the err values used on weighted fits as a column named err. Also include these inverse weights when the column value in the observed data is used, which is returned as observed in the data component of the mkinfit object.

    • +
    +
    +
    +

    +Bug fixes

    +
      +
    • endpoints: When the name of a substance degrading to a metabolite (e.g. a parent compound) used in the model formulation ended in the letter f, some rate parameters could be listed as formation fractions with mixed up names. These would also appear in the summary.

    • +
    • mkinfit: Check for all observed variables when checking if the user tried to fix formation fractions when fitting them using ilr transformation.

    • +
    • plot.mmkin: Set the plot margins correctly, also in the case of a single fit to be plotted, so the main title is placed in a reasonable way.

    • +
    • plot.mkinfit: Correct default values for col_obs, pch_obs and lty_obs for the case that obs_vars is specified.

    • +
    +
    +
    +
    +

    +mkin 0.9.42 (2016-03-25) 2016-03-25 +

    +
    +

    +Major changes

    +
      +
    • Add the argument from_max_mean to mkinfit, for fitting only the decline from the maximum observed value for models with a single observed variable
    • +
    +
    +
    +

    +Minor changes

    +
      +
    • Add plots to compiled_models vignette

    • +
    • Give an explanatory error message when mkinmod fails due to a missing definition of a target variable

    • +
    • print.mkinmod(): Improve formatting when printing mkinmod model definitions

    • +
    +
    +
    +
    +

    +mkin 0.9-41 (2015-11-09) 2015-11-09 +

    +
    +

    +Minor changes

    +
      +
    • Add an R6 class mkinds representing datasets with a printing method

    • +
    • Add a printing method for mkinmod objects

    • +
    • Make it possible to specify arbitrary strings as names for the compounds in mkinmod, and show them in the plot

    • +
    • Use an index.r file to group help topics in static documentation

    • +
    +
    +
    +

    +Bug fixes

    +
      +
    • +print.summary.mkinfit(): Avoid an error that occurred when printing summaries generated with mkin versions before 0.9-36
    • +
    +
    +
    +
    +

    +mkin 0.9-40 (2015-07-21) 2015-07-21 +

    +
    +

    +Bug fixes

    +
      +
    • +endpoints(): For DFOP and SFORB models, where optimize() is used, make use of the fact that the DT50 must be between DT50_k1 and DT50_k2 (DFOP) or DT50_b1 and DT50_b2 (SFORB), as optimize() sometimes did not find the minimum. Likewise for finding DT90 values. Also fit on the log scale to make the function more efficient.
    • +
    +
    +
    +

    +Internal changes

    +
      +
    • +DESCRIPTION, NAMESPACE, R/*.R: Import (from) stats, graphics and methods packages, and qualify some function calls for non-base packages installed with R to avoid NOTES made by R CMD check –as-cran with upcoming R versions.
    • +
    +
    +
    +
    +

    +mkin 0.9-39 (2015-06-26) 2015-06-26 +

    +
    +

    +Major changes

    +
      +
    • New function mmkin(): This function takes a character vector of model shorthand names, or alternatively a list of mkinmod models, as well as a list of dataset as main arguments. It returns a matrix of mkinfit objects, with a row for each model and a column for each dataset. A subsetting method with single brackets is available. Fitting the models in parallel using the parallel package is supported.

    • +
    • New function plot.mmkin(): Plots single-row or single-column mmkin objects including residual plots.

    • +
    +
    +
    +

    +Bug fixes

    +
      +
    • +mkinparplot(): Fix the x axis scaling for rate constants and formation fractions that got confused by the introduction of the t-values of transformed parameters.
    • +
    +
    +
    +
    +

    +mkin 0.9-38 (2015-06-24) 2015-06-23 +

    +
    +

    +Minor changes

    +
      +
    • vignettes/compiled_models.html: Show the performance improvement factor actually obtained when building the vignette, as well as mkin version, some system info and the CPU model used for building the vignette.

    • +
    • GNUMakefile,vignettes/*: Clean up vignette generation and include table of contents in HTML vignettes.

    • +
    +
    +
    +

    +Bug fixes

    +
      +
    • +mkinmod(): When generating the C code for the derivatives, only declare the time variable when it is needed and remove the ‘-W-no-unused-variable’ compiler flag as the C compiler used in the CRAN checks on Solaris does not know it.
    • +
    +
    +
    +
    +

    +mkin 0.9-36 (2015-06-21) 2015-06-21 +

    +
    +

    +Major changes

    +
      +
    • summary.mkinfit(): A one-sided t-test for significant difference of untransformed parameters from zero is now always shown, based on the assumption of normal distribution for estimators of all untransformed parameters. Use with caution, as this assumption is unrealistic e.g. for rate constants in these nonlinear kinetic models.

    • +
    • If a compiler (gcc) is installed, use a version of the differential equation model compiled from C code, which is a huge performance boost for models where only the deSolve method works.

    • +
    • mkinmod(): Create a list component $cf (of class CFuncList) in the list returned by mkinmod, if a version can be compiled from autogenerated C code (see above).

    • +
    • mkinfit(): Set the default solution_type to deSolve when a compiled version of the model is present, except when an analytical solution is possible.

    • +
    +
    +
    +

    +Minor changes

    +
      +
    • Added a simple showcase vignette with an evaluation of FOCUS example dataset D
    • +
    +
    +
    +
    +

    +mkin 0.9-35 (2015-05-15) 2015-05-15 +

    +
    +

    +Major changes

    +
      +
    • Switch from RUnit to testthat for testing
    • +
    +
    +
    +

    +Bug fixes

    +
      +
    • mkinparplot(): Avoid warnings that occurred when not all confidence intervals were available in the summary of the fit

    • +
    • print.summary.mkinfit(): Fix printing the summary for the case that the number of iterations is not available

    • +
    • NAMESPACE: export S3 methods plot.mkinfit, summary.mkinfit and print.summary.mkinfit to satisfy R CMD check on R-devel

    • +
    • mkinparplot(): Avoid warning in R CMD check about undeclared global variable Lower

    • +
    +
    +
    +

    +New features

    +
      +
    • mkinfit(): Report successful termination when quiet = FALSE. This is helpful for more difficult problems fitted with reweight.method = obs, as no progress is often indicated during the reweighting.

    • +
    • A first test using results established in the expertise written for the German Federal Environmental Agency (UBA) was added.

    • +
    • Add synthetic datasets generated for expertise written for the German Federal Environmental Agency UBA

    • +
    • Add tests based on these datasets

    • +
    +
    +
    +
    +

    +mkin 0.9-34 (2014-11-22) 2014-11-22 +

    +
    +

    +New features

    +
      +
    • Add the convenience function mkinsub() for creating the lists used in mkinmod()

    • +
    • Add the possibility to fit indeterminate order rate equation (IORE) models using an analytical solution (parent only) or a numeric solution. Paths from IORE compounds to metabolites are supported when using formation fractions (use_of_ff = ‘max’). Note that the numerical solution (method.ode = ‘deSolve’) of the IORE differential equations sometimes fails due to numerical problems.

    • +
    • Switch to using the Port algorithm (using a model/trust region approach) per default. While needing more iterations than the Levenberg-Marquardt algorithm previously used per default, it is less sensitive to starting parameters.

    • +
    +
    +
    +

    +Minor changes

    +
      +
    • The formatting of differential equations in the summary was further improved

    • +
    • Always include 0 on y axis when plotting during the fit

    • +
    +
    +
    +
    +

    +mkin 0.9-33 (2014-10-22) 2014-10-12 +

    +
    +

    +New features

    +
      +
    • The initial value (state.ini) for the observed variable with the highest observed residue is set to 100 in case it has no time zero observation and state.ini = "auto"

    • +
    • A basic unit test for mkinerrmin() was written

    • +
    +
    +
    +

    +Bug fixes

    +
      +
    • mkinfit(): The internally fitted parameter for g was named g_ilr even when transform_fractions=FALSE

    • +
    • mkinfit(): The initial value (state.ini) for the parent compound was not set when the parent was not the (only) variable with the highest value in the observed data.

    • +
    • mkinerrmin(): When checking for degrees of freedom for metabolites, check if their time zero value is fixed instead of checking if the observed value is zero. This ensures correct calculation of degrees of freedom also in cases where the metabolite residue at time zero is greater zero.

    • +
    • plot.mkinfit(): Avoid a warning message about only using the first component of ylim that occurred when ylim was specified explicitly

    • +
    +
    +
    +

    +Minor changes

    +
      +
    • The formatting of differential equations in the summary was improved by wrapping overly long lines

    • +
    • The FOCUS_Z vignette was rebuilt with the above improvement and using a width of 70 to avoid output outside of the grey area

    • +
    • print.summary.mkinfit(): Avoid a warning that occurred when gmkin showed summaries of initial fits without iterations

    • +
    • mkinfit(): Avoid a warning that occurred when summarising a fit that was performed with maxitmodFit = 0 as done in gmkin for configuring new fits.

    • +
    +
    +
    +
    +

    +mkin 0.9-32 (2014-07-24) 2014-07-24 +

    +
    +

    +New features

    +
      +
    • The number of degrees of freedom is difficult to define in the case of ilr transformation of formation fractions. Now for each source compartment the number of ilr parameters (=number of optimised parameters) is divided by the number of pathways to metabolites (=number of affected data series) which leads to fractional degrees of freedom in some cases.

    • +
    • The default for the initial value for the first state value is now taken from the mean of the observations at time zero, if available.

    • +
    • The kinetic model can alternatively be specified with a shorthand name for parent only degradation models, e.g. SFO, or DFOP.

    • +
    • Optimisation method, number of model evaluations and time elapsed during optimisation are given in the summary of mkinfit objects.

    • +
    • The maximum number of iterations in the optimisation algorithm can be specified using the argument maxit.modFit to the mkinfit function.

    • +
    • mkinfit gives a warning when the fit does not converge (does not apply to SANN method). This warning is included in the summary.

    • +
    +
    +
    +

    +Bug fixes

    +
      +
    • Avoid plotting an artificial 0 residual at time zero in mkinresplot

    • +
    • In the determination of the degrees of freedom in mkinerrmin, formation fractions were accounted for multiple times in the case of parallel formation of metabolites. See the new feature described above for the solution.

    • +
    • transform_rates=FALSE in mkinfit now also works for FOMC and HS models.

    • +
    • Initial values for formation fractions were not set in all cases.

    • +
    • No warning was given when the fit did not converge when a method other than the default Levenberg-Marquardt method Marq was used.

    • +
    +
    +
    +

    +Minor changes

    +
      +
    • Vignettes were rebuilt to reflect the changes in the summary method.

    • +
    • Algorithm Pseudo was excluded because it needs user-defined parameter limits which are not supported.

    • +
    • Algorithm Newton was excluded because of its different way to specify the maximum number of iterations and because it does not appear to provide additional benefits.

    • +
    +
    +
    +
    +

    +mkin 0.9-31 (2014-07-14) 2014-07-14 +

    +
    +

    +Bug fixes

    +
      +
    • The internal renaming of optimised parameters in Version 0.9-30 led to errors in the determination of the degrees of freedom for the chi2 error level calulations in mkinerrmin() used by the summary function.
    • +
    +
    +
    +
    +

    +mkin 0.9-30 (2014-07-11) 2014-07-11 +

    +
    +

    +New features

    +
      +
    • It is now possible to use formation fractions in combination with turning off the sink in mkinmod().
    • +
    +
    +
    +

    +Major changes

    +
      +
    • The original and the transformed parameters now have different names (e.g. k_parent and log_k_parent. They also differ in how many they are when we have formation fractions but no pathway to sink.

    • +
    • The order of some of the information blocks in print.summary.mkinfit.R() has been ordered in a more logical way.

    • +
    +
    +
    +

    +Minor changes

    +
      +
    • The vignette FOCUS_Z has been simplified to use formation fractions with turning off the sink, and slightly amended to use the new versions of DT50 values calculated since mkin 0.9-29.

    • +
    • All vignettes have been rebuilt so they reflect all changes.

    • +
    • The ChangeLog was renamed to NEWS.md and the entries were converted to markdown syntax compatible with the tools::news() function built into R.

    • +
    • The test suite was overhauled. Tests of the DFOP and SFORB models with dataset FOCUS_2006_A were removed, as they were too much dependent on the optimisation algorithm and/or starting parameters, because the dataset is SFO (compare kinfit vignette).

    • +
    • Also, the Schaefer complex case can now be fitted using formation fractions, and with the ‘Port’ optimisation method we also fit A2 in the same way as published in the Piacenza paper.

    • +
    • Some more checks were introduced to mkinfit(), leading to warnings or stopping execution if unsupported combinations of methods and parameters are requested.

    • +
    +
    +
    +
    +

    +mkin 0.9-29 (2014-06-27) 2014-06-27 +

    +
      +
    • R/mkinresplot.R: Make it possible to specify xlim

    • +
    • R/geometric_mean.R, man/geometric_mean.Rd: Add geometric mean function

    • +
    • R/endpoints.R, man/endpoints.Rd: Calculate additional (pseudo)-DT50 values for FOMC, DFOP, HS and SFORB. Avoid calculation of formation fractions from rate constants when they are directly fitted

    • +
    +
    +
    +

    +mkin 0.9-28 (2014-05-20) 2014-05-20 +

    +
      +
    • Do not backtransform confidence intervals for formation fractions if more than one compound is formed, as such parameters only define the pathways as a set

    • +
    • Add historical remarks and some background to the main package vignette

    • +
    • Correct ‘isotropic’ into ‘isometric’ for the ilr transformation

    • +
    +
    +
    +

    +mkin 0.9-27 (2014-05-10) 2014-05-10 +

    +
      +
    • Fork the GUI into a separate package gmkin

    • +
    • DESCRIPTION, NAMESPACE, TODO: Adapt and add copyright information

    • +
    • Remove files belonging to the GUI

    • +
    • Possibility to fit without parameter transformations, using bounds as implemented in FME

    • +
    • Add McCall 2,4,5-T dataset

    • +
    • Enable selection of observed variables in plotting

    • +
    • Add possibility to show residual plot in plot.mkinfit

    • +
    • R/mkinparplot.R, man/mkinparplot.Rd: plot parameters with confidence intervals

    • +
    • Change vignette format from Sweave to knitr

    • +
    • Split examples vignette to FOCUS_L and FOCUS_Z

    • +
    • Remove warning about constant formation fractions in mkinmod as it was based on a misconception

    • +
    • Restrict the unit test with the Schaefer data to parent and primary metabolites as formation fraction and DT50 for A2 are highly correlated and passing the test is platform dependent. For example, the test fails in 1 out of 14 platforms on CRAN as of today.

    • +
    • Add Eurofins Regulatory AG copyright notices

    • +
    • Import FME and deSolve instead of depending on them to have clean startup

    • +
    • Add a starter function for the GUI: gmkin()

    • +
    • Change the format of the workspace files of gmkin so they can be distributed and documented in the package

    • +
    • Add gmkin workspace datasets FOCUS_2006_gmkin and FOCUS_2006_Z_gmkin

    • +
    +
    +
    +

    +mkin 0.9-24 (2013-11-06) 2013-11-06 +

    +
      +
    • Bugfix re-enabling the fixing of any combination of initial values for state variables

    • +
    • Default values for kinetic rate constants are not all 0.1 any more but are “salted” with a small increment to avoid numeric artefacts with the eigenvalue based solutions

    • +
    • Backtransform fixed ODE parameters for the summary

    • +
    +
    +
    +

    +mkin 0.9-22 (2013-10-26) 2013-10-26 +

    +
      +
    • Get rid of the optimisation step in mkinerrmin - this was unnecessary. Thanks to KinGUII for the inspiration - actually this is equation 6-2 in FOCUS kinetics p. 91 that I had overlooked originally

    • +
    • Fix plot.mkinfit as it passed graphical arguments like main to the solver

    • +
    • Do not use plot=TRUE in mkinfit() example

    • +
    • The first successful fits in the not so simple GUI

    • +
    • Fix iteratively reweighted least squares for the case of many metabolites

    • +
    • Unify naming of initial values of state variables

    • +
    • Unify naming in dataframes of optimised and fixed parameters in the summary

    • +
    • Show the weighting method for residuals in the summary

    • +
    • Correct the output of the data in the case of manual weighting

    • +
    • Implement IRLS assuming different variances for observed variables

    • +
    • Do not use 0 values at time zero for chi2 error level calculations. This is the way it is done in KinGUII and it makes sense. It does impact the chi2 error levels in the output. Generally they seem to be lower for metabolites now, presumably because the mean of the observed values is higher

    • +
    +

    For a detailed list of changes to the mkin source please consult the commit history on http://github.com/jranke/mkin

    +
    +
    + + + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/pkgdown.css b/docs/dev/pkgdown.css new file mode 100644 index 00000000..c01e5923 --- /dev/null +++ b/docs/dev/pkgdown.css @@ -0,0 +1,367 @@ +/* Sticky footer */ + +/** + * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ + * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css + * + * .Site -> body > .container + * .Site-content -> body > .container .row + * .footer -> footer + * + * Key idea seems to be to ensure that .container and __all its parents__ + * have height set to 100% + * + */ + +html, body { + height: 100%; +} + +body { + position: relative; +} + +body > .container { + display: flex; + height: 100%; + flex-direction: column; +} + +body > .container .row { + flex: 1 0 auto; +} + +footer { + margin-top: 45px; + padding: 35px 0 36px; + border-top: 1px solid #e5e5e5; + color: #666; + display: flex; + flex-shrink: 0; +} +footer p { + margin-bottom: 0; +} +footer div { + flex: 1; +} +footer .pkgdown { + text-align: right; +} +footer p { + margin-bottom: 0; +} + +img.icon { + float: right; +} + +img { + max-width: 100%; +} + +/* Fix bug in bootstrap (only seen in firefox) */ +summary { + display: list-item; +} + +/* Typographic tweaking ---------------------------------*/ + +.contents .page-header { + margin-top: calc(-60px + 1em); +} + +dd { + margin-left: 3em; +} + +/* Section anchors ---------------------------------*/ + +a.anchor { + margin-left: -30px; + display:inline-block; + width: 30px; + height: 30px; + visibility: hidden; + + background-image: url(./link.svg); + background-repeat: no-repeat; + background-size: 20px 20px; + background-position: center center; +} + +.hasAnchor:hover a.anchor { + visibility: visible; +} + +@media (max-width: 767px) { + .hasAnchor:hover a.anchor { + visibility: hidden; + } +} + + +/* Fixes for fixed navbar --------------------------*/ + +.contents h1, .contents h2, .contents h3, .contents h4 { + padding-top: 60px; + margin-top: -40px; +} + +/* Navbar submenu --------------------------*/ + +.dropdown-submenu { + position: relative; +} + +.dropdown-submenu>.dropdown-menu { + top: 0; + left: 100%; + margin-top: -6px; + margin-left: -1px; + border-radius: 0 6px 6px 6px; +} + +.dropdown-submenu:hover>.dropdown-menu { + display: block; +} + +.dropdown-submenu>a:after { + display: block; + content: " "; + float: right; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; + border-width: 5px 0 5px 5px; + border-left-color: #cccccc; + margin-top: 5px; + margin-right: -10px; +} + +.dropdown-submenu:hover>a:after { + border-left-color: #ffffff; +} + +.dropdown-submenu.pull-left { + float: none; +} + +.dropdown-submenu.pull-left>.dropdown-menu { + left: -100%; + margin-left: 10px; + border-radius: 6px 0 6px 6px; +} + +/* Sidebar --------------------------*/ + +#pkgdown-sidebar { + margin-top: 30px; + position: -webkit-sticky; + position: sticky; + top: 70px; +} + +#pkgdown-sidebar h2 { + font-size: 1.5em; + margin-top: 1em; +} + +#pkgdown-sidebar h2:first-child { + margin-top: 0; +} + +#pkgdown-sidebar .list-unstyled li { + margin-bottom: 0.5em; +} + +/* bootstrap-toc tweaks ------------------------------------------------------*/ + +/* All levels of nav */ + +nav[data-toggle='toc'] .nav > li > a { + padding: 4px 20px 4px 6px; + font-size: 1.5rem; + font-weight: 400; + color: inherit; +} + +nav[data-toggle='toc'] .nav > li > a:hover, +nav[data-toggle='toc'] .nav > li > a:focus { + padding-left: 5px; + color: inherit; + border-left: 1px solid #878787; +} + +nav[data-toggle='toc'] .nav > .active > a, +nav[data-toggle='toc'] .nav > .active:hover > a, +nav[data-toggle='toc'] .nav > .active:focus > a { + padding-left: 5px; + font-size: 1.5rem; + font-weight: 400; + color: inherit; + border-left: 2px solid #878787; +} + +/* Nav: second level (shown on .active) */ + +nav[data-toggle='toc'] .nav .nav { + display: none; /* Hide by default, but at >768px, show it */ + padding-bottom: 10px; +} + +nav[data-toggle='toc'] .nav .nav > li > a { + padding-left: 16px; + font-size: 1.35rem; +} + +nav[data-toggle='toc'] .nav .nav > li > a:hover, +nav[data-toggle='toc'] .nav .nav > li > a:focus { + padding-left: 15px; +} + +nav[data-toggle='toc'] .nav .nav > .active > a, +nav[data-toggle='toc'] .nav .nav > .active:hover > a, +nav[data-toggle='toc'] .nav .nav > .active:focus > a { + padding-left: 15px; + font-weight: 500; + font-size: 1.35rem; +} + +/* orcid ------------------------------------------------------------------- */ + +.orcid { + font-size: 16px; + color: #A6CE39; + /* margins are required by official ORCID trademark and display guidelines */ + margin-left:4px; + margin-right:4px; + vertical-align: middle; +} + +/* Reference index & topics ----------------------------------------------- */ + +.ref-index th {font-weight: normal;} + +.ref-index td {vertical-align: top;} +.ref-index .icon {width: 40px;} +.ref-index .alias {width: 40%;} +.ref-index-icons .alias {width: calc(40% - 40px);} +.ref-index .title {width: 60%;} + +.ref-arguments th {text-align: right; padding-right: 10px;} +.ref-arguments th, .ref-arguments td {vertical-align: top;} +.ref-arguments .name {width: 20%;} +.ref-arguments .desc {width: 80%;} + +/* Nice scrolling for wide elements --------------------------------------- */ + +table { + display: block; + overflow: auto; +} + +/* Syntax highlighting ---------------------------------------------------- */ + +pre { + word-wrap: normal; + word-break: normal; + border: 1px solid #eee; +} + +pre, code { + background-color: #f8f8f8; + color: #333; +} + +pre code { + overflow: auto; + word-wrap: normal; + white-space: pre; +} + +pre .img { + margin: 5px 0; +} + +pre .img img { + background-color: #fff; + display: block; + height: auto; +} + +code a, pre a { + color: #375f84; +} + +a.sourceLine:hover { + text-decoration: none; +} + +.fl {color: #1514b5;} +.fu {color: #000000;} /* function */ +.ch,.st {color: #036a07;} /* string */ +.kw {color: #264D66;} /* keyword */ +.co {color: #888888;} /* comment */ + +.message { color: black; font-weight: bolder;} +.error { color: orange; font-weight: bolder;} +.warning { color: #6A0366; font-weight: bolder;} + +/* Clipboard --------------------------*/ + +.hasCopyButton { + position: relative; +} + +.btn-copy-ex { + position: absolute; + right: 0; + top: 0; + visibility: hidden; +} + +.hasCopyButton:hover button.btn-copy-ex { + visibility: visible; +} + +/* headroom.js ------------------------ */ + +.headroom { + will-change: transform; + transition: transform 200ms linear; +} +.headroom--pinned { + transform: translateY(0%); +} +.headroom--unpinned { + transform: translateY(-100%); +} + +/* mark.js ----------------------------*/ + +mark { + background-color: rgba(255, 255, 51, 0.5); + border-bottom: 2px solid rgba(255, 153, 51, 0.3); + padding: 1px; +} + +/* vertical spacing after htmlwidgets */ +.html-widget { + margin-bottom: 10px; +} + +/* fontawesome ------------------------ */ + +.fab { + font-family: "Font Awesome 5 Brands" !important; +} + +/* don't display links in code chunks when printing */ +/* source: https://stackoverflow.com/a/10781533 */ +@media print { + code a:link:after, code a:visited:after { + content: ""; + } +} diff --git a/docs/dev/pkgdown.js b/docs/dev/pkgdown.js new file mode 100644 index 00000000..7e7048fa --- /dev/null +++ b/docs/dev/pkgdown.js @@ -0,0 +1,108 @@ +/* http://gregfranko.com/blog/jquery-best-practices/ */ +(function($) { + $(function() { + + $('.navbar-fixed-top').headroom(); + + $('body').css('padding-top', $('.navbar').height() + 10); + $(window).resize(function(){ + $('body').css('padding-top', $('.navbar').height() + 10); + }); + + $('[data-toggle="tooltip"]').tooltip(); + + var cur_path = paths(location.pathname); + var links = $("#navbar ul li a"); + var max_length = -1; + var pos = -1; + for (var i = 0; i < links.length; i++) { + if (links[i].getAttribute("href") === "#") + continue; + // Ignore external links + if (links[i].host !== location.host) + continue; + + var nav_path = paths(links[i].pathname); + + var length = prefix_length(nav_path, cur_path); + if (length > max_length) { + max_length = length; + pos = i; + } + } + + // Add class to parent
  • , and enclosing
  • if in dropdown + if (pos >= 0) { + var menu_anchor = $(links[pos]); + menu_anchor.parent().addClass("active"); + menu_anchor.closest("li.dropdown").addClass("active"); + } + }); + + function paths(pathname) { + var pieces = pathname.split("/"); + pieces.shift(); // always starts with / + + var end = pieces[pieces.length - 1]; + if (end === "index.html" || end === "") + pieces.pop(); + return(pieces); + } + + // Returns -1 if not found + function prefix_length(needle, haystack) { + if (needle.length > haystack.length) + return(-1); + + // Special case for length-0 haystack, since for loop won't run + if (haystack.length === 0) { + return(needle.length === 0 ? 0 : -1); + } + + for (var i = 0; i < haystack.length; i++) { + if (needle[i] != haystack[i]) + return(i); + } + + return(haystack.length); + } + + /* Clipboard --------------------------*/ + + function changeTooltipMessage(element, msg) { + var tooltipOriginalTitle=element.getAttribute('data-original-title'); + element.setAttribute('data-original-title', msg); + $(element).tooltip('show'); + element.setAttribute('data-original-title', tooltipOriginalTitle); + } + + if(ClipboardJS.isSupported()) { + $(document).ready(function() { + var copyButton = ""; + + $(".examples, div.sourceCode").addClass("hasCopyButton"); + + // Insert copy buttons: + $(copyButton).prependTo(".hasCopyButton"); + + // Initialize tooltips: + $('.btn-copy-ex').tooltip({container: 'body'}); + + // Initialize clipboard: + var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { + text: function(trigger) { + return trigger.parentNode.textContent; + } + }); + + clipboardBtnCopies.on('success', function(e) { + changeTooltipMessage(e.trigger, 'Copied!'); + e.clearSelection(); + }); + + clipboardBtnCopies.on('error', function() { + changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); + }); + }); + } +})(window.jQuery || window.$) diff --git a/docs/dev/pkgdown.yml b/docs/dev/pkgdown.yml new file mode 100644 index 00000000..0dbb110e --- /dev/null +++ b/docs/dev/pkgdown.yml @@ -0,0 +1,17 @@ +pandoc: 2.2.1 +pkgdown: 1.5.1 +pkgdown_sha: ~ +articles: + FOCUS_D: FOCUS_D.html + FOCUS_L: FOCUS_L.html + mkin: mkin.html + twa: twa.html + FOCUS_Z: web_only/FOCUS_Z.html + NAFTA_examples: web_only/NAFTA_examples.html + benchmarks: web_only/benchmarks.html + compiled_models: web_only/compiled_models.html +last_built: 2020-05-27T03:53Z +urls: + reference: https://pkgdown.jrwb.de/mkin/reference + article: https://pkgdown.jrwb.de/mkin/articles + diff --git a/docs/dev/reference/AIC.mmkin.html b/docs/dev/reference/AIC.mmkin.html new file mode 100644 index 00000000..517aff12 --- /dev/null +++ b/docs/dev/reference/AIC.mmkin.html @@ -0,0 +1,240 @@ + + + + + + + + +Calculate the AIC for a column of an mmkin object — AIC.mmkin • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Provides a convenient way to compare different kinetic models fitted to the +same dataset.

    +
    + +
    # S3 method for mmkin
    +AIC(object, ..., k = 2)
    +
    +# S3 method for mmkin
    +BIC(object, ...)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    object

    An object of class mmkin, containing only one +column.

    ...

    For compatibility with the generic method

    k

    As in the generic method

    + +

    Value

    + +

    As in the generic method (a numeric value for single fits, or a +dataframe if there are several fits in the column).

    + +

    Examples

    +
    + # skip, as it takes > 10 s on winbuilder + f <- mmkin(c("SFO", "FOMC", "DFOP"), + list("FOCUS A" = FOCUS_2006_A, + "FOCUS C" = FOCUS_2006_C), cores = 1, quiet = TRUE)
    #> Warning: Optimisation did not converge: +#> false convergence (8)
    # We get a warning because the FOMC model does not converge for the + # FOCUS A dataset, as it is well described by SFO + + AIC(f["SFO", "FOCUS A"]) # We get a single number for a single fit
    #> [1] 55.28197
    AIC(f[["SFO", "FOCUS A"]]) # or when extracting an mkinfit object
    #> [1] 55.28197
    + # For FOCUS A, the models fit almost equally well, so the higher the number + # of parameters, the higher (worse) the AIC + AIC(f[, "FOCUS A"])
    #> df AIC +#> SFO 3 55.28197 +#> FOMC 4 57.28202 +#> DFOP 5 59.28197
    AIC(f[, "FOCUS A"], k = 0) # If we do not penalize additional parameters, we get nearly the same
    #> df AIC +#> SFO 3 49.28197 +#> FOMC 4 49.28202 +#> DFOP 5 49.28197
    BIC(f[, "FOCUS A"]) # Comparing the BIC gives a very similar picture
    #> df BIC +#> SFO 3 55.52030 +#> FOMC 4 57.59979 +#> DFOP 5 59.67918
    + # For FOCUS C, the more complex models fit better + AIC(f[, "FOCUS C"])
    #> df AIC +#> SFO 3 59.29336 +#> FOMC 4 44.68652 +#> DFOP 5 29.02372
    BIC(f[, "FOCUS C"])
    #> df BIC +#> SFO 3 59.88504 +#> FOMC 4 45.47542 +#> DFOP 5 30.00984
    + +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/CAKE_export.html b/docs/dev/reference/CAKE_export.html new file mode 100644 index 00000000..ce8a3444 --- /dev/null +++ b/docs/dev/reference/CAKE_export.html @@ -0,0 +1,261 @@ + + + + + + + + +Export a list of datasets format to a CAKE study file — CAKE_export • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    In addition to the datasets, the pathways in the degradation model can be +specified as well.

    +
    + +
    CAKE_export(
    +  ds,
    +  map = c(parent = "Parent"),
    +  links = NA,
    +  filename = "CAKE_export.csf",
    +  path = ".",
    +  overwrite = FALSE,
    +  study = "Codlemone aerobic soil degradation",
    +  description = "",
    +  time_unit = "days",
    +  res_unit = "% AR",
    +  comment = "Created using mkin::CAKE_export",
    +  date = Sys.Date(),
    +  optimiser = "IRLS"
    +)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ds

    A named list of datasets in long format as compatible with +mkinfit.

    map

    A character vector with CAKE compartment names (Parent, A1, ...), +named with the names used in the list of datasets.

    links

    An optional character vector of target compartments, named with +the names of the source compartments. In order to make this easier, the +names are used as in the datasets supplied.

    filename

    Where to write the result. Should end in .csf in order to be +compatible with CAKE.

    path

    An optional path to the output file.

    overwrite

    If TRUE, existing files are overwritten.

    study

    The name of the study.

    description

    An optional description.

    time_unit

    The time unit for the residue data.

    res_unit

    The unit used for the residues.

    comment

    An optional comment.

    date

    The date of file creation.

    optimiser

    Can be OLS or IRLS.

    + +

    Value

    + +

    The function is called for its side effect.

    + +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/DFOP.solution-1.png b/docs/dev/reference/DFOP.solution-1.png new file mode 100644 index 00000000..a2d75ccc Binary files /dev/null and b/docs/dev/reference/DFOP.solution-1.png differ diff --git a/docs/dev/reference/DFOP.solution.html b/docs/dev/reference/DFOP.solution.html new file mode 100644 index 00000000..48c3aabb --- /dev/null +++ b/docs/dev/reference/DFOP.solution.html @@ -0,0 +1,236 @@ + + + + + + + + +Double First-Order in Parallel kinetics — DFOP.solution • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Function describing decline from a defined starting value using the sum of +two exponential decline functions.

    +
    + +
    DFOP.solution(t, parent_0, k1, k2, g)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + +
    t

    Time.

    parent_0

    Starting value for the response variable at time zero.

    k1

    First kinetic constant.

    k2

    Second kinetic constant.

    g

    Fraction of the starting value declining according to the first +kinetic constant.

    + +

    Value

    + +

    The value of the response variable at time t.

    +

    References

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence +and Degradation Kinetics from Environmental Fate Studies on Pesticides in +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

    +

    See also

    + + + +

    Examples

    +
    + plot(function(x) DFOP.solution(x, 100, 5, 0.5, 0.3), 0, 4, ylim = c(0,100))
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/Extract.mmkin.html b/docs/dev/reference/Extract.mmkin.html new file mode 100644 index 00000000..c69259b6 --- /dev/null +++ b/docs/dev/reference/Extract.mmkin.html @@ -0,0 +1,253 @@ + + + + + + + + +Subsetting method for mmkin objects — [.mmkin • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Subsetting method for mmkin objects.

    +
    + +
    # S3 method for mmkin
    +[(x, i, j, ..., drop = FALSE)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + +
    x

    An mmkin object

    i

    Row index selecting the fits for specific models

    j

    Column index selecting the fits to specific datasets

    ...

    Not used, only there to satisfy the generic method definition

    drop

    If FALSE, the method always returns an mmkin object, otherwise +either a list of mkinfit objects or a single mkinfit object.

    + +

    Value

    + +

    An object of class mmkin.

    + +

    Examples

    +
    + # Only use one core, to pass R CMD check --as-cran + fits <- mmkin(c("SFO", "FOMC"), list(B = FOCUS_2006_B, C = FOCUS_2006_C), + cores = 1, quiet = TRUE) + fits["FOMC", ]
    #> dataset +#> model B C +#> FOMC List,39 List,39 +#> attr(,"class") +#> [1] "mmkin"
    fits[, "B"]
    #> dataset +#> model B +#> SFO List,39 +#> FOMC List,39 +#> attr(,"class") +#> [1] "mmkin"
    fits["SFO", "B"]
    #> dataset +#> model B +#> SFO List,39 +#> attr(,"class") +#> [1] "mmkin"
    + head( + # This extracts an mkinfit object with lots of components + fits[["FOMC", "B"]] + )
    #> $par +#> parent_0 log_alpha log_beta sigma +#> 99.666193 2.549849 5.050586 1.890202 +#> +#> $objective +#> [1] 28.58291 +#> +#> $convergence +#> [1] 0 +#> +#> $iterations +#> [1] 21 +#> +#> $evaluations +#> function gradient +#> 25 72 +#> +#> $message +#> [1] "both X-convergence and relative convergence (5)" +#>
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/FOCUS_2006_DFOP_ref_A_to_B.html b/docs/dev/reference/FOCUS_2006_DFOP_ref_A_to_B.html new file mode 100644 index 00000000..fcdfcf72 --- /dev/null +++ b/docs/dev/reference/FOCUS_2006_DFOP_ref_A_to_B.html @@ -0,0 +1,212 @@ + + + + + + + + +Results of fitting the DFOP model to Datasets A to B of FOCUS (2006) — FOCUS_2006_DFOP_ref_A_to_B • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    A table with the fitted parameters and the resulting DT50 and DT90 values +generated with different software packages. Taken directly from FOCUS (2006). +The results from fitting the data with the Topfit software was removed, as +the initial concentration of the parent compound was fixed to a value of 100 +in this fit.

    +
    + +
    FOCUS_2006_DFOP_ref_A_to_B
    + + +

    Format

    + +

    A data frame containing the following variables.

    +
    package

    a factor giving the name of the software package

    +
    M0

    The fitted initial concentration of the parent compound

    +
    f

    The fitted f parameter

    +
    k1

    The fitted k1 parameter

    +
    k2

    The fitted k2 parameter

    +
    DT50

    The resulting half-life of the parent compound

    +
    DT90

    The resulting DT90 of the parent compound

    +
    dataset

    The FOCUS dataset that was used

    + + + +

    Source

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence and + Degradation Kinetics from Environmental Fate Studies on Pesticides in 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

    + +

    Examples

    +
    data(FOCUS_2006_DFOP_ref_A_to_B)
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/FOCUS_2006_FOMC_ref_A_to_F.html b/docs/dev/reference/FOCUS_2006_FOMC_ref_A_to_F.html new file mode 100644 index 00000000..666a1123 --- /dev/null +++ b/docs/dev/reference/FOCUS_2006_FOMC_ref_A_to_F.html @@ -0,0 +1,211 @@ + + + + + + + + +Results of fitting the FOMC model to Datasets A to F of FOCUS (2006) — FOCUS_2006_FOMC_ref_A_to_F • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    A table with the fitted parameters and the resulting DT50 and DT90 values +generated with different software packages. Taken directly from FOCUS (2006). +The results from fitting the data with the Topfit software was removed, as +the initial concentration of the parent compound was fixed to a value of 100 +in this fit.

    +
    + +
    FOCUS_2006_FOMC_ref_A_to_F
    + + +

    Format

    + +

    A data frame containing the following variables.

    +
    package

    a factor giving the name of the software package

    +
    M0

    The fitted initial concentration of the parent compound

    +
    alpha

    The fitted alpha parameter

    +
    beta

    The fitted beta parameter

    +
    DT50

    The resulting half-life of the parent compound

    +
    DT90

    The resulting DT90 of the parent compound

    +
    dataset

    The FOCUS dataset that was used

    + + + +

    Source

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence and + Degradation Kinetics from Environmental Fate Studies on Pesticides in 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

    + +

    Examples

    +
    data(FOCUS_2006_FOMC_ref_A_to_F)
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/FOCUS_2006_HS_ref_A_to_F.html b/docs/dev/reference/FOCUS_2006_HS_ref_A_to_F.html new file mode 100644 index 00000000..b07abb0d --- /dev/null +++ b/docs/dev/reference/FOCUS_2006_HS_ref_A_to_F.html @@ -0,0 +1,212 @@ + + + + + + + + +Results of fitting the HS model to Datasets A to F of FOCUS (2006) — FOCUS_2006_HS_ref_A_to_F • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    A table with the fitted parameters and the resulting DT50 and DT90 values +generated with different software packages. Taken directly from FOCUS (2006). +The results from fitting the data with the Topfit software was removed, as +the initial concentration of the parent compound was fixed to a value of 100 +in this fit.

    +
    + +
    FOCUS_2006_HS_ref_A_to_F
    + + +

    Format

    + +

    A data frame containing the following variables.

    +
    package

    a factor giving the name of the software package

    +
    M0

    The fitted initial concentration of the parent compound

    +
    tb

    The fitted tb parameter

    +
    k1

    The fitted k1 parameter

    +
    k2

    The fitted k2 parameter

    +
    DT50

    The resulting half-life of the parent compound

    +
    DT90

    The resulting DT90 of the parent compound

    +
    dataset

    The FOCUS dataset that was used

    + + + +

    Source

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence and + Degradation Kinetics from Environmental Fate Studies on Pesticides in 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

    + +

    Examples

    +
    data(FOCUS_2006_HS_ref_A_to_F)
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/FOCUS_2006_SFO_ref_A_to_F.html b/docs/dev/reference/FOCUS_2006_SFO_ref_A_to_F.html new file mode 100644 index 00000000..1e3b91f6 --- /dev/null +++ b/docs/dev/reference/FOCUS_2006_SFO_ref_A_to_F.html @@ -0,0 +1,210 @@ + + + + + + + + +Results of fitting the SFO model to Datasets A to F of FOCUS (2006) — FOCUS_2006_SFO_ref_A_to_F • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    A table with the fitted parameters and the resulting DT50 and DT90 values +generated with different software packages. Taken directly from FOCUS (2006). +The results from fitting the data with the Topfit software was removed, as +the initial concentration of the parent compound was fixed to a value of 100 +in this fit.

    +
    + +
    FOCUS_2006_SFO_ref_A_to_F
    + + +

    Format

    + +

    A data frame containing the following variables.

    +
    package

    a factor giving the name of the software package

    +
    M0

    The fitted initial concentration of the parent compound

    +
    k

    The fitted first-order degradation rate constant

    +
    DT50

    The resulting half-life of the parent compound

    +
    DT90

    The resulting DT90 of the parent compound

    +
    dataset

    The FOCUS dataset that was used

    + + + +

    Source

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence and + Degradation Kinetics from Environmental Fate Studies on Pesticides in 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

    + +

    Examples

    +
    data(FOCUS_2006_SFO_ref_A_to_F)
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/FOCUS_2006_datasets.html b/docs/dev/reference/FOCUS_2006_datasets.html new file mode 100644 index 00000000..9836adac --- /dev/null +++ b/docs/dev/reference/FOCUS_2006_datasets.html @@ -0,0 +1,213 @@ + + + + + + + + +Datasets A to F from the FOCUS Kinetics report from 2006 — FOCUS_2006_datasets • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Data taken from FOCUS (2006), p. 258.

    +
    + +
    FOCUS_2006_A
    +  FOCUS_2006_B
    +  FOCUS_2006_C
    +  FOCUS_2006_D
    +  FOCUS_2006_E
    +  FOCUS_2006_F
    + + +

    Format

    + +

    6 datasets with observations on the following variables.

    +
    name

    a factor containing the name of the observed variable

    +
    time

    a numeric vector containing time points

    +
    value

    a numeric vector containing concentrations in percent of applied radioactivity

    + + + +

    Source

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence and + Degradation Kinetics from Environmental Fate Studies on Pesticides in 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

    + +

    Examples

    +
    FOCUS_2006_C
    #> name time value +#> 1 parent 0 85.1 +#> 2 parent 1 57.9 +#> 3 parent 3 29.9 +#> 4 parent 7 14.6 +#> 5 parent 14 9.7 +#> 6 parent 28 6.6 +#> 7 parent 63 4.0 +#> 8 parent 91 3.9 +#> 9 parent 119 0.6
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/FOMC.solution-1.png b/docs/dev/reference/FOMC.solution-1.png new file mode 100644 index 00000000..aa41a253 Binary files /dev/null and b/docs/dev/reference/FOMC.solution-1.png differ diff --git a/docs/dev/reference/FOMC.solution.html b/docs/dev/reference/FOMC.solution.html new file mode 100644 index 00000000..8ed22157 --- /dev/null +++ b/docs/dev/reference/FOMC.solution.html @@ -0,0 +1,245 @@ + + + + + + + + +First-Order Multi-Compartment kinetics — FOMC.solution • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Function describing exponential decline from a defined starting value, with +a decreasing rate constant.

    +
    + +
    FOMC.solution(t, parent_0, alpha, beta)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + +
    t

    Time.

    parent_0

    Starting value for the response variable at time zero.

    alpha

    Shape parameter determined by coefficient of variation of rate +constant values.

    beta

    Location parameter.

    + +

    Value

    + +

    The value of the response variable at time t.

    +

    Details

    + +

    The form given here differs slightly from the original reference by +Gustafson and Holden (1990). The parameter beta corresponds to 1/beta +in the original equation.

    +

    Note

    + +

    The solution of the FOMC kinetic model reduces to the +SFO.solution for large values of alpha and +beta with \(k = \frac{\beta}{\alpha}\).

    +

    References

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence +and Degradation Kinetics from Environmental Fate Studies on Pesticides in +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

    +

    See also

    + + + +

    Examples

    +
    + plot(function(x) FOMC.solution(x, 100, 10, 2), 0, 2, ylim = c(0, 100))
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/HS.solution-1.png b/docs/dev/reference/HS.solution-1.png new file mode 100644 index 00000000..ae056d9b Binary files /dev/null and b/docs/dev/reference/HS.solution-1.png differ diff --git a/docs/dev/reference/HS.solution.html b/docs/dev/reference/HS.solution.html new file mode 100644 index 00000000..5053542a --- /dev/null +++ b/docs/dev/reference/HS.solution.html @@ -0,0 +1,237 @@ + + + + + + + + +Hockey-Stick kinetics — HS.solution • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Function describing two exponential decline functions with a break point +between them.

    +
    + +
    HS.solution(t, parent_0, k1, k2, tb)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + +
    t

    Time.

    parent_0

    Starting value for the response variable at time zero.

    k1

    First kinetic constant.

    k2

    Second kinetic constant.

    tb

    Break point. Before this time, exponential decline according to +k1 is calculated, after this time, exponential decline proceeds +according to k2.

    + +

    Value

    + +

    The value of the response variable at time t.

    +

    References

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence +and Degradation Kinetics from Environmental Fate Studies on Pesticides in +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

    +

    See also

    + + + +

    Examples

    +
    + plot(function(x) HS.solution(x, 100, 2, 0.3, 0.5), 0, 2, ylim=c(0,100))
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/IORE.solution-1.png b/docs/dev/reference/IORE.solution-1.png new file mode 100644 index 00000000..00e28460 Binary files /dev/null and b/docs/dev/reference/IORE.solution-1.png differ diff --git a/docs/dev/reference/IORE.solution.html b/docs/dev/reference/IORE.solution.html new file mode 100644 index 00000000..9db7447c --- /dev/null +++ b/docs/dev/reference/IORE.solution.html @@ -0,0 +1,245 @@ + + + + + + + + +Indeterminate order rate equation kinetics — IORE.solution • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Function describing exponential decline from a defined starting value, with +a concentration dependent rate constant.

    +
    + +
    IORE.solution(t, parent_0, k__iore, N)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + +
    t

    Time.

    parent_0

    Starting value for the response variable at time zero.

    k__iore

    Rate constant. Note that this depends on the concentration +units used.

    N

    Exponent describing the nonlinearity of the rate equation

    + +

    Value

    + +

    The value of the response variable at time t.

    +

    Note

    + +

    The solution of the IORE kinetic model reduces to the +SFO.solution if N = 1. The parameters of the IORE model can +be transformed to equivalent parameters of the FOMC mode - see the NAFTA +guidance for details.

    +

    References

    + +

    NAFTA Technical Working Group on Pesticides (not dated) Guidance +for Evaluating and Calculating Degradation Kinetics in Environmental Media

    +

    See also

    + + + +

    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) + 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)))
    #> 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
    # } + +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/NAFTA_SOP_2015-1.png b/docs/dev/reference/NAFTA_SOP_2015-1.png new file mode 100644 index 00000000..9025f2bb Binary files /dev/null and b/docs/dev/reference/NAFTA_SOP_2015-1.png differ diff --git a/docs/dev/reference/NAFTA_SOP_2015.html b/docs/dev/reference/NAFTA_SOP_2015.html new file mode 100644 index 00000000..c7e20a45 --- /dev/null +++ b/docs/dev/reference/NAFTA_SOP_2015.html @@ -0,0 +1,240 @@ + + + + + + + + +Example datasets from the NAFTA SOP published 2015 — NAFTA_SOP_2015 • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Data taken from US EPA (2015), p. 19 and 23.

    +
    + +
    NAFTA_SOP_Appendix_B
    +  NAFTA_SOP_Appendix_D
    + + +

    Format

    + +

    2 datasets with observations on the following variables.

    +
    name

    a factor containing the name of the observed variable

    +
    time

    a numeric vector containing time points

    +
    value

    a numeric vector containing concentrations

    + + + +

    Source

    + +

    NAFTA (2011) Guidance for evaluating and calculating degradation kinetics + in environmental media. NAFTA Technical Working Group on Pesticides + https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/guidance-evaluating-and-calculating-degradation + accessed 2019-02-22

    +

    US EPA (2015) Standard Operating Procedure for Using the NAFTA Guidance to + Calculate Representative Half-life Values and Characterizing Pesticide + Degradation + https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/standard-operating-procedure-using-nafta-guidance

    + +

    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: +#> SFO IORE DFOP +#> 1378.6832 615.7730 517.8836 +#> +#> Critical sum of squares for checking the SFO model: +#> [1] 717.4598 +#> +#> Parameters: +#> $SFO +#> Estimate Pr(>t) Lower Upper +#> parent_0 83.7558 1.80e-14 77.18268 90.3288 +#> k_parent_sink 0.0017 7.43e-05 0.00112 0.0026 +#> sigma 8.7518 1.22e-05 5.64278 11.8608 +#> +#> $IORE +#> Estimate Pr(>t) Lower Upper +#> parent_0 9.69e+01 NA 8.88e+01 1.05e+02 +#> k__iore_parent_sink 8.40e-14 NA 1.79e-18 3.94e-09 +#> N_parent 6.68e+00 NA 4.19e+00 9.17e+00 +#> sigma 5.85e+00 NA 3.76e+00 7.94e+00 +#> +#> $DFOP +#> Estimate Pr(>t) Lower Upper +#> parent_0 9.76e+01 1.94e-13 9.02e+01 1.05e+02 +#> k1 4.24e-02 5.92e-03 2.03e-02 8.88e-02 +#> k2 8.24e-04 6.48e-03 3.89e-04 1.75e-03 +#> g 2.88e-01 2.47e-05 1.95e-01 4.03e-01 +#> sigma 5.36e+00 2.22e-05 3.43e+00 7.30e+00 +#> +#> +#> DTx values: +#> DT50 DT90 DT50_rep +#> SFO 407 1350 407 +#> IORE 541 5190000 1560000 +#> DFOP 429 2380 841 +#> +#> Representative half-life: +#> [1] 841.41
    plot(nafta_evaluation)
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/NAFTA_SOP_Attachment-1.png b/docs/dev/reference/NAFTA_SOP_Attachment-1.png new file mode 100644 index 00000000..19da6da7 Binary files /dev/null and b/docs/dev/reference/NAFTA_SOP_Attachment-1.png differ diff --git a/docs/dev/reference/NAFTA_SOP_Attachment.html b/docs/dev/reference/NAFTA_SOP_Attachment.html new file mode 100644 index 00000000..7bc7817e --- /dev/null +++ b/docs/dev/reference/NAFTA_SOP_Attachment.html @@ -0,0 +1,234 @@ + + + + + + + + +Example datasets from Attachment 1 to the NAFTA SOP published 2015 — NAFTA_SOP_Attachment • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Data taken from from Attachment 1 of the SOP.

    +
    + +
    NAFTA_SOP_Attachment
    + + +

    Format

    + +

    A list (NAFTA_SOP_Attachment) containing 16 datasets suitable + for the evaluation with nafta

    +

    Source

    + +

    NAFTA (2011) Guidance for evaluating and calculating degradation kinetics + in environmental media. NAFTA Technical Working Group on Pesticides + https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/guidance-evaluating-and-calculating-degradation + accessed 2019-02-22

    +

    US EPA (2015) Standard Operating Procedure for Using the NAFTA Guidance to + Calculate Representative Half-life Values and Characterizing Pesticide + Degradation + https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/standard-operating-procedure-using-nafta-guidance

    + +

    Examples

    +
    nafta_att_p5a <- nafta(NAFTA_SOP_Attachment[["p5a"]], cores = 1)
    #> The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
    #> The half-life obtained from the IORE model may be used
    print(nafta_att_p5a)
    #> Sums of squares: +#> SFO IORE DFOP +#> 465.21753 56.27506 32.06401 +#> +#> Critical sum of squares for checking the SFO model: +#> [1] 64.4304 +#> +#> Parameters: +#> $SFO +#> Estimate Pr(>t) Lower Upper +#> parent_0 95.8401 4.67e-21 92.245 99.4357 +#> k_parent_sink 0.0102 3.92e-12 0.009 0.0117 +#> sigma 4.8230 3.81e-06 3.214 6.4318 +#> +#> $IORE +#> Estimate Pr(>t) Lower Upper +#> parent_0 1.01e+02 NA 9.91e+01 1.02e+02 +#> k__iore_parent_sink 1.54e-05 NA 4.08e-06 5.84e-05 +#> N_parent 2.57e+00 NA 2.25e+00 2.89e+00 +#> sigma 1.68e+00 NA 1.12e+00 2.24e+00 +#> +#> $DFOP +#> Estimate Pr(>t) Lower Upper +#> parent_0 9.99e+01 1.41e-26 98.8116 101.0810 +#> k1 2.67e-02 5.05e-06 0.0243 0.0295 +#> k2 2.86e-12 5.00e-01 0.0000 Inf +#> g 6.47e-01 3.67e-06 0.6248 0.6677 +#> sigma 1.27e+00 8.91e-06 0.8395 1.6929 +#> +#> +#> DTx values: +#> DT50 DT90 DT50_rep +#> SFO 67.7 2.25e+02 6.77e+01 +#> IORE 58.2 1.07e+03 3.22e+02 +#> DFOP 55.5 4.42e+11 2.42e+11 +#> +#> Representative half-life: +#> [1] 321.51
    plot(nafta_att_p5a)
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/SFO.solution-1.png b/docs/dev/reference/SFO.solution-1.png new file mode 100644 index 00000000..b0b854bb Binary files /dev/null and b/docs/dev/reference/SFO.solution-1.png differ diff --git a/docs/dev/reference/SFO.solution.html b/docs/dev/reference/SFO.solution.html new file mode 100644 index 00000000..02b3cf22 --- /dev/null +++ b/docs/dev/reference/SFO.solution.html @@ -0,0 +1,225 @@ + + + + + + + + +Single First-Order kinetics — SFO.solution • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Function describing exponential decline from a defined starting value.

    +
    + +
    SFO.solution(t, parent_0, k)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    t

    Time.

    parent_0

    Starting value for the response variable at time zero.

    k

    Kinetic rate constant.

    + +

    Value

    + +

    The value of the response variable at time t.

    +

    References

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence +and Degradation Kinetics from Environmental Fate Studies on Pesticides in +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

    +

    See also

    + + + +

    Examples

    +
    + plot(function(x) SFO.solution(x, 100, 3), 0, 2)
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/SFORB.solution-1.png b/docs/dev/reference/SFORB.solution-1.png new file mode 100644 index 00000000..cd58caec Binary files /dev/null and b/docs/dev/reference/SFORB.solution-1.png differ diff --git a/docs/dev/reference/SFORB.solution.html b/docs/dev/reference/SFORB.solution.html new file mode 100644 index 00000000..87d39b4e --- /dev/null +++ b/docs/dev/reference/SFORB.solution.html @@ -0,0 +1,243 @@ + + + + + + + + +Single First-Order Reversible Binding kinetics — SFORB.solution • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Function describing the solution of the differential equations describing +the kinetic model with first-order terms for a two-way transfer from a free +to a bound fraction, and a first-order degradation term for the free +fraction. The initial condition is a defined amount in the free fraction +and no substance in the bound fraction.

    +
    + +
    SFORB.solution(t, parent_0, k_12, k_21, k_1output)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + +
    t

    Time.

    parent_0

    Starting value for the response variable at time zero.

    k_12

    Kinetic constant describing transfer from free to bound.

    k_21

    Kinetic constant describing transfer from bound to free.

    k_1output

    Kinetic constant describing degradation of the free +fraction.

    + +

    Value

    + +

    The value of the response variable, which is the sum of free and +bound fractions at time t.

    +

    References

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence +and Degradation Kinetics from Environmental Fate Studies on Pesticides in +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

    +

    See also

    + + + +

    Examples

    +
    + plot(function(x) SFORB.solution(x, 100, 0.5, 2, 3), 0, 2)
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/add_err-1.png b/docs/dev/reference/add_err-1.png new file mode 100644 index 00000000..88806d7b Binary files /dev/null and b/docs/dev/reference/add_err-1.png differ diff --git a/docs/dev/reference/add_err-2.png b/docs/dev/reference/add_err-2.png new file mode 100644 index 00000000..6a806c2d Binary files /dev/null and b/docs/dev/reference/add_err-2.png differ diff --git a/docs/dev/reference/add_err-3.png b/docs/dev/reference/add_err-3.png new file mode 100644 index 00000000..1919a566 Binary files /dev/null and b/docs/dev/reference/add_err-3.png differ diff --git a/docs/dev/reference/add_err.html b/docs/dev/reference/add_err.html new file mode 100644 index 00000000..a4317cd7 --- /dev/null +++ b/docs/dev/reference/add_err.html @@ -0,0 +1,287 @@ + + + + + + + + +Add normally distributed errors to simulated kinetic degradation data — add_err • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Normally distributed errors are added to data predicted for a specific +degradation model using mkinpredict. The variance of the error +may depend on the predicted value and is specified as a standard deviation.

    +
    + +
    add_err(
    +  prediction,
    +  sdfunc,
    +  secondary = c("M1", "M2"),
    +  n = 1000,
    +  LOD = 0.1,
    +  reps = 2,
    +  digits = 1,
    +  seed = NA
    +)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    prediction

    A prediction from a kinetic model as produced by +mkinpredict.

    sdfunc

    A function taking the predicted value as its only argument and +returning a standard deviation that should be used for generating the +random error terms for this value.

    secondary

    The names of state variables that should have an initial +value of zero

    n

    The number of datasets to be generated.

    LOD

    The limit of detection (LOD). Values that are below the LOD after +adding the random error will be set to NA.

    reps

    The number of replicates to be generated within the datasets.

    digits

    The number of digits to which the values will be rounded.

    seed

    The seed used for the generation of random numbers. If NA, the +seed is not set.

    + +

    Value

    + +

    A list of datasets compatible with mmkin, i.e. the +components of the list are datasets compatible with mkinfit.

    +

    References

    + +

    Ranke J and Lehmann R (2015) To t-test or not to t-test, that is +the question. XV Symposium on Pesticide Chemistry 2-4 September 2015, +Piacenza, Italy +https://jrwb.de/posters/piacenza_2015.pdf

    + +

    Examples

    +
    +# The kinetic model +m_SFO_SFO <- mkinmod(parent = mkinsub("SFO", "M1"), + M1 = mkinsub("SFO"), use_of_ff = "max")
    #> Successfully compiled differential equation model from auto-generated C code.
    +# Generate a prediction for a specific set of parameters +sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) + +# This is the prediction used for the "Type 2 datasets" on the Piacenza poster +# from 2015 +d_SFO_SFO <- mkinpredict(m_SFO_SFO, + c(k_parent = 0.1, f_parent_to_M1 = 0.5, + k_M1 = log(2)/1000), + c(parent = 100, M1 = 0), + sampling_times) + +# Add an error term with a constant (independent of the value) standard deviation +# of 10, and generate three datasets +d_SFO_SFO_err <- add_err(d_SFO_SFO, function(x) 10, n = 3, seed = 123456789 ) + +# Name the datasets for nicer plotting +names(d_SFO_SFO_err) <- paste("Dataset", 1:3) + +# Name the model in the list of models (with only one member in this case) for +# nicer plotting later on. Be quiet and use only one core not to offend CRAN +# checks +# \dontrun{ +f_SFO_SFO <- mmkin(list("SFO-SFO" = m_SFO_SFO), + d_SFO_SFO_err, cores = 1, + quiet = TRUE) + +plot(f_SFO_SFO)
    +# We would like to inspect the fit for dataset 3 more closely +# Using double brackets makes the returned object an mkinfit object +# instead of a list of mkinfit objects, so plot.mkinfit is used +plot(f_SFO_SFO[[3]], show_residuals = TRUE)
    +# If we use single brackets, we should give two indices (model and dataset), +# and plot.mmkin is used +plot(f_SFO_SFO[1, 3])
    # } + +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/aw.html b/docs/dev/reference/aw.html new file mode 100644 index 00000000..267c3b0b --- /dev/null +++ b/docs/dev/reference/aw.html @@ -0,0 +1,221 @@ + + + + + + + + +Calculate Akaike weights for model averaging — aw • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Akaike weights are calculated based on the relative +expected Kullback-Leibler information as specified +by Burnham and Anderson (2004).

    +
    + +
    aw(object, ...)
    +
    +# S3 method for mkinfit
    +aw(object, ...)
    +
    +# S3 method for mmkin
    +aw(object, ...)
    + +

    Arguments

    + + + + + + + + + + +
    object

    An mmkin column object, containing two or more +mkinfit models that have been fitted to the same data, +or an mkinfit object. In the latter case, further mkinfit +objects fitted to the same data should be specified +as dots arguments.

    ...

    Not used in the method for mmkin column objects, +further mkinfit objects in the method for mkinfit objects.

    + +

    References

    + +

    Burnham KP and Anderson DR (2004) Multimodel +Inference: Understanding AIC and BIC in Model Selection. +Sociological Methods & Research 33(2) 261-304

    + +

    Examples

    +
    # \dontrun{ +f_sfo <- mkinfit("SFO", FOCUS_2006_D, quiet = TRUE) +f_dfop <- mkinfit("DFOP", FOCUS_2006_D, quiet = TRUE) +aw_sfo_dfop <- aw(f_sfo, f_dfop) +sum(aw_sfo_dfop)
    #> [1] 1
    aw_sfo_dfop # SFO gets more weight as it has less parameters and a similar fit
    #> [1] 0.5970258 0.4029742
    f <- mmkin(c("SFO", "FOMC", "DFOP"), list("FOCUS D" = FOCUS_2006_D), cores = 1, quiet = TRUE) +aw(f)
    #> [1] 0.4808722 0.1945539 0.3245740
    sum(aw(f))
    #> [1] 1
    aw(f[c("SFO", "DFOP")])
    #> [1] 0.5970258 0.4029742
    # } +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/confint.mkinfit.html b/docs/dev/reference/confint.mkinfit.html new file mode 100644 index 00000000..a03ecea8 --- /dev/null +++ b/docs/dev/reference/confint.mkinfit.html @@ -0,0 +1,419 @@ + + + + + + + + +Confidence intervals for parameters of mkinfit objects — confint.mkinfit • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    The default method 'quadratic' is based on the quadratic approximation of +the curvature of the likelihood function at the maximum likelihood parameter +estimates. +The alternative method 'profile' is based on the profile likelihood for each +parameter. The 'profile' method uses two nested optimisations and can take a +very long time, even if parallelized by specifying 'cores' on unixoid +platforms. The speed of the method could likely be improved by using the +method of Venzon and Moolgavkar (1988).

    +
    + +
    # S3 method for mkinfit
    +confint(
    +  object,
    +  parm,
    +  level = 0.95,
    +  alpha = 1 - level,
    +  cutoff,
    +  method = c("quadratic", "profile"),
    +  transformed = TRUE,
    +  backtransform = TRUE,
    +  cores = parallel::detectCores(),
    +  rel_tol = 0.01,
    +  quiet = FALSE,
    +  ...
    +)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    object

    An mkinfit object

    parm

    A vector of names of the parameters which are to be given +confidence intervals. If missing, all parameters are considered.

    level

    The confidence level required

    alpha

    The allowed error probability, overrides 'level' if specified.

    cutoff

    Possibility to specify an alternative cutoff for the difference +in the log-likelihoods at the confidence boundary. Specifying an explicit +cutoff value overrides arguments 'level' and 'alpha'

    method

    The 'quadratic' method approximates the likelihood function at +the optimised parameters using the second term of the Taylor expansion, +using a second derivative (hessian) contained in the object. +The 'profile' method searches the parameter space for the +cutoff of the confidence intervals by means of a likelihood ratio test.

    transformed

    If the quadratic approximation is used, should it be +applied to the likelihood based on the transformed parameters?

    backtransform

    If we approximate the likelihood in terms of the +transformed parameters, should we backtransform the parameters with +their confidence intervals?

    cores

    The number of cores to be used for multicore processing. +On Windows machines, cores > 1 is currently not supported.

    rel_tol

    If the method is 'profile', what should be the accuracy +of the lower and upper bounds, relative to the estimate obtained from +the quadratic method?

    quiet

    Should we suppress the message "Profiling the likelihood"

    ...

    Not used

    + +

    Value

    + +

    A matrix with columns giving lower and upper confidence limits for +each parameter.

    +

    References

    + +

    Bates DM and Watts GW (1988) Nonlinear regression analysis & its applications

    +

    Pawitan Y (2013) In all likelihood - Statistical modelling and +inference using likelihood. Clarendon Press, Oxford.

    +

    Venzon DJ and Moolgavkar SH (1988) A Method for Computing +Profile-Likelihood Based Confidence Intervals, Applied Statistics, 37, +87–94.

    + +

    Examples

    +
    f <- mkinfit("SFO", FOCUS_2006_C, quiet = TRUE) +confint(f, method = "quadratic")
    #> 2.5% 97.5% +#> parent_0 71.8242430 93.1600766 +#> k_parent_sink 0.2109541 0.4440528 +#> sigma 1.9778868 7.3681380
    +# \dontrun{ +confint(f, method = "profile")
    #> Profiling the likelihood
    #> 2.5% 97.5% +#> parent_0 73.0641834 92.1392181 +#> k_parent_sink 0.2170293 0.4235348 +#> sigma 3.1307772 8.0628314
    +# Set the number of cores for the profiling method for further examples +if (identical(Sys.getenv("NOT_CRAN"), "true")) { + n_cores <- parallel::detectCores() - 1 +} else { + n_cores <- 1 +} +if (Sys.getenv("TRAVIS") != "") n_cores = 1 +if (Sys.info()["sysname"] == "Windows") n_cores = 1 + +SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"), quiet = TRUE) +SFO_SFO.ff <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"), + use_of_ff = "max", quiet = TRUE) +f_d_1 <- mkinfit(SFO_SFO, subset(FOCUS_2006_D, value != 0), quiet = TRUE) +system.time(ci_profile <- confint(f_d_1, method = "profile", cores = 1, quiet = TRUE))
    #> user system elapsed +#> 3.707 1.077 3.444
    # Using more cores does not save much time here, as parent_0 takes up most of the time +# If we additionally exclude parent_0 (the confidence of which is often of +# minor interest), we get a nice performance improvement from about 50 +# seconds to about 12 seconds if we use at least four cores +system.time(ci_profile_no_parent_0 <- confint(f_d_1, method = "profile", + c("k_parent_sink", "k_parent_m1", "k_m1_sink", "sigma"), cores = n_cores))
    #> Profiling the likelihood
    #> Warning: scheduled cores 2, 1, 3 encountered errors in user code, all values of the jobs will be affected
    #> Error in dimnames(x) <- dn: length of 'dimnames' [2] not equal to array extent
    #> Timing stopped at: 0.011 0.026 0.207
    ci_profile
    #> 2.5% 97.5% +#> parent_0 96.456003640 1.027703e+02 +#> k_parent 0.090911032 1.071578e-01 +#> k_m1 0.003892605 6.702778e-03 +#> f_parent_to_m1 0.471328495 5.611550e-01 +#> sigma 2.535612399 3.985263e+00
    ci_quadratic_transformed <- confint(f_d_1, method = "quadratic") +ci_quadratic_transformed
    #> 2.5% 97.5% +#> parent_0 96.403839476 1.027931e+02 +#> k_parent 0.090823790 1.072543e-01 +#> k_m1 0.004012216 6.897547e-03 +#> f_parent_to_m1 0.469118713 5.595960e-01 +#> sigma 2.396089689 3.854918e+00
    ci_quadratic_untransformed <- confint(f_d_1, method = "quadratic", transformed = FALSE) +ci_quadratic_untransformed
    #> 2.5% 97.5% +#> parent_0 96.403839429 1.027931e+02 +#> k_parent 0.090491931 1.069035e-01 +#> k_m1 0.003835483 6.685819e-03 +#> f_parent_to_m1 0.469113364 5.598386e-01 +#> sigma 2.396089689 3.854918e+00
    # Against the expectation based on Bates and Watts (1988), the confidence +# intervals based on the internal parameter transformation are less +# congruent with the likelihood based intervals. Note the superiority of the +# interval based on the untransformed fit for k_m1_sink +rel_diffs_transformed <- abs((ci_quadratic_transformed - ci_profile)/ci_profile) +rel_diffs_untransformed <- abs((ci_quadratic_untransformed - ci_profile)/ci_profile) +rel_diffs_transformed < rel_diffs_untransformed
    #> 2.5% 97.5% +#> parent_0 TRUE TRUE +#> k_parent TRUE TRUE +#> k_m1 FALSE FALSE +#> f_parent_to_m1 TRUE FALSE +#> sigma FALSE TRUE
    signif(rel_diffs_transformed, 3)
    #> 2.5% 97.5% +#> parent_0 0.000541 0.000222 +#> k_parent 0.000960 0.000900 +#> k_m1 0.030700 0.029100 +#> f_parent_to_m1 0.004690 0.002780 +#> sigma 0.055000 0.032700
    signif(rel_diffs_untransformed, 3)
    #> 2.5% 97.5% +#> parent_0 0.000541 0.000222 +#> k_parent 0.004610 0.002370 +#> k_m1 0.014700 0.002530 +#> f_parent_to_m1 0.004700 0.002350 +#> sigma 0.055000 0.032700
    + +# Investigate a case with formation fractions +f_d_2 <- mkinfit(SFO_SFO.ff, subset(FOCUS_2006_D, value != 0), quiet = TRUE) +ci_profile_ff <- confint(f_d_2, method = "profile", cores = n_cores)
    #> Profiling the likelihood
    ci_profile_ff
    #> 2.5% 97.5% +#> parent_0 96.456003640 1.027703e+02 +#> k_parent 0.090911032 1.071578e-01 +#> k_m1 0.003892605 6.702778e-03 +#> f_parent_to_m1 0.471328495 5.611550e-01 +#> sigma 2.535612399 3.985263e+00
    ci_quadratic_transformed_ff <- confint(f_d_2, method = "quadratic") +ci_quadratic_transformed_ff
    #> 2.5% 97.5% +#> parent_0 96.403839476 1.027931e+02 +#> k_parent 0.090823790 1.072543e-01 +#> k_m1 0.004012216 6.897547e-03 +#> f_parent_to_m1 0.469118713 5.595960e-01 +#> sigma 2.396089689 3.854918e+00
    ci_quadratic_untransformed_ff <- confint(f_d_2, method = "quadratic", transformed = FALSE) +ci_quadratic_untransformed_ff
    #> 2.5% 97.5% +#> parent_0 96.403839429 1.027931e+02 +#> k_parent 0.090491931 1.069035e-01 +#> k_m1 0.003835483 6.685819e-03 +#> f_parent_to_m1 0.469113364 5.598386e-01 +#> sigma 2.396089689 3.854918e+00
    rel_diffs_transformed_ff <- abs((ci_quadratic_transformed_ff - ci_profile_ff)/ci_profile_ff) +rel_diffs_untransformed_ff <- abs((ci_quadratic_untransformed_ff - ci_profile_ff)/ci_profile_ff) +# While the confidence interval for the parent rate constant is closer to +# the profile based interval when using the internal parameter +# transformation, the interval for the metabolite rate constant is 'better +# without internal parameter transformation. +rel_diffs_transformed_ff < rel_diffs_untransformed_ff
    #> 2.5% 97.5% +#> parent_0 TRUE TRUE +#> k_parent TRUE TRUE +#> k_m1 FALSE FALSE +#> f_parent_to_m1 TRUE FALSE +#> sigma FALSE TRUE
    rel_diffs_transformed_ff
    #> 2.5% 97.5% +#> parent_0 0.0005408078 0.0002217796 +#> k_parent 0.0009596417 0.0009003876 +#> k_m1 0.0307277372 0.0290579184 +#> f_parent_to_m1 0.0046884131 0.0027782558 +#> sigma 0.0550252516 0.0327066836
    rel_diffs_untransformed_ff
    #> 2.5% 97.5% +#> parent_0 0.0005408083 0.000221780 +#> k_parent 0.0046100096 0.002373023 +#> k_m1 0.0146746467 0.002530101 +#> f_parent_to_m1 0.0046997600 0.002346022 +#> sigma 0.0550252516 0.032706684
    +# The profiling for the following fit does not finish in a reasonable time, +# therefore we use the quadratic approximation +m_synth_DFOP_par <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")), + M1 = mkinsub("SFO"), + M2 = mkinsub("SFO"), + use_of_ff = "max", quiet = TRUE) +DFOP_par_c <- synthetic_data_for_UBA_2014[[12]]$data +f_tc_2 <- mkinfit(m_synth_DFOP_par, DFOP_par_c, error_model = "tc", + error_model_algorithm = "direct", quiet = TRUE)
    #> Warning: Optimisation did not converge: +#> iteration limit reached without convergence (10)
    confint(f_tc_2, method = "quadratic")
    #> 2.5% 97.5% +#> parent_0 95.654015524 105.79279749 +#> k_M1 0.037723773 0.04447598 +#> k_M2 0.008586438 0.01078076 +#> f_parent_to_M1 0.230403596 0.61953014 +#> f_parent_to_M2 0.162909765 0.38019017 +#> k1 0.275434628 0.33331386 +#> k2 0.018602188 0.02249211 +#> g 0.675149759 0.73520889 +#> sigma_low 0.251416929 0.84272023 +#> rsd_high 0.040371818 0.07666540
    confint(f_tc_2, "parent_0", method = "quadratic")
    #> 2.5% 97.5% +#> parent_0 95.65402 105.7928
    # } +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/create_deg_func.html b/docs/dev/reference/create_deg_func.html new file mode 100644 index 00000000..59984b8c --- /dev/null +++ b/docs/dev/reference/create_deg_func.html @@ -0,0 +1,225 @@ + + + + + + + + +Create degradation functions for known analytical solutions — create_deg_func • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Create degradation functions for known analytical solutions

    +
    + +
    create_deg_func(spec, use_of_ff = c("min", "max"))
    + +

    Arguments

    + + + + + + + + + + +
    spec

    List of model specifications as contained in mkinmod objects

    use_of_ff

    Minimum or maximum use of formation fractions

    + +

    Value

    + +

    Degradation function to be attached to mkinmod objects

    + +

    Examples

    +
    +SFO_SFO <- mkinmod( + parent = mkinsub("SFO", "m1"), + m1 = mkinsub("SFO"))
    #> Successfully compiled differential equation model from auto-generated C code.
    FOCUS_D <- subset(FOCUS_2006_D, value != 0) # to avoid warnings +fit_1 <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE) +fit_2 <- mkinfit(SFO_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE) +# \dontrun{ +if (require(rbenchmark)) + benchmark( + analytical = mkinfit(SFO_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE), + deSolve = mkinfit(SFO_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE), + replications = 2)
    #> Loading required package: rbenchmark
    #> test replications elapsed relative user.self sys.self user.child +#> 1 analytical 2 0.422 1.000 0.421 0 0 +#> 2 deSolve 2 0.722 1.711 0.721 0 0 +#> sys.child +#> 1 0 +#> 2 0
    DFOP_SFO <- mkinmod( + parent = mkinsub("DFOP", "m1"), + m1 = mkinsub("SFO"))
    #> Successfully compiled differential equation model from auto-generated C code.
    benchmark( + analytical = mkinfit(DFOP_SFO, FOCUS_D, solution_type = "analytical", quiet = TRUE), + deSolve = mkinfit(DFOP_SFO, FOCUS_D, solution_type = "deSolve", quiet = TRUE), + replications = 2)
    #> test replications elapsed relative user.self sys.self user.child +#> 1 analytical 2 0.907 1.000 0.906 0 0 +#> 2 deSolve 2 1.659 1.829 1.658 0 0 +#> sys.child +#> 1 0 +#> 2 0
    # } +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/endpoints.html b/docs/dev/reference/endpoints.html new file mode 100644 index 00000000..5751df93 --- /dev/null +++ b/docs/dev/reference/endpoints.html @@ -0,0 +1,232 @@ + + + + + + + + +Function to calculate endpoints for further use from kinetic models fitted +with mkinfit — endpoints • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function calculates DT50 and DT90 values as well as formation fractions +from kinetic models fitted with mkinfit. If the SFORB model was specified +for one of the parents or metabolites, the Eigenvalues are returned. These +are equivalent to the rate constants of the DFOP model, but with the +advantage that the SFORB model can also be used for metabolites.

    +
    + +
    endpoints(fit)
    + +

    Arguments

    + + + + + + +
    fit

    An object of class mkinfit or +nlme.mmkin

    + +

    Value

    + +

    A list with a matrix of dissipation times named distimes, +and, if applicable, a vector of formation fractions named ff +and, if the SFORB model was in use, a vector of eigenvalues +of these SFORB models, equivalent to DFOP rate constants

    +

    Note

    + +

    The function is used internally by summary.mkinfit.

    + +

    Examples

    +
    + fit <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE) + endpoints(fit)
    #> $distimes +#> DT50 DT90 DT50back +#> parent 1.785233 15.1479 4.559973 +#>
    # \dontrun{ + fit_2 <- mkinfit("SFORB", FOCUS_2006_C, quiet = TRUE) + endpoints(fit_2)
    #> $ff +#> parent_free_sink +#> 1 +#> +#> $SFORB +#> parent_b1 parent_b2 +#> 0.4595574 0.0178488 +#> +#> $distimes +#> DT50 DT90 DT50_parent_b1 DT50_parent_b2 +#> parent 1.886925 21.25106 1.508293 38.83438 +#>
    # } + +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/experimental_data_for_UBA-1.png b/docs/dev/reference/experimental_data_for_UBA-1.png new file mode 100644 index 00000000..b316a5db Binary files /dev/null and b/docs/dev/reference/experimental_data_for_UBA-1.png differ diff --git a/docs/dev/reference/experimental_data_for_UBA.html b/docs/dev/reference/experimental_data_for_UBA.html new file mode 100644 index 00000000..d49924c7 --- /dev/null +++ b/docs/dev/reference/experimental_data_for_UBA.html @@ -0,0 +1,300 @@ + + + + + + + + +Experimental datasets used for development and testing of error models — experimental_data_for_UBA_2019 • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    The 12 datasets were extracted from active substance evaluation dossiers published + by EFSA. Kinetic evaluations shown for these datasets are intended to illustrate + and advance error model specifications. The fact that these data and some + results are shown here do not imply a license to use them in the context of + pesticide registrations, as the use of the data may be constrained by + data protection regulations.

    +

    Preprocessing of data was performed based on the recommendations of the FOCUS + kinetics workgroup (FOCUS, 2014) as described below.

    +

    Datasets 1 and 2 are from the Renewal Assessment Report (RAR) for imazamox + (France, 2015, p. 15). For setting values reported as zero, an LOQ of 0.1 + was assumed. Metabolite residues reported for day zero were added to the + parent compound residues.

    +

    Datasets 3 and 4 are from the Renewal Assessment Report (RAR) for isofetamid + (Belgium, 2014, p. 8) and show the data for two different radiolabels. For + dataset 4, the value given for the metabolite in the day zero sampling + in replicate B was added to the parent compound, following the respective + FOCUS recommendation.

    +

    Dataset 5 is from the Renewal Assessment Report (RAR) for ethofumesate + (Austria, 2015, p. 16).

    +

    Datasets 6 to 10 are from the Renewal Assessment Report (RAR) for glyphosate + (Germany, 2013a, pages 8, 28, 50, 51). For the initial sampling, + the residues given for the metabolite were added to the parent + value, following the recommendation of the FOCUS kinetics workgroup.

    +

    Dataset 11 is from the Renewal Assessment Report (RAR) for 2,4-D + (Germany, 2013b, p. 644). Values reported as zero were set to NA, with + the exception of the day three sampling of metabolite A2, which was set + to one half of the LOD reported to be 1% AR.

    +

    Dataset 12 is from the Renewal Assessment Report (RAR) for thifensulfuron-methyl + (United Kingdom, 2014, p. 81).

    +
    + +
    experimental_data_for_UBA_2019
    + + +

    Format

    + +

    A list containing twelve datasets as an R6 class defined by mkinds, + each containing, among others, the following components

    +
    title

    The name of the dataset, e.g. Soil 1

    +
    data

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

    + + + +

    Source

    + + + +

    Austria (2015). Ethofumesate Renewal Assessment Report Volume 3 Annex B.8 (AS)

    +

    Belgium (2014). Isofetamid (IKF-5411) Draft Assessment Report Volume 3 Annex B.8 (AS)

    +

    France (2015). Imazamox Draft Renewal Assessment Report Volume 3 Annex B.8 (AS)

    +

    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

    +

    Germany (2013a). Renewal Assessment Report Glyphosate Volume 3 Annex B.8: Environmental Fate + and Behaviour

    +

    Germany (2013b). Renewal Assessment Report 2,4-D Volume 3 Annex B.8: Fate and behaviour in the + environment

    +

    Ranke (2019) Documentation of results obtained for the error model expertise + written for the German Umweltbundesamt.

    +

    United Kingdom (2014). Thifensulfuron-methyl - Annex B.8 (Volume 3) to the Report and Proposed + Decision of the United Kingdom made to the European Commission under Regulation (EC) No. + 1141/2010 for renewal of an active substance

    + +

    Examples

    +
    # \dontrun{ + +# Model definitions +sfo_sfo <- mkinmod( + parent = mkinsub("SFO", to = "A1"), + A1 = mkinsub("SFO"), + use_of_ff = "max" +)
    #> Successfully compiled differential equation model from auto-generated C code.
    +dfop_sfo <- mkinmod( + parent = mkinsub("DFOP", to = "A1"), + A1 = mkinsub("SFO"), + use_of_ff = "max" +)
    #> Successfully compiled differential equation model from auto-generated C code.
    +sfo_sfo_sfo <- mkinmod( + parent = mkinsub("SFO", to = "A1"), + A1 = mkinsub("SFO", to = "A2"), + A2 = mkinsub("SFO"), + use_of_ff = "max" +)
    #> Successfully compiled differential equation model from auto-generated C code.
    +dfop_sfo_sfo <- mkinmod( + parent = mkinsub("DFOP", to = "A1"), + A1 = mkinsub("SFO", to = "A2"), + A2 = mkinsub("SFO"), + use_of_ff = "max" +)
    #> Successfully compiled differential equation model from auto-generated C code.
    d_1_2 <- lapply(experimental_data_for_UBA_2019[1:2], function(x) x$data) +names(d_1_2) <- paste("Soil", 1:2) + + +f_1_2_tc <- mmkin(list("DFOP-SFO-SFO" = dfop_sfo_sfo), d_1_2, error_model = "tc") + +plot(f_1_2_tc, resplot = "errmod")
    +# }
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/get_deg_func.html b/docs/dev/reference/get_deg_func.html new file mode 100644 index 00000000..7500186b --- /dev/null +++ b/docs/dev/reference/get_deg_func.html @@ -0,0 +1,185 @@ + + + + + + + + +Retrieve a degradation function from the mmkin namespace — get_deg_func • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Retrieve a degradation function from the mmkin namespace

    +
    + +
    get_deg_func()
    + + +

    Value

    + +

    A function that was likely previously assigned from within +nlme.mmkin

    + +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/ilr.html b/docs/dev/reference/ilr.html new file mode 100644 index 00000000..245880f2 --- /dev/null +++ b/docs/dev/reference/ilr.html @@ -0,0 +1,220 @@ + + + + + + + + +Function to perform isometric log-ratio transformation — ilr • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This implementation is a special case of the class of isometric log-ratio +transformations.

    +
    + +
    ilr(x)
    +
    +invilr(x)
    + +

    Arguments

    + + + + + + +
    x

    A numeric vector. Naturally, the forward transformation is only +sensible for vectors with all elements being greater than zero.

    + +

    Value

    + +

    The result of the forward or backward transformation. The returned +components always sum to 1 for the case of the inverse log-ratio +transformation.

    +

    References

    + +

    Peter Filzmoser, Karel Hron (2008) Outlier Detection for +Compositional Data Using Robust Methods. Math Geosci 40 233-248

    +

    See also

    + +

    Another implementation can be found in R package +robCompositions.

    + +

    Examples

    +
    +# Order matters +ilr(c(0.1, 1, 10))
    #> [1] -1.628174 -2.820079
    ilr(c(10, 1, 0.1))
    #> [1] 1.628174 2.820079
    # Equal entries give ilr transformations with zeros as elements +ilr(c(3, 3, 3))
    #> [1] 0 0
    # Almost equal entries give small numbers +ilr(c(0.3, 0.4, 0.3))
    #> [1] -0.2034219 0.1174457
    # Only the ratio between the numbers counts, not their sum +invilr(ilr(c(0.7, 0.29, 0.01)))
    #> [1] 0.70 0.29 0.01
    invilr(ilr(2.1 * c(0.7, 0.29, 0.01)))
    #> [1] 0.70 0.29 0.01
    # Inverse transformation of larger numbers gives unequal elements +invilr(-10)
    #> [1] 7.213536e-07 9.999993e-01
    invilr(c(-10, 0))
    #> [1] 7.207415e-07 9.991507e-01 8.486044e-04
    # The sum of the elements of the inverse ilr is 1 +sum(invilr(c(-10, 0)))
    #> [1] 1
    # This is why we do not need all elements of the inverse transformation to go back: +a <- c(0.1, 0.3, 0.5) +b <- invilr(a) +length(b) # Four elements
    #> [1] 4
    ilr(c(b[1:3], 1 - sum(b[1:3]))) # Gives c(0.1, 0.3, 0.5)
    #> [1] 0.1 0.3 0.5
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/index.html b/docs/dev/reference/index.html new file mode 100644 index 00000000..906bc2f8 --- /dev/null +++ b/docs/dev/reference/index.html @@ -0,0 +1,699 @@ + + + + + + + + +Function reference • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    Main functions

    +

    Essential functionality

    +
    +

    mkinmod()

    +

    Function to set up a kinetic model with one or more state variables

    +

    mkinfit()

    +

    Fit a kinetic model to data with one or more state variables

    +

    mmkin()

    +

    Fit one or more kinetic models with one or more state variables to one or +more datasets

    +

    nafta() print(<nafta>)

    +

    Evaluate parent kinetics using the NAFTA guidance

    +

    Show results

    +

    Functions working with mkinfit objects

    +
    +

    plot(<mkinfit>) plot_sep() plot_res() plot_err()

    +

    Plot the observed data and the fitted model of an mkinfit object

    +

    summary(<mkinfit>) print(<summary.mkinfit>)

    +

    Summary method for class "mkinfit"

    +

    parms()

    +

    Extract model parameters from mkinfit models

    +

    confint(<mkinfit>)

    +

    Confidence intervals for parameters of mkinfit objects

    +

    update(<mkinfit>)

    +

    Update an mkinfit model with different arguments

    +

    lrtest(<mkinfit>) lrtest(<mmkin>)

    +

    Likelihood ratio test for mkinfit models

    +

    loftest()

    +

    Lack-of-fit test for models fitted to data with replicates

    +

    mkinerrmin()

    +

    Calculate the minimum error to assume in order to pass the variance test

    +

    endpoints()

    +

    Function to calculate endpoints for further use from kinetic models fitted +with mkinfit

    +

    aw()

    +

    Calculate Akaike weights for model averaging

    +

    CAKE_export()

    +

    Export a list of datasets format to a CAKE study file

    +

    Work with mmkin objects

    +

    Functions working with aggregated results

    +
    +

    `[`(<mmkin>)

    +

    Subsetting method for mmkin objects

    +

    plot(<mmkin>)

    +

    Plot model fits (observed and fitted) and the residuals for a row or column +of an mmkin object

    +

    AIC(<mmkin>) BIC(<mmkin>)

    +

    Calculate the AIC for a column of an mmkin object

    +

    Mixed models

    +

    Create and work with nonlinear mixed models

    +
    +

    nlme(<mmkin>) print(<nlme.mmkin>) update(<nlme.mmkin>)

    +

    Create an nlme model for an mmkin row object

    +

    plot(<nlme.mmkin>)

    +

    Plot a fitted nonlinear mixed model obtained via an mmkin row object

    +

    nlme_function() mean_degparms() nlme_data()

    +

    Helper functions to create nlme models from mmkin row objects

    +

    saemix_model() saemix_data()

    +

    Create saemix models from mmkin row objects

    +

    get_deg_func()

    +

    Retrieve a degradation function from the mmkin namespace

    +

    Datasets and known results

    +

    +
    +

    FOCUS_2006_A FOCUS_2006_B FOCUS_2006_C FOCUS_2006_D FOCUS_2006_E FOCUS_2006_F

    +

    Datasets A to F from the FOCUS Kinetics report from 2006

    +

    FOCUS_2006_SFO_ref_A_to_F

    +

    Results of fitting the SFO model to Datasets A to F of FOCUS (2006)

    +

    FOCUS_2006_FOMC_ref_A_to_F

    +

    Results of fitting the FOMC model to Datasets A to F of FOCUS (2006)

    +

    FOCUS_2006_HS_ref_A_to_F

    +

    Results of fitting the HS model to Datasets A to F of FOCUS (2006)

    +

    FOCUS_2006_DFOP_ref_A_to_B

    +

    Results of fitting the DFOP model to Datasets A to B of FOCUS (2006)

    +

    NAFTA_SOP_Appendix_B NAFTA_SOP_Appendix_D

    +

    Example datasets from the NAFTA SOP published 2015

    +

    NAFTA_SOP_Attachment

    +

    Example datasets from Attachment 1 to the NAFTA SOP published 2015

    +

    mccall81_245T

    +

    Datasets on aerobic soil metabolism of 2,4,5-T in six soils

    +

    schaefer07_complex_case

    +

    Metabolism data set used for checking the software quality of KinGUI

    +

    synthetic_data_for_UBA_2014

    +

    Synthetic datasets for one parent compound with two metabolites

    +

    experimental_data_for_UBA_2019

    +

    Experimental datasets used for development and testing of error models

    +

    test_data_from_UBA_2014

    +

    Three experimental datasets from two water sediment systems and one soil

    +

    mkinds

    +

    A dataset class for mkin

    +

    print(<mkinds>)

    +

    Print mkinds objects

    +

    NAFTA guidance

    +

    +
    +

    nafta() print(<nafta>)

    +

    Evaluate parent kinetics using the NAFTA guidance

    +

    plot(<nafta>)

    +

    Plot the results of the three models used in the NAFTA scheme.

    +

    Helper functions mainly used internally

    +

    +
    +

    mkinsub()

    +

    Function to set up a kinetic submodel for one state variable

    +

    max_twa_parent() max_twa_sfo() max_twa_fomc() max_twa_dfop() max_twa_hs()

    +

    Function to calculate maximum time weighted average concentrations from +kinetic models fitted with mkinfit

    +

    mkinpredict()

    +

    Produce predictions from a kinetic model using specific parameters

    +

    mkin_wide_to_long()

    +

    Convert a dataframe with observations over time into long format

    +

    mkin_long_to_wide()

    +

    Convert a dataframe from long to wide format

    +

    print(<mkinmod>)

    +

    Print mkinmod objects

    +

    transform_odeparms() backtransform_odeparms()

    +

    Functions to transform and backtransform kinetic parameters for fitting

    +

    ilr() invilr()

    +

    Function to perform isometric log-ratio transformation

    +

    sigma_twocomp()

    +

    Two-component error model

    +

    logLik(<mkinfit>)

    +

    Calculated the log-likelihood of a fitted mkinfit object

    +

    residuals(<mkinfit>)

    +

    Extract residuals from an mkinfit model

    +

    nobs(<mkinfit>)

    +

    Number of observations on which an mkinfit object was fitted

    +

    mkinresplot()

    +

    Function to plot residuals stored in an mkin object

    +

    mkinparplot()

    +

    Function to plot the confidence intervals obtained using mkinfit

    +

    mkinerrplot()

    +

    Function to plot squared residuals and the error model for an mkin object

    +

    create_deg_func()

    +

    Create degradation functions for known analytical solutions

    +

    Analytical solutions

    +

    Parent only model solutions

    +
    +

    SFO.solution()

    +

    Single First-Order kinetics

    +

    FOMC.solution()

    +

    First-Order Multi-Compartment kinetics

    +

    DFOP.solution()

    +

    Double First-Order in Parallel kinetics

    +

    SFORB.solution()

    +

    Single First-Order Reversible Binding kinetics

    +

    HS.solution()

    +

    Hockey-Stick kinetics

    +

    IORE.solution()

    +

    Indeterminate order rate equation kinetics

    +

    logistic.solution()

    +

    Logistic kinetics

    +

    Generate synthetic datasets

    +

    +
    +

    add_err()

    +

    Add normally distributed errors to simulated kinetic degradation data

    +

    Deprecated functions

    +

    Functions that have been superseded

    +
    +

    mkinplot()

    +

    Plot the observed data and the fitted model of an mkinfit object

    +
    + + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/loftest-1.png b/docs/dev/reference/loftest-1.png new file mode 100644 index 00000000..3d20f41e Binary files /dev/null and b/docs/dev/reference/loftest-1.png differ diff --git a/docs/dev/reference/loftest-2.png b/docs/dev/reference/loftest-2.png new file mode 100644 index 00000000..be8bf815 Binary files /dev/null and b/docs/dev/reference/loftest-2.png differ diff --git a/docs/dev/reference/loftest-3.png b/docs/dev/reference/loftest-3.png new file mode 100644 index 00000000..cb55838c Binary files /dev/null and b/docs/dev/reference/loftest-3.png differ diff --git a/docs/dev/reference/loftest-4.png b/docs/dev/reference/loftest-4.png new file mode 100644 index 00000000..e2b8ac5c Binary files /dev/null and b/docs/dev/reference/loftest-4.png differ diff --git a/docs/dev/reference/loftest-5.png b/docs/dev/reference/loftest-5.png new file mode 100644 index 00000000..a4d9fd48 Binary files /dev/null and b/docs/dev/reference/loftest-5.png differ diff --git a/docs/dev/reference/loftest.html b/docs/dev/reference/loftest.html new file mode 100644 index 00000000..b93b3aa3 --- /dev/null +++ b/docs/dev/reference/loftest.html @@ -0,0 +1,349 @@ + + + + + + + + +Lack-of-fit test for models fitted to data with replicates — loftest • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This is a generic function with a method currently only defined for mkinfit +objects. It fits an anova model to the data contained in the object and +compares the likelihoods using the likelihood ratio test +lrtest.default from the lmtest package.

    +
    + +
    loftest(object, ...)
    +
    +# S3 method for mkinfit
    +loftest(object, ...)
    + +

    Arguments

    + + + + + + + + + + +
    object

    A model object with a defined loftest method

    ...

    Not used

    + +

    Details

    + +

    The anova model is interpreted as the simplest form of an mkinfit model, +assuming only a constant variance about the means, but not enforcing any +structure of the means, so we have one model parameter for every mean +of replicate samples.

    +

    See also

    + +

    lrtest

    + +

    Examples

    +
    # \dontrun{ +test_data <- subset(synthetic_data_for_UBA_2014[[12]]$data, name == "parent") +sfo_fit <- mkinfit("SFO", test_data, quiet = TRUE) +plot_res(sfo_fit) # We see a clear pattern in the residuals
    loftest(sfo_fit) # We have a clear lack of fit
    #> Likelihood ratio test +#> +#> Model 1: ANOVA with error model const +#> Model 2: SFO with error model const +#> #Df LogLik Df Chisq Pr(>Chisq) +#> 1 10 -40.710 +#> 2 3 -63.954 -7 46.487 7.027e-08 *** +#> --- +#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    # +# We try a different model (the one that was used to generate the data) +dfop_fit <- mkinfit("DFOP", test_data, quiet = TRUE) +plot_res(dfop_fit) # We don't see systematic deviations, but heteroscedastic residuals
    # therefore we should consider adapting the error model, although we have +loftest(dfop_fit) # no lack of fit
    #> Likelihood ratio test +#> +#> Model 1: ANOVA with error model const +#> Model 2: DFOP with error model const +#> #Df LogLik Df Chisq Pr(>Chisq) +#> 1 10 -40.710 +#> 2 5 -42.453 -5 3.485 0.6257
    # +# This is the anova model used internally for the comparison +test_data_anova <- test_data +test_data_anova$time <- as.factor(test_data_anova$time) +anova_fit <- lm(value ~ time, data = test_data_anova) +summary(anova_fit)
    #> +#> Call: +#> lm(formula = value ~ time, data = test_data_anova) +#> +#> Residuals: +#> Min 1Q Median 3Q Max +#> -6.1000 -0.5625 0.0000 0.5625 6.1000 +#> +#> Coefficients: +#> Estimate Std. Error t value Pr(>|t|) +#> (Intercept) 103.150 2.323 44.409 7.44e-12 *** +#> time1 -19.950 3.285 -6.073 0.000185 *** +#> time3 -50.800 3.285 -15.465 8.65e-08 *** +#> time7 -68.500 3.285 -20.854 6.28e-09 *** +#> time14 -79.750 3.285 -24.278 1.63e-09 *** +#> time28 -86.000 3.285 -26.181 8.35e-10 *** +#> time60 -94.900 3.285 -28.891 3.48e-10 *** +#> time90 -98.500 3.285 -29.986 2.49e-10 *** +#> time120 -100.450 3.285 -30.580 2.09e-10 *** +#> --- +#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 +#> +#> Residual standard error: 3.285 on 9 degrees of freedom +#> Multiple R-squared: 0.9953, Adjusted R-squared: 0.9912 +#> F-statistic: 240.5 on 8 and 9 DF, p-value: 1.417e-09 +#>
    logLik(anova_fit) # We get the same likelihood and degrees of freedom
    #> 'log Lik.' -40.71015 (df=10)
    # +test_data_2 <- synthetic_data_for_UBA_2014[[12]]$data +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.
    sfo_lin_fit <- mkinfit(m_synth_SFO_lin, test_data_2, quiet = TRUE) +plot_res(sfo_lin_fit) # not a good model, we try parallel formation
    loftest(sfo_lin_fit)
    #> Likelihood ratio test +#> +#> Model 1: ANOVA with error model const +#> Model 2: m_synth_SFO_lin with error model const and fixed parameter(s) M1_0, M2_0 +#> #Df LogLik Df Chisq Pr(>Chisq) +#> 1 28 -93.606 +#> 2 7 -171.927 -21 156.64 < 2.2e-16 *** +#> --- +#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    # +m_synth_SFO_par <- mkinmod(parent = list(type = "SFO", to = c("M1", "M2")), + M1 = list(type = "SFO"), + M2 = list(type = "SFO"), use_of_ff = "max")
    #> Successfully compiled differential equation model from auto-generated C code.
    sfo_par_fit <- mkinfit(m_synth_SFO_par, test_data_2, quiet = TRUE) +plot_res(sfo_par_fit) # much better for metabolites
    loftest(sfo_par_fit)
    #> Likelihood ratio test +#> +#> Model 1: ANOVA with error model const +#> Model 2: m_synth_SFO_par with error model const and fixed parameter(s) M1_0, M2_0 +#> #Df LogLik Df Chisq Pr(>Chisq) +#> 1 28 -93.606 +#> 2 7 -156.331 -21 125.45 < 2.2e-16 *** +#> --- +#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    # +m_synth_DFOP_par <- mkinmod(parent = list(type = "DFOP", to = c("M1", "M2")), + M1 = list(type = "SFO"), + M2 = list(type = "SFO"), use_of_ff = "max")
    #> Successfully compiled differential equation model from auto-generated C code.
    dfop_par_fit <- mkinfit(m_synth_DFOP_par, test_data_2, quiet = TRUE) +plot_res(dfop_par_fit) # No visual lack of fit
    loftest(dfop_par_fit) # no lack of fit found by the test
    #> Likelihood ratio test +#> +#> Model 1: ANOVA with error model const +#> Model 2: m_synth_DFOP_par with error model const and fixed parameter(s) M1_0, M2_0 +#> #Df LogLik Df Chisq Pr(>Chisq) +#> 1 28 -93.606 +#> 2 9 -102.763 -19 18.313 0.5016
    # +# The anova model used for comparison in the case of transformation products +test_data_anova_2 <- dfop_par_fit$data +test_data_anova_2$variable <- as.factor(test_data_anova_2$variable) +test_data_anova_2$time <- as.factor(test_data_anova_2$time) +anova_fit_2 <- lm(observed ~ time:variable - 1, data = test_data_anova_2) +summary(anova_fit_2)
    #> +#> Call: +#> lm(formula = observed ~ time:variable - 1, data = test_data_anova_2) +#> +#> Residuals: +#> Min 1Q Median 3Q Max +#> -6.1000 -0.5875 0.0000 0.5875 6.1000 +#> +#> Coefficients: (2 not defined because of singularities) +#> Estimate Std. Error t value Pr(>|t|) +#> time0:variableparent 103.150 1.573 65.562 < 2e-16 *** +#> time1:variableparent 83.200 1.573 52.882 < 2e-16 *** +#> time3:variableparent 52.350 1.573 33.274 < 2e-16 *** +#> time7:variableparent 34.650 1.573 22.024 < 2e-16 *** +#> time14:variableparent 23.400 1.573 14.873 6.35e-14 *** +#> time28:variableparent 17.150 1.573 10.901 5.47e-11 *** +#> time60:variableparent 8.250 1.573 5.244 1.99e-05 *** +#> time90:variableparent 4.650 1.573 2.956 0.006717 ** +#> time120:variableparent 2.700 1.573 1.716 0.098507 . +#> time0:variableM1 NA NA NA NA +#> time1:variableM1 11.850 1.573 7.532 6.93e-08 *** +#> time3:variableM1 22.700 1.573 14.428 1.26e-13 *** +#> time7:variableM1 33.050 1.573 21.007 < 2e-16 *** +#> time14:variableM1 31.250 1.573 19.863 < 2e-16 *** +#> time28:variableM1 18.900 1.573 12.013 7.02e-12 *** +#> time60:variableM1 7.550 1.573 4.799 6.28e-05 *** +#> time90:variableM1 3.850 1.573 2.447 0.021772 * +#> time120:variableM1 2.050 1.573 1.303 0.204454 +#> time0:variableM2 NA NA NA NA +#> time1:variableM2 6.700 1.573 4.259 0.000254 *** +#> time3:variableM2 16.750 1.573 10.646 8.93e-11 *** +#> time7:variableM2 25.800 1.573 16.399 6.89e-15 *** +#> time14:variableM2 28.600 1.573 18.178 6.35e-16 *** +#> time28:variableM2 25.400 1.573 16.144 9.85e-15 *** +#> time60:variableM2 21.600 1.573 13.729 3.81e-13 *** +#> time90:variableM2 17.800 1.573 11.314 2.51e-11 *** +#> time120:variableM2 14.100 1.573 8.962 2.79e-09 *** +#> --- +#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 +#> +#> Residual standard error: 2.225 on 25 degrees of freedom +#> Multiple R-squared: 0.9979, Adjusted R-squared: 0.9957 +#> F-statistic: 469.2 on 25 and 25 DF, p-value: < 2.2e-16 +#>
    # } +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/logLik.mkinfit.html b/docs/dev/reference/logLik.mkinfit.html new file mode 100644 index 00000000..840a4821 --- /dev/null +++ b/docs/dev/reference/logLik.mkinfit.html @@ -0,0 +1,229 @@ + + + + + + + + +Calculated the log-likelihood of a fitted mkinfit object — logLik.mkinfit • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function returns the product of the likelihood densities of each +observed value, as calculated as part of the fitting procedure using +dnorm, i.e. assuming normal distribution, and with the means +predicted by the degradation model, and the standard deviations predicted by +the error model.

    +
    + +
    # S3 method for mkinfit
    +logLik(object, ...)
    + +

    Arguments

    + + + + + + + + + + +
    object

    An object of class mkinfit.

    ...

    For compatibility with the generic method

    + +

    Value

    + +

    An object of class logLik with the number of estimated +parameters (degradation model parameters plus variance model parameters) +as attribute.

    +

    Details

    + +

    The total number of estimated parameters returned with the value of the +likelihood is calculated as the sum of fitted degradation model parameters +and the fitted error model parameters.

    +

    See also

    + +

    Compare the AIC of columns of mmkin objects using +AIC.mmkin.

    + +

    Examples

    +
    + # \dontrun{ + sfo_sfo <- mkinmod( + parent = mkinsub("SFO", to = "m1"), + m1 = mkinsub("SFO") + )
    #> Successfully compiled differential equation model from auto-generated C code.
    d_t <- FOCUS_2006_D + f_nw <- mkinfit(sfo_sfo, d_t, quiet = TRUE) # no weighting (weights are unity)
    #> Warning: Observations with value of zero were removed from the data
    f_obs <- mkinfit(sfo_sfo, d_t, error_model = "obs", quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    f_tc <- mkinfit(sfo_sfo, d_t, error_model = "tc", quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    AIC(f_nw, f_obs, f_tc)
    #> df AIC +#> f_nw 5 204.4486 +#> f_obs 6 205.8727 +#> f_tc 6 141.9656
    # } + +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/logistic.solution-1.png b/docs/dev/reference/logistic.solution-1.png new file mode 100644 index 00000000..fd11d0c0 Binary files /dev/null and b/docs/dev/reference/logistic.solution-1.png differ diff --git a/docs/dev/reference/logistic.solution-2.png b/docs/dev/reference/logistic.solution-2.png new file mode 100644 index 00000000..78a31f93 Binary files /dev/null and b/docs/dev/reference/logistic.solution-2.png differ diff --git a/docs/dev/reference/logistic.solution.html b/docs/dev/reference/logistic.solution.html new file mode 100644 index 00000000..4804fc73 --- /dev/null +++ b/docs/dev/reference/logistic.solution.html @@ -0,0 +1,275 @@ + + + + + + + + +Logistic kinetics — logistic.solution • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Function describing exponential decline from a defined starting value, with +an increasing rate constant, supposedly caused by microbial growth

    +
    + +
    logistic.solution(t, parent_0, kmax, k0, r)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + +
    t

    Time.

    parent_0

    Starting value for the response variable at time zero.

    kmax

    Maximum rate constant.

    k0

    Minimum rate constant effective at time zero.

    r

    Growth rate of the increase in the rate constant.

    + +

    Value

    + +

    The value of the response variable at time t.

    +

    Note

    + +

    The solution of the logistic model reduces to the +SFO.solution if k0 is equal to kmax.

    +

    References

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence +and Degradation Kinetics from Environmental Fate Studies on Pesticides in +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

    +

    See also

    + +

    Other parent solutions: +DFOP.solution(), +FOMC.solution(), +HS.solution(), +IORE.solution(), +SFO.solution(), +SFORB.solution()

    + +

    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)), + 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) + d_logistic <- mkinpredict(logistic, + 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 +#> parent_0 1.057896e+02 1.9023449649 55.610120 3.768361e-16 1.016451e+02 +#> kmax 6.398190e-02 0.0143201029 4.467978 3.841828e-04 3.929235e-02 +#> k0 1.612775e-04 0.0005866813 0.274898 3.940351e-01 5.846685e-08 +#> r 2.263946e-01 0.1718110773 1.317695 1.061044e-01 4.335843e-02 +#> sigma 5.332935e+00 0.9145907310 5.830952 4.036926e-05 3.340213e+00 +#> Upper +#> parent_0 109.9341588 +#> kmax 0.1041853 +#> k0 0.4448750 +#> r 1.1821121 +#> sigma 7.3256566
    endpoints(m)$distimes
    #> DT50 DT90 DT50_k0 DT50_kmax +#> parent 36.86533 62.41511 4297.854 10.83349
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/lrtest.mkinfit.html b/docs/dev/reference/lrtest.mkinfit.html new file mode 100644 index 00000000..712cfcfb --- /dev/null +++ b/docs/dev/reference/lrtest.mkinfit.html @@ -0,0 +1,265 @@ + + + + + + + + +Likelihood ratio test for mkinfit models — lrtest.mkinfit • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Compare two mkinfit models based on their likelihood. If two fitted +mkinfit objects are given as arguments, it is checked if they have been +fitted to the same data. It is the responsibility of the user to make sure +that the models are nested, i.e. one of them has less degrees of freedom +and can be expressed by fixing the parameters of the other.

    +
    + +
    # S3 method for mkinfit
    +lrtest(object, object_2 = NULL, ...)
    +
    +# S3 method for mmkin
    +lrtest(object, ...)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    object

    An mkinfit object, or an mmkin column +object containing two fits to the same data.

    object_2

    Optionally, another mkinfit object fitted to the same data.

    ...

    Argument to mkinfit, passed to +update.mkinfit for creating the alternative fitted object.

    + +

    Details

    + +

    Alternatively, an argument to mkinfit can be given which is then passed +to update.mkinfit to obtain the alternative model.

    +

    The comparison is then made by the lrtest.default +method from the lmtest package. The model with the higher number of fitted +parameters (alternative hypothesis) is listed first, then the model with the +lower number of fitted parameters (null hypothesis).

    + +

    Examples

    +
    # \dontrun{ +test_data <- subset(synthetic_data_for_UBA_2014[[12]]$data, name == "parent") +sfo_fit <- mkinfit("SFO", test_data, quiet = TRUE) +dfop_fit <- mkinfit("DFOP", test_data, quiet = TRUE) +lrtest(dfop_fit, sfo_fit)
    #> Likelihood ratio test +#> +#> Model 1: DFOP with error model const +#> Model 2: SFO with error model const +#> #Df LogLik Df Chisq Pr(>Chisq) +#> 1 5 -42.453 +#> 2 3 -63.954 -2 43.002 4.594e-10 *** +#> --- +#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    lrtest(sfo_fit, dfop_fit)
    #> Likelihood ratio test +#> +#> Model 1: DFOP with error model const +#> Model 2: SFO with error model const +#> #Df LogLik Df Chisq Pr(>Chisq) +#> 1 5 -42.453 +#> 2 3 -63.954 -2 43.002 4.594e-10 *** +#> --- +#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    +# The following two examples are commented out as they fail during +# generation of the static help pages by pkgdown +#lrtest(dfop_fit, error_model = "tc") +#lrtest(dfop_fit, fixed_parms = c(k2 = 0)) + +# However, this equivalent syntax also works for static help pages +lrtest(dfop_fit, update(dfop_fit, error_model = "tc"))
    #> Likelihood ratio test +#> +#> Model 1: DFOP with error model tc +#> Model 2: DFOP with error model const +#> #Df LogLik Df Chisq Pr(>Chisq) +#> 1 6 -34.587 +#> 2 5 -42.453 -1 15.731 7.302e-05 *** +#> --- +#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    lrtest(dfop_fit, update(dfop_fit, fixed_parms = c(k2 = 0)))
    #> Likelihood ratio test +#> +#> Model 1: DFOP with error model const +#> Model 2: DFOP with error model const and fixed parameter(s) k2 +#> #Df LogLik Df Chisq Pr(>Chisq) +#> 1 5 -42.453 +#> 2 4 -57.340 -1 29.776 4.851e-08 *** +#> --- +#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
    # } +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/max_twa_parent.html b/docs/dev/reference/max_twa_parent.html new file mode 100644 index 00000000..77166d00 --- /dev/null +++ b/docs/dev/reference/max_twa_parent.html @@ -0,0 +1,270 @@ + + + + + + + + +Function to calculate maximum time weighted average concentrations from +kinetic models fitted with mkinfit — max_twa_parent • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function calculates maximum moving window time weighted average +concentrations (TWAs) for kinetic models fitted with mkinfit. +Currently, only calculations for the parent are implemented for the SFO, +FOMC, DFOP and HS models, using the analytical formulas given in the PEC +soil section of the FOCUS guidance.

    +
    + +
    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

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    fit

    An object of class mkinfit.

    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

    + +

    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

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence +and Degradation Kinetics from Environmental Fate Studies on Pesticides in +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

    + +

    Examples

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

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mccall81_245T.html b/docs/dev/reference/mccall81_245T.html new file mode 100644 index 00000000..dc0dfbf8 --- /dev/null +++ b/docs/dev/reference/mccall81_245T.html @@ -0,0 +1,245 @@ + + + + + + + + +Datasets on aerobic soil metabolism of 2,4,5-T in six soils — mccall81_245T • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Time course of 2,4,5-trichlorophenoxyacetic acid, and the corresponding + 2,4,5-trichlorophenol and 2,4,5-trichloroanisole as recovered in diethylether + extracts.

    +
    + +
    mccall81_245T
    + + +

    Format

    + +

    A dataframe containing the following variables.

    +
    name

    the name of the compound observed. Note that T245 is used as + an acronym for 2,4,5-T. T245 is a legitimate object name + in R, which is necessary for specifying models using + mkinmod.

    +
    time

    a numeric vector containing sampling times in days after + treatment

    +
    value

    a numeric vector containing concentrations in percent of applied radioactivity

    +
    soil

    a factor containing the name of the soil

    + + + +

    Source

    + +

    McCall P, Vrona SA, Kelley SS (1981) Fate of uniformly carbon-14 ring labelled 2,4,5-Trichlorophenoxyacetic acid and 2,4-dichlorophenoxyacetic acid. J Agric Chem 29, 100-107 + http://dx.doi.org/10.1021/jf00103a026

    + +

    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.
    # \dontrun{ + fit.1 <- mkinfit(SFO_SFO_SFO, subset(mccall81_245T, soil == "Commerce"), quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    summary(fit.1)$bpar
    #> Estimate se_notrans t value Pr(>t) +#> T245_0 1.038550e+02 2.184707509 47.537272 4.472189e-18 +#> k_T245 4.337042e-02 0.001898397 22.845818 2.276912e-13 +#> k_phenol 4.050581e-01 0.298699410 1.356073 9.756993e-02 +#> k_anisole 6.678742e-03 0.000802144 8.326114 2.623179e-07 +#> f_T245_to_phenol 6.227599e-01 0.398534147 1.562626 6.949418e-02 +#> f_phenol_to_anisole 1.000000e+00 0.671844135 1.488440 7.867793e-02 +#> sigma 2.514628e+00 0.490755933 5.123989 6.233163e-05 +#> Lower Upper +#> T245_0 99.246061427 1.084640e+02 +#> k_T245 0.039631621 4.746194e-02 +#> k_phenol 0.218013878 7.525762e-01 +#> k_anisole 0.005370739 8.305299e-03 +#> f_T245_to_phenol 0.547559082 6.924813e-01 +#> f_phenol_to_anisole 0.000000000 1.000000e+00 +#> sigma 1.706607296 3.322649e+00
    endpoints(fit.1)
    #> $ff +#> T245_phenol T245_sink phenol_anisole phenol_sink +#> 6.227599e-01 3.772401e-01 1.000000e+00 1.005127e-10 +#> +#> $distimes +#> DT50 DT90 +#> T245 15.982025 53.09114 +#> 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
    #> Warning: Initial parameter(s) k_phenol_sink not used in the model
    #> Error in data.frame(value = c(state.ini.fixed, parms.fixed)): row names contain missing values
    summary(fit.2)$bpar
    #> Error in summary(fit.2): object 'fit.2' not found
    endpoints(fit.1)
    #> $ff +#> T245_phenol T245_sink phenol_anisole phenol_sink +#> 6.227599e-01 3.772401e-01 1.000000e+00 1.005127e-10 +#> +#> $distimes +#> DT50 DT90 +#> T245 15.982025 53.09114 +#> phenol 1.711229 5.68458 +#> anisole 103.784092 344.76329 +#>
    plot_sep(fit.2)
    #> Error in identical(fit$err_mod, "const"): object 'fit.2' not found
    # } +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mkin_long_to_wide.html b/docs/dev/reference/mkin_long_to_wide.html new file mode 100644 index 00000000..143eb12a --- /dev/null +++ b/docs/dev/reference/mkin_long_to_wide.html @@ -0,0 +1,233 @@ + + + + + + + + +Convert a dataframe from long to wide format — mkin_long_to_wide • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function takes a dataframe in the long form, i.e. with a row for each +observed value, and converts it into a dataframe with one independent +variable and several dependent variables as columns.

    +
    + +
    mkin_long_to_wide(long_data, time = "time", outtime = "time")
    + +

    Arguments

    + + + + + + + + + + + + + + +
    long_data

    The dataframe must contain one variable called "time" with +the time values specified by the time argument, one column called +"name" with the grouping of the observed values, and finally one column of +observed values called "value".

    time

    The name of the time variable in the long input data.

    outtime

    The name of the time variable in the wide output data.

    + +

    Value

    + +

    Dataframe in wide format.

    + +

    Examples

    +
    +mkin_long_to_wide(FOCUS_2006_D)
    #> time parent m1 +#> 1 0 99.46 0.00 +#> 2 0 102.04 0.00 +#> 3 1 93.50 4.84 +#> 4 1 92.50 5.64 +#> 5 3 63.23 12.91 +#> 6 3 68.99 12.96 +#> 7 7 52.32 22.97 +#> 8 7 55.13 24.47 +#> 9 14 27.27 41.69 +#> 10 14 26.64 33.21 +#> 11 21 11.50 44.37 +#> 12 21 11.64 46.44 +#> 13 35 2.85 41.22 +#> 14 35 2.91 37.95 +#> 15 50 0.69 41.19 +#> 16 50 0.63 40.01 +#> 17 75 0.05 40.09 +#> 18 75 0.06 33.85 +#> 19 100 NA 31.04 +#> 20 100 NA 33.13 +#> 21 120 NA 25.15 +#> 22 120 NA 33.31
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mkin_wide_to_long.html b/docs/dev/reference/mkin_wide_to_long.html new file mode 100644 index 00000000..14419558 --- /dev/null +++ b/docs/dev/reference/mkin_wide_to_long.html @@ -0,0 +1,213 @@ + + + + + + + + +Convert a dataframe with observations over time into long format — mkin_wide_to_long • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function simply takes a dataframe with one independent variable and +several dependent variable and converts it into the long form as required by +mkinfit.

    +
    + +
    mkin_wide_to_long(wide_data, time = "t")
    + +

    Arguments

    + + + + + + + + + + +
    wide_data

    The dataframe must contain one variable with the time +values specified by the time argument and usually more than one +column of observed values.

    time

    The name of the time variable.

    + +

    Value

    + +

    Dataframe in long format as needed for mkinfit.

    + +

    Examples

    +
    +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 +#> 3 x 3 7 +#> 4 y 1 3 +#> 5 y 2 4 +#> 6 y 3 5
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mkinds.html b/docs/dev/reference/mkinds.html new file mode 100644 index 00000000..5c7d9490 --- /dev/null +++ b/docs/dev/reference/mkinds.html @@ -0,0 +1,253 @@ + + + + + + + + +A dataset class for mkin — mkinds • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    At the moment this dataset class is hardly used in mkin. For example, +mkinfit does not take mkinds datasets as argument, but works with dataframes +such as the on contained in the data field of mkinds objects. Some datasets +provided by this package come as mkinds objects nevertheless.

    +
    + + + +

    See also

    + +

    The S3 printing method print.mkinds

    +

    Public fields

    + +

    +
    title

    A full title for the dataset

    + +
    sampling_times

    The sampling times

    + +
    time_unit

    The time unit

    + +
    observed

    Names of the observed variables

    + +
    unit

    The unit of the observations

    + +
    replicates

    The maximum number of replicates per sampling time

    + +
    data

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

    + +

    +

    Methods

    + + +

    Public methods

    + + +


    +

    Method new()

    +

    Create a new mkinds object

    Usage

    +

    mkinds$new(title = "", data, time_unit = NA, unit = NA)

    + +

    Arguments

    +

    +
    title

    The dataset title

    + +
    data

    The data

    + +
    time_unit

    The time unit

    + +
    unit

    The unit of the observations

    + +

    +


    +

    Method clone()

    +

    The objects of this class are cloneable with this method.

    Usage

    +

    mkinds$clone(deep = FALSE)

    + +

    Arguments

    +

    +
    deep

    Whether to make a deep clone.

    + +

    + + + +

    Examples

    +
    +mds <- mkinds$new("FOCUS A", FOCUS_2006_A) +print(mds)
    #> <mkinds> with $title: FOCUS A +#> Observed compounds $observed: parent +#> Sampling times $sampling_times: 0, 3, 7, 14, 30, 62, 90, 118 +#> With a maximum of 1 replicates
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mkinerrmin.html b/docs/dev/reference/mkinerrmin.html new file mode 100644 index 00000000..9f58dfaa --- /dev/null +++ b/docs/dev/reference/mkinerrmin.html @@ -0,0 +1,233 @@ + + + + + + + + +Calculate the minimum error to assume in order to pass the variance test — mkinerrmin • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function finds the smallest relative error still resulting in passing +the chi-squared test as defined in the FOCUS kinetics report from 2006.

    +
    + +
    mkinerrmin(fit, alpha = 0.05)
    + +

    Arguments

    + + + + + + + + + + +
    fit

    an object of class mkinfit.

    alpha

    The confidence level chosen for the chi-squared test.

    + +

    Value

    + +

    A dataframe with the following components:

    +
    err.min

    The +relative error, expressed as a fraction.

    n.optim

    The number of +optimised parameters attributed to the data series.

    df

    The number of +remaining degrees of freedom for the chi2 error level calculations. Note +that mean values are used for the chi2 statistic and therefore every time +point with observed values in the series only counts one time.

    The +dataframe has one row for the total dataset and one further row for each +observed state variable in the model. + +

    Details

    + +

    This function is used internally by summary.mkinfit.

    +

    References

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence +and Degradation Kinetics from Environmental Fate Studies on Pesticides in 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

    + +

    Examples

    +
    +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 +#> All data 0.0640 4 15 +#> parent 0.0646 2 7 +#> 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
    # } + +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mkinerrplot-1.png b/docs/dev/reference/mkinerrplot-1.png new file mode 100644 index 00000000..c5d3495f Binary files /dev/null and b/docs/dev/reference/mkinerrplot-1.png differ diff --git a/docs/dev/reference/mkinerrplot.html b/docs/dev/reference/mkinerrplot.html new file mode 100644 index 00000000..940a6861 --- /dev/null +++ b/docs/dev/reference/mkinerrplot.html @@ -0,0 +1,272 @@ + + + + + + + + +Function to plot squared residuals and the error model for an mkin object — mkinerrplot • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function plots the squared residuals for the specified subset of the +observed variables from an mkinfit object. In addition, one or more dashed +line(s) show the fitted error model. A combined plot of the fitted model +and this error model plot can be obtained with plot.mkinfit +using the argument show_errplot = TRUE.

    +
    + +
    mkinerrplot(
    +  object,
    +  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

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    object

    A fit represented in an mkinfit object.

    obs_vars

    A character vector of names of the observed variables for +which residuals should be plotted. Defaults to all observed variables in +the model

    xlim

    plot range in x direction.

    xlab

    Label for the x axis.

    ylab

    Label for the y axis.

    maxy

    Maximum value of the residuals. This is used for the scaling of +the y axis and defaults to "auto".

    legend

    Should a legend be plotted?

    lpos

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

    col_obs

    Colors for the observed variables.

    pch_obs

    Symbols to be used for the observed variables.

    frame

    Should a frame be drawn around the plots?

    ...

    further arguments passed to plot.

    + +

    Value

    + +

    Nothing is returned by this function, as it is called for its side +effect, namely to produce a plot.

    +

    See also

    + +

    mkinplot, for a way to plot the data and the fitted +lines of the mkinfit object.

    + +

    Examples

    +
    +# \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.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mkinfit.html b/docs/dev/reference/mkinfit.html new file mode 100644 index 00000000..49e896fc --- /dev/null +++ b/docs/dev/reference/mkinfit.html @@ -0,0 +1,1054 @@ + + + + + + + + +Fit a kinetic model to data with one or more state variables — mkinfit • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function maximises the likelihood of the observed data using the Port +algorithm stats::nlminb(), and the specified initial or fixed +parameters and starting values. In each step of the optimisation, the +kinetic model is solved using the function mkinpredict(), except +if an analytical solution is implemented, in which case the model is solved +using the degradation function in the mkinmod object. The +parameters of the selected error model are fitted simultaneously with the +degradation model parameters, as both of them are arguments of the +likelihood function.

    +
    + +
    mkinfit(
    +  mkinmod,
    +  observed,
    +  parms.ini = "auto",
    +  state.ini = "auto",
    +  err.ini = "auto",
    +  fixed_parms = NULL,
    +  fixed_initials = names(mkinmod$diffs)[-1],
    +  from_max_mean = FALSE,
    +  solution_type = c("auto", "analytical", "eigen", "deSolve"),
    +  method.ode = "lsoda",
    +  use_compiled = "auto",
    +  control = list(eval.max = 300, iter.max = 200),
    +  transform_rates = TRUE,
    +  transform_fractions = TRUE,
    +  quiet = FALSE,
    +  atol = 1e-08,
    +  rtol = 1e-10,
    +  error_model = c("const", "obs", "tc"),
    +  error_model_algorithm = c("auto", "d_3", "direct", "twostep", "threestep",
    +    "fourstep", "IRLS", "OLS"),
    +  reweight.tol = 1e-08,
    +  reweight.max.iter = 10,
    +  trace_parms = FALSE,
    +  ...
    +)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    mkinmod

    A list of class mkinmod, containing the kinetic +model to be fitted to the data, or one of the shorthand names ("SFO", +"FOMC", "DFOP", "HS", "SFORB", "IORE"). If a shorthand name is given, a +parent only degradation model is generated for the variable with the +highest value in observed.

    observed

    A dataframe with the observed data. The first column called +"name" must contain the name of the observed variable for each data point. +The second column must contain the times of observation, named "time". +The third column must be named "value" and contain the observed values. +Zero values in the "value" column will be removed, with a warning, in +order to avoid problems with fitting the two-component error model. This +is not expected to be a problem, because in general, values of zero are +not observed in degradation data, because there is a lower limit of +detection.

    parms.ini

    A named vector of initial values for the parameters, +including parameters to be optimised and potentially also fixed parameters +as indicated by fixed_parms. If set to "auto", initial values for +rate constants are set to default values. Using parameter names that are +not in the model gives an error.

    +

    It is possible to only specify a subset of the parameters that the model +needs. You can use the parameter lists "bparms.ode" from a previously +fitted model, which contains the differential equation parameters from +this model. This works nicely if the models are nested. An example is +given below.

    state.ini

    A named vector of initial values for the state variables of +the model. In case the observed variables are represented by more than one +model variable, the names will differ from the names of the observed +variables (see map component of mkinmod). The default +is to set the initial value of the first model variable to the mean of the +time zero values for the variable with the maximum observed value, and all +others to 0. If this variable has no time zero observations, its initial +value is set to 100.

    err.ini

    A named vector of initial values for the error model +parameters to be optimised. If set to "auto", initial values are set to +default values. Otherwise, inital values for all error model parameters +must be given.

    fixed_parms

    The names of parameters that should not be optimised but +rather kept at the values specified in parms.ini. Alternatively, +a named numeric vector of parameters to be fixed, regardless of the values +in parms.ini.

    fixed_initials

    The names of model variables for which the initial +state at time 0 should be excluded from the optimisation. Defaults to all +state variables except for the first one.

    from_max_mean

    If this is set to TRUE, and the model has only one +observed variable, then data before the time of the maximum observed value +(after averaging for each sampling time) are discarded, and this time is +subtracted from all remaining time values, so the time of the maximum +observed mean value is the new time zero.

    solution_type

    If set to "eigen", the solution of the system of +differential equations is based on the spectral decomposition of the +coefficient matrix in cases that this is possible. If set to "deSolve", a +numerical ode solver from package deSolve is used. If +set to "analytical", an analytical solution of the model is used. This is +only implemented for relatively simple degradation models. The default is +"auto", which uses "analytical" if possible, otherwise "deSolve" if a +compiler is present, and "eigen" if no compiler is present and the model +can be expressed using eigenvalues and eigenvectors.

    method.ode

    The solution method passed via mkinpredict() +to deSolve::ode() in case the solution type is "deSolve". The default +"lsoda" is performant, but sometimes fails to converge.

    use_compiled

    If set to FALSE, no compiled version of the +mkinmod model is used in the calls to mkinpredict() even if a compiled +version is present.

    control

    A list of control arguments passed to stats::nlminb().

    transform_rates

    Boolean specifying if kinetic rate constants should +be transformed in the model specification used in the fitting for better +compliance with the assumption of normal distribution of the estimator. If +TRUE, also alpha and beta parameters of the FOMC model are +log-transformed, as well as k1 and k2 rate constants for the DFOP and HS +models and the break point tb of the HS model. If FALSE, zero is used as +a lower bound for the rates in the optimisation.

    transform_fractions

    Boolean specifying if formation fractions +constants should be transformed in the model specification used in the +fitting for better compliance with the assumption of normal distribution +of the estimator. The default (TRUE) is to do transformations. If TRUE, +the g parameter of the DFOP and HS models are also transformed, as they +can also be seen as compositional data. The transformation used for these +transformations is the ilr() transformation.

    quiet

    Suppress printing out the current value of the negative +log-likelihood after each improvement?

    atol

    Absolute error tolerance, passed to deSolve::ode(). Default +is 1e-8, which is lower than the default in the deSolve::lsoda() +function which is used per default.

    rtol

    Absolute error tolerance, passed to deSolve::ode(). Default +is 1e-10, much lower than in deSolve::lsoda().

    error_model

    If the error model is "const", a constant standard +deviation is assumed.

    +

    If the error model is "obs", each observed variable is assumed to have its +own variance.

    +

    If the error model is "tc" (two-component error model), a two component +error model similar to the one described by Rocke and Lorenzato (1995) is +used for setting up the likelihood function. Note that this model +deviates from the model by Rocke and Lorenzato, as their model implies +that the errors follow a lognormal distribution for large values, not a +normal distribution as assumed by this method.

    error_model_algorithm

    If "auto", the selected algorithm depends on +the error model. If the error model is "const", unweighted nonlinear +least squares fitting ("OLS") is selected. If the error model is "obs", or +"tc", the "d_3" algorithm is selected.

    +

    The algorithm "d_3" will directly minimize the negative log-likelihood +and independently also use the three step algorithm described below. +The fit with the higher likelihood is returned.

    +

    The algorithm "direct" will directly minimize the negative log-likelihood.

    +

    The algorithm "twostep" will minimize the negative log-likelihood after an +initial unweighted least squares optimisation step.

    +

    The algorithm "threestep" starts with unweighted least squares, then +optimizes only the error model using the degradation model parameters +found, and then minimizes the negative log-likelihood with free +degradation and error model parameters.

    +

    The algorithm "fourstep" starts with unweighted least squares, then +optimizes only the error model using the degradation model parameters +found, then optimizes the degradation model again with fixed error model +parameters, and finally minimizes the negative log-likelihood with free +degradation and error model parameters.

    +

    The algorithm "IRLS" (Iteratively Reweighted Least Squares) starts with +unweighted least squares, and then iterates optimization of the error +model parameters and subsequent optimization of the degradation model +using those error model parameters, until the error model parameters +converge.

    reweight.tol

    Tolerance for the convergence criterion calculated from +the error model parameters in IRLS fits.

    reweight.max.iter

    Maximum number of iterations in IRLS fits.

    trace_parms

    Should a trace of the parameter values be listed?

    ...

    Further arguments that will be passed on to +deSolve::ode().

    + +

    Value

    + +

    A list with "mkinfit" in the class attribute.

    +

    Details

    + +

    Per default, parameters in the kinetic models are internally transformed in +order to better satisfy the assumption of a normal distribution of their +estimators.

    +

    Note

    + +

    When using the "IORE" submodel for metabolites, fitting with +"transform_rates = TRUE" (the default) often leads to failures of the +numerical ODE solver. In this situation it may help to switch off the +internal rate transformation.

    +

    References

    + +

    Rocke DM and Lorenzato S (1995) A two-component model +for measurement error in analytical chemistry. Technometrics 37(2), 176-184.

    +

    Ranke J and Meinecke S (2019) Error Models for the Kinetic Evaluation of Chemical +Degradation Data. Environments 6(12) 124 +doi:10.3390/environments6120124.

    +

    See also

    + +

    summary.mkinfit, plot.mkinfit, parms and lrtest.

    +

    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.

    + +

    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.50.3 +#> R version used for fitting: 4.0.0 +#> Date of fit: Wed May 27 05:54:13 2020 +#> Date of summary: Wed May 27 05:54:13 2020 +#> +#> Equations: +#> d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent +#> +#> Model predictions using solution type analytical +#> +#> Fitted using 222 model solutions performed in 0.043 s +#> +#> Error model: Constant variance +#> +#> Error model algorithm: OLS +#> +#> Starting values for parameters to be optimised: +#> value type +#> parent_0 85.1 state +#> alpha 1.0 deparm +#> beta 10.0 deparm +#> +#> Starting values for the transformed parameters actually optimised: +#> value lower upper +#> parent_0 85.100000 -Inf Inf +#> log_alpha 0.000000 -Inf Inf +#> log_beta 2.302585 -Inf Inf +#> +#> Fixed parameter values: +#> None +#> +#> Results: +#> +#> AIC BIC logLik +#> 44.68652 45.47542 -18.34326 +#> +#> Optimised, transformed parameters with symmetric confidence intervals: +#> Estimate Std. Error Lower Upper +#> parent_0 85.87000 1.8070 81.23000 90.5200 +#> log_alpha 0.05192 0.1353 -0.29580 0.3996 +#> log_beta 0.65100 0.2287 0.06315 1.2390 +#> sigma 1.85700 0.4378 0.73200 2.9830 +#> +#> Parameter correlation: +#> parent_0 log_alpha log_beta sigma +#> parent_0 1.000e+00 -1.565e-01 -3.142e-01 4.770e-08 +#> log_alpha -1.565e-01 1.000e+00 9.564e-01 9.974e-08 +#> log_beta -3.142e-01 9.564e-01 1.000e+00 8.468e-08 +#> sigma 4.770e-08 9.974e-08 8.468e-08 1.000e+00 +#> +#> Backtransformed parameters: +#> Confidence intervals for internally transformed parameters are asymmetric. +#> t-test (unrealistically) based on the assumption of normal distribution +#> for estimators of untransformed parameters. +#> Estimate t value Pr(>t) Lower Upper +#> parent_0 85.870 47.530 3.893e-08 81.2300 90.520 +#> alpha 1.053 7.393 3.562e-04 0.7439 1.491 +#> beta 1.917 4.373 3.601e-03 1.0650 3.451 +#> sigma 1.857 4.243 4.074e-03 0.7320 2.983 +#> +#> FOCUS Chi2 error levels in percent: +#> err.min n.optim df +#> All data 6.657 3 6 +#> parent 6.657 3 6 +#> +#> Estimated disappearance times: +#> DT50 DT90 DT50back +#> parent 1.785 15.15 4.56 +#> +#> Data: +#> time variable observed predicted residual +#> 0 parent 85.1 85.875 -0.7749 +#> 1 parent 57.9 55.191 2.7091 +#> 3 parent 29.9 31.845 -1.9452 +#> 7 parent 14.6 17.012 -2.4124 +#> 14 parent 9.7 9.241 0.4590 +#> 28 parent 6.6 4.754 1.8460 +#> 63 parent 4.0 2.102 1.8977 +#> 91 parent 3.9 1.441 2.4590 +#> 119 parent 0.6 1.092 -0.4919
    +# One parent compound, one metabolite, both single first order. +# Use mkinsub for convenience in model formulation. Pathway to sink included per default. +SFO_SFO <- mkinmod( + parent = mkinsub("SFO", "m1"), + m1 = mkinsub("SFO"))
    #> Successfully compiled differential equation model from auto-generated C code.
    # Fit the model to the FOCUS example dataset D using defaults +print(system.time(fit <- mkinfit(SFO_SFO, FOCUS_2006_D, + solution_type = "eigen", quiet = TRUE)))
    #> Warning: Observations with value of zero were removed from the data
    #> user system elapsed +#> 0.414 0.000 0.418
    parms(fit)
    #> parent_0 k_parent k_m1 f_parent_to_m1 sigma +#> 99.598481046 0.098697740 0.005260651 0.514475962 3.125503875
    #> $ff +#> parent_m1 parent_sink +#> 0.514476 0.485524 +#> +#> $distimes +#> DT50 DT90 +#> parent 7.022929 23.32966 +#> m1 131.760724 437.69965 +#>
    # \dontrun{ +# deSolve is slower when no C compiler (gcc) was available during model generation +print(system.time(fit.deSolve <- mkinfit(SFO_SFO, FOCUS_2006_D, + solution_type = "deSolve")))
    #> Warning: Observations with value of zero were removed from the data
    #> Ordinary least squares optimisation
    #> Sum of squared residuals at call 1: 15156.12 +#> Sum of squared residuals at call 2: 15156.12 +#> Sum of squared residuals at call 6: 8243.645 +#> Sum of squared residuals at call 12: 6290.712 +#> Sum of squared residuals at call 13: 6290.683 +#> Sum of squared residuals at call 15: 6290.452 +#> Sum of squared residuals at call 18: 1700.749 +#> Sum of squared residuals at call 20: 1700.611 +#> Sum of squared residuals at call 24: 1190.923 +#> Sum of squared residuals at call 26: 1190.922 +#> Sum of squared residuals at call 29: 1017.417 +#> Sum of squared residuals at call 31: 1017.417 +#> Sum of squared residuals at call 33: 1017.416 +#> Sum of squared residuals at call 34: 644.0472 +#> Sum of squared residuals at call 36: 644.047 +#> Sum of squared residuals at call 38: 644.047 +#> Sum of squared residuals at call 39: 590.5025 +#> Sum of squared residuals at call 41: 590.5022 +#> Sum of squared residuals at call 43: 590.5016 +#> Sum of squared residuals at call 44: 543.2196 +#> Sum of squared residuals at call 45: 543.2193 +#> Sum of squared residuals at call 46: 543.2192 +#> Sum of squared residuals at call 50: 391.348 +#> Sum of squared residuals at call 51: 391.3479 +#> Sum of squared residuals at call 56: 386.479 +#> Sum of squared residuals at call 58: 386.479 +#> Sum of squared residuals at call 60: 386.4779 +#> Sum of squared residuals at call 61: 384.0686 +#> Sum of squared residuals at call 63: 384.0686 +#> Sum of squared residuals at call 66: 382.7813 +#> Sum of squared residuals at call 68: 382.7813 +#> Sum of squared residuals at call 70: 382.7813 +#> Sum of squared residuals at call 71: 378.9273 +#> Sum of squared residuals at call 73: 378.9273 +#> Sum of squared residuals at call 75: 378.9272 +#> Sum of squared residuals at call 76: 377.4847 +#> Sum of squared residuals at call 78: 377.4846 +#> Sum of squared residuals at call 81: 375.9738 +#> Sum of squared residuals at call 83: 375.9738 +#> Sum of squared residuals at call 86: 375.3387 +#> Sum of squared residuals at call 88: 375.3387 +#> Sum of squared residuals at call 91: 374.5774 +#> Sum of squared residuals at call 93: 374.5774 +#> Sum of squared residuals at call 95: 374.5774 +#> Sum of squared residuals at call 96: 373.5438 +#> Sum of squared residuals at call 100: 373.5438 +#> Sum of squared residuals at call 102: 373.265 +#> Sum of squared residuals at call 104: 373.265 +#> Sum of squared residuals at call 107: 372.6825 +#> Sum of squared residuals at call 111: 372.6825 +#> Sum of squared residuals at call 114: 372.6356 +#> Sum of squared residuals at call 116: 372.6356 +#> Sum of squared residuals at call 119: 372.6199 +#> Sum of squared residuals at call 121: 372.6199 +#> Sum of squared residuals at call 123: 372.6199 +#> Sum of squared residuals at call 124: 372.5881 +#> Sum of squared residuals at call 126: 372.5881 +#> Sum of squared residuals at call 129: 372.5418 +#> Sum of squared residuals at call 130: 372.4866 +#> Sum of squared residuals at call 131: 372.2242 +#> Sum of squared residuals at call 132: 371.5237 +#> Sum of squared residuals at call 134: 371.5237 +#> Sum of squared residuals at call 137: 371.292 +#> Sum of squared residuals at call 139: 371.292 +#> Sum of squared residuals at call 143: 371.2256 +#> Sum of squared residuals at call 144: 371.2256 +#> Sum of squared residuals at call 146: 371.2256 +#> Sum of squared residuals at call 149: 371.2194 +#> Sum of squared residuals at call 150: 371.2147 +#> Sum of squared residuals at call 153: 371.2147 +#> Sum of squared residuals at call 155: 371.2137 +#> Sum of squared residuals at call 156: 371.2137 +#> Sum of squared residuals at call 157: 371.2137 +#> Sum of squared residuals at call 160: 371.2134 +#> Sum of squared residuals at call 164: 371.2134 +#> Sum of squared residuals at call 165: 371.2134 +#> Sum of squared residuals at call 167: 371.2134 +#> Negative log-likelihood at call 177: 97.22429
    #> Optimisation successfully terminated.
    #> user system elapsed +#> 0.371 0.001 0.370
    parms(fit.deSolve)
    #> parent_0 k_parent k_m1 f_parent_to_m1 sigma +#> 99.598480300 0.098697739 0.005260651 0.514475968 3.125503874
    endpoints(fit.deSolve)
    #> $ff +#> parent_m1 parent_sink +#> 0.514476 0.485524 +#> +#> $distimes +#> DT50 DT90 +#> parent 7.022929 23.32966 +#> m1 131.760721 437.69964 +#>
    # } + +# Use stepwise fitting, using optimised parameters from parent only fit, FOMC +# \dontrun{ +FOMC_SFO <- mkinmod( + parent = mkinsub("FOMC", "m1"), + m1 = mkinsub("SFO"))
    #> Successfully compiled differential equation model from auto-generated C code.
    # Fit the model to the FOCUS example dataset D using defaults +fit.FOMC_SFO <- mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    # Use starting parameters from parent only FOMC fit +fit.FOMC = mkinfit("FOMC", FOCUS_2006_D, quiet = TRUE) +fit.FOMC_SFO <- mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE, + parms.ini = fit.FOMC$bparms.ode)
    #> Warning: Observations with value of zero were removed from the data
    +# Use stepwise fitting, using optimised parameters from parent only fit, SFORB +SFORB_SFO <- mkinmod( + parent = list(type = "SFORB", to = "m1", sink = TRUE), + m1 = list(type = "SFO"))
    #> Successfully compiled differential equation model from auto-generated C code.
    # Fit the model to the FOCUS example dataset D using defaults +fit.SFORB_SFO <- mkinfit(SFORB_SFO, FOCUS_2006_D, quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    fit.SFORB_SFO.deSolve <- mkinfit(SFORB_SFO, FOCUS_2006_D, solution_type = "deSolve", + quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    # Use starting parameters from parent only SFORB fit (not really needed in this case) +fit.SFORB = mkinfit("SFORB", FOCUS_2006_D, quiet = TRUE) +fit.SFORB_SFO <- mkinfit(SFORB_SFO, FOCUS_2006_D, parms.ini = fit.SFORB$bparms.ode, quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    #> Warning: Initial parameter(s) k_parent_free_sink not used in the model
    # } + +# \dontrun{ +# Weighted fits, including IRLS (error_model = "obs") +SFO_SFO.ff <- mkinmod(parent = mkinsub("SFO", "m1"), + m1 = mkinsub("SFO"), use_of_ff = "max")
    #> Successfully compiled differential equation model from auto-generated C code.
    f.noweight <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    summary(f.noweight)
    #> mkin version used for fitting: 0.9.50.3 +#> R version used for fitting: 4.0.0 +#> Date of fit: Wed May 27 05:54:19 2020 +#> Date of summary: Wed May 27 05:54:19 2020 +#> +#> Equations: +#> d_parent/dt = - k_parent * parent +#> d_m1/dt = + f_parent_to_m1 * k_parent * parent - k_m1 * m1 +#> +#> Model predictions using solution type analytical +#> +#> Fitted using 421 model solutions performed in 0.126 s +#> +#> Error model: Constant variance +#> +#> Error model algorithm: OLS +#> +#> Starting values for parameters to be optimised: +#> value type +#> parent_0 100.7500 state +#> k_parent 0.1000 deparm +#> k_m1 0.1001 deparm +#> f_parent_to_m1 0.5000 deparm +#> +#> Starting values for the transformed parameters actually optimised: +#> value lower upper +#> parent_0 100.750000 -Inf Inf +#> log_k_parent -2.302585 -Inf Inf +#> log_k_m1 -2.301586 -Inf Inf +#> f_parent_ilr_1 0.000000 -Inf Inf +#> +#> Fixed parameter values: +#> value type +#> m1_0 0 state +#> +#> Results: +#> +#> AIC BIC logLik +#> 204.4486 212.6365 -97.22429 +#> +#> Optimised, transformed parameters with symmetric confidence intervals: +#> Estimate Std. Error Lower Upper +#> parent_0 99.60000 1.57000 96.40000 102.8000 +#> log_k_parent -2.31600 0.04087 -2.39900 -2.2330 +#> log_k_m1 -5.24800 0.13320 -5.51800 -4.9770 +#> f_parent_ilr_1 0.04096 0.06312 -0.08746 0.1694 +#> sigma 3.12600 0.35850 2.39600 3.8550 +#> +#> Parameter correlation: +#> parent_0 log_k_parent log_k_m1 f_parent_ilr_1 sigma +#> parent_0 1.000e+00 5.174e-01 -1.688e-01 -5.471e-01 -3.190e-07 +#> log_k_parent 5.174e-01 1.000e+00 -3.263e-01 -5.426e-01 3.168e-07 +#> log_k_m1 -1.688e-01 -3.263e-01 1.000e+00 7.478e-01 -1.406e-07 +#> f_parent_ilr_1 -5.471e-01 -5.426e-01 7.478e-01 1.000e+00 -1.587e-10 +#> sigma -3.190e-07 3.168e-07 -1.406e-07 -1.587e-10 1.000e+00 +#> +#> Backtransformed parameters: +#> Confidence intervals for internally transformed parameters are asymmetric. +#> t-test (unrealistically) based on the assumption of normal distribution +#> for estimators of untransformed parameters. +#> Estimate t value Pr(>t) Lower Upper +#> parent_0 99.600000 63.430 2.298e-36 96.400000 1.028e+02 +#> k_parent 0.098700 24.470 4.955e-23 0.090820 1.073e-01 +#> k_m1 0.005261 7.510 6.165e-09 0.004012 6.898e-03 +#> f_parent_to_m1 0.514500 23.070 3.104e-22 0.469100 5.596e-01 +#> sigma 3.126000 8.718 2.235e-10 2.396000 3.855e+00 +#> +#> FOCUS Chi2 error levels in percent: +#> err.min n.optim df +#> All data 6.398 4 15 +#> parent 6.459 2 7 +#> m1 4.690 2 8 +#> +#> Resulting formation fractions: +#> ff +#> parent_m1 0.5145 +#> parent_sink 0.4855 +#> +#> Estimated disappearance times: +#> DT50 DT90 +#> parent 7.023 23.33 +#> m1 131.761 437.70 +#> +#> Data: +#> time variable observed predicted residual +#> 0 parent 99.46 99.59848 -1.385e-01 +#> 0 parent 102.04 99.59848 2.442e+00 +#> 1 parent 93.50 90.23787 3.262e+00 +#> 1 parent 92.50 90.23787 2.262e+00 +#> 3 parent 63.23 74.07319 -1.084e+01 +#> 3 parent 68.99 74.07319 -5.083e+00 +#> 7 parent 52.32 49.91206 2.408e+00 +#> 7 parent 55.13 49.91206 5.218e+00 +#> 14 parent 27.27 25.01257 2.257e+00 +#> 14 parent 26.64 25.01257 1.627e+00 +#> 21 parent 11.50 12.53462 -1.035e+00 +#> 21 parent 11.64 12.53462 -8.946e-01 +#> 35 parent 2.85 3.14787 -2.979e-01 +#> 35 parent 2.91 3.14787 -2.379e-01 +#> 50 parent 0.69 0.71624 -2.624e-02 +#> 50 parent 0.63 0.71624 -8.624e-02 +#> 75 parent 0.05 0.06074 -1.074e-02 +#> 75 parent 0.06 0.06074 -7.381e-04 +#> 1 m1 4.84 4.80296 3.704e-02 +#> 1 m1 5.64 4.80296 8.370e-01 +#> 3 m1 12.91 13.02400 -1.140e-01 +#> 3 m1 12.96 13.02400 -6.400e-02 +#> 7 m1 22.97 25.04476 -2.075e+00 +#> 7 m1 24.47 25.04476 -5.748e-01 +#> 14 m1 41.69 36.69002 5.000e+00 +#> 14 m1 33.21 36.69002 -3.480e+00 +#> 21 m1 44.37 41.65310 2.717e+00 +#> 21 m1 46.44 41.65310 4.787e+00 +#> 35 m1 41.22 43.31312 -2.093e+00 +#> 35 m1 37.95 43.31312 -5.363e+00 +#> 50 m1 41.19 41.21831 -2.831e-02 +#> 50 m1 40.01 41.21831 -1.208e+00 +#> 75 m1 40.09 36.44703 3.643e+00 +#> 75 m1 33.85 36.44703 -2.597e+00 +#> 100 m1 31.04 31.98163 -9.416e-01 +#> 100 m1 33.13 31.98163 1.148e+00 +#> 120 m1 25.15 28.78984 -3.640e+00 +#> 120 m1 33.31 28.78984 4.520e+00
    f.obs <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, error_model = "obs", quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    summary(f.obs)
    #> mkin version used for fitting: 0.9.50.3 +#> R version used for fitting: 4.0.0 +#> Date of fit: Wed May 27 05:54:19 2020 +#> Date of summary: Wed May 27 05:54:19 2020 +#> +#> Equations: +#> d_parent/dt = - k_parent * parent +#> d_m1/dt = + f_parent_to_m1 * k_parent * parent - k_m1 * m1 +#> +#> Model predictions using solution type analytical +#> +#> Fitted using 978 model solutions performed in 0.33 s +#> +#> Error model: Variance unique to each observed variable +#> +#> Error model algorithm: d_3 +#> Direct fitting and three-step fitting yield approximately the same likelihood +#> +#> Starting values for parameters to be optimised: +#> value type +#> parent_0 100.7500 state +#> k_parent 0.1000 deparm +#> k_m1 0.1001 deparm +#> f_parent_to_m1 0.5000 deparm +#> sigma_parent 3.0000 error +#> sigma_m1 3.0000 error +#> +#> Starting values for the transformed parameters actually optimised: +#> value lower upper +#> parent_0 100.750000 -Inf Inf +#> log_k_parent -2.302585 -Inf Inf +#> log_k_m1 -2.301586 -Inf Inf +#> f_parent_ilr_1 0.000000 -Inf Inf +#> sigma_parent 3.000000 0 Inf +#> sigma_m1 3.000000 0 Inf +#> +#> Fixed parameter values: +#> value type +#> m1_0 0 state +#> +#> Results: +#> +#> AIC BIC logLik +#> 205.8727 215.6982 -96.93634 +#> +#> Optimised, transformed parameters with symmetric confidence intervals: +#> Estimate Std. Error Lower Upper +#> parent_0 99.65000 1.70200 96.19000 103.1000 +#> log_k_parent -2.31300 0.04376 -2.40200 -2.2240 +#> log_k_m1 -5.25000 0.12430 -5.50400 -4.9970 +#> f_parent_ilr_1 0.03861 0.06171 -0.08708 0.1643 +#> sigma_parent 3.40100 0.56820 2.24400 4.5590 +#> sigma_m1 2.85500 0.45240 1.93400 3.7770 +#> +#> Parameter correlation: +#> parent_0 log_k_parent log_k_m1 f_parent_ilr_1 sigma_parent +#> parent_0 1.00000 0.51078 -0.19133 -0.59997 0.035670 +#> log_k_parent 0.51078 1.00000 -0.37458 -0.59239 0.069833 +#> log_k_m1 -0.19133 -0.37458 1.00000 0.74398 -0.026158 +#> f_parent_ilr_1 -0.59997 -0.59239 0.74398 1.00000 -0.041369 +#> sigma_parent 0.03567 0.06983 -0.02616 -0.04137 1.000000 +#> sigma_m1 -0.03385 -0.06627 0.02482 0.03926 -0.004628 +#> sigma_m1 +#> parent_0 -0.033847 +#> log_k_parent -0.066265 +#> log_k_m1 0.024823 +#> f_parent_ilr_1 0.039256 +#> sigma_parent -0.004628 +#> sigma_m1 1.000000 +#> +#> Backtransformed parameters: +#> Confidence intervals for internally transformed parameters are asymmetric. +#> t-test (unrealistically) based on the assumption of normal distribution +#> for estimators of untransformed parameters. +#> Estimate t value Pr(>t) Lower Upper +#> parent_0 99.650000 58.560 2.004e-34 96.190000 1.031e+02 +#> k_parent 0.098970 22.850 1.099e-21 0.090530 1.082e-01 +#> k_m1 0.005245 8.046 1.732e-09 0.004072 6.756e-03 +#> f_parent_to_m1 0.513600 23.560 4.352e-22 0.469300 5.578e-01 +#> sigma_parent 3.401000 5.985 5.662e-07 2.244000 4.559e+00 +#> sigma_m1 2.855000 6.311 2.215e-07 1.934000 3.777e+00 +#> +#> FOCUS Chi2 error levels in percent: +#> err.min n.optim df +#> All data 6.398 4 15 +#> parent 6.464 2 7 +#> m1 4.682 2 8 +#> +#> Resulting formation fractions: +#> ff +#> parent_m1 0.5136 +#> parent_sink 0.4864 +#> +#> Estimated disappearance times: +#> DT50 DT90 +#> parent 7.003 23.26 +#> m1 132.154 439.01 +#> +#> Data: +#> time variable observed predicted residual +#> 0 parent 99.46 99.65417 -1.942e-01 +#> 0 parent 102.04 99.65417 2.386e+00 +#> 1 parent 93.50 90.26332 3.237e+00 +#> 1 parent 92.50 90.26332 2.237e+00 +#> 3 parent 63.23 74.05306 -1.082e+01 +#> 3 parent 68.99 74.05306 -5.063e+00 +#> 7 parent 52.32 49.84325 2.477e+00 +#> 7 parent 55.13 49.84325 5.287e+00 +#> 14 parent 27.27 24.92971 2.340e+00 +#> 14 parent 26.64 24.92971 1.710e+00 +#> 21 parent 11.50 12.46890 -9.689e-01 +#> 21 parent 11.64 12.46890 -8.289e-01 +#> 35 parent 2.85 3.11925 -2.692e-01 +#> 35 parent 2.91 3.11925 -2.092e-01 +#> 50 parent 0.69 0.70679 -1.679e-02 +#> 50 parent 0.63 0.70679 -7.679e-02 +#> 75 parent 0.05 0.05952 -9.523e-03 +#> 75 parent 0.06 0.05952 4.772e-04 +#> 1 m1 4.84 4.81075 2.925e-02 +#> 1 m1 5.64 4.81075 8.292e-01 +#> 3 m1 12.91 13.04196 -1.320e-01 +#> 3 m1 12.96 13.04196 -8.196e-02 +#> 7 m1 22.97 25.06847 -2.098e+00 +#> 7 m1 24.47 25.06847 -5.985e-01 +#> 14 m1 41.69 36.70308 4.987e+00 +#> 14 m1 33.21 36.70308 -3.493e+00 +#> 21 m1 44.37 41.65115 2.719e+00 +#> 21 m1 46.44 41.65115 4.789e+00 +#> 35 m1 41.22 43.29465 -2.075e+00 +#> 35 m1 37.95 43.29465 -5.345e+00 +#> 50 m1 41.19 41.19948 -9.479e-03 +#> 50 m1 40.01 41.19948 -1.189e+00 +#> 75 m1 40.09 36.44035 3.650e+00 +#> 75 m1 33.85 36.44035 -2.590e+00 +#> 100 m1 31.04 31.98773 -9.477e-01 +#> 100 m1 33.13 31.98773 1.142e+00 +#> 120 m1 25.15 28.80429 -3.654e+00 +#> 120 m1 33.31 28.80429 4.506e+00
    f.tc <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, error_model = "tc", quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    summary(f.tc)
    #> mkin version used for fitting: 0.9.50.3 +#> R version used for fitting: 4.0.0 +#> Date of fit: Wed May 27 05:54:20 2020 +#> Date of summary: Wed May 27 05:54:20 2020 +#> +#> Equations: +#> d_parent/dt = - k_parent * parent +#> d_m1/dt = + f_parent_to_m1 * k_parent * parent - k_m1 * m1 +#> +#> Model predictions using solution type analytical +#> +#> Fitted using 2088 model solutions performed in 0.714 s +#> +#> Error model: Two-component variance function +#> +#> Error model algorithm: d_3 +#> Direct fitting and three-step fitting yield approximately the same likelihood +#> +#> Starting values for parameters to be optimised: +#> value type +#> parent_0 100.7500 state +#> k_parent 0.1000 deparm +#> k_m1 0.1001 deparm +#> f_parent_to_m1 0.5000 deparm +#> sigma_low 0.1000 error +#> rsd_high 0.1000 error +#> +#> Starting values for the transformed parameters actually optimised: +#> value lower upper +#> parent_0 100.750000 -Inf Inf +#> log_k_parent -2.302585 -Inf Inf +#> log_k_m1 -2.301586 -Inf Inf +#> f_parent_ilr_1 0.000000 -Inf Inf +#> sigma_low 0.100000 0 Inf +#> rsd_high 0.100000 0 Inf +#> +#> Fixed parameter values: +#> value type +#> m1_0 0 state +#> +#> Results: +#> +#> AIC BIC logLik +#> 141.9656 151.7911 -64.98278 +#> +#> Optimised, transformed parameters with symmetric confidence intervals: +#> Estimate Std. Error Lower Upper +#> parent_0 100.70000 2.621000 95.400000 106.10000 +#> log_k_parent -2.29700 0.008862 -2.315000 -2.27900 +#> log_k_m1 -5.26600 0.091310 -5.452000 -5.08000 +#> f_parent_ilr_1 0.02374 0.055300 -0.088900 0.13640 +#> sigma_low 0.00305 0.004829 -0.006786 0.01289 +#> rsd_high 0.07928 0.009418 0.060100 0.09847 +#> +#> Parameter correlation: +#> parent_0 log_k_parent log_k_m1 f_parent_ilr_1 sigma_low rsd_high +#> parent_0 1.00000 0.67644 -0.10215 -0.76822 0.14294 -0.08783 +#> log_k_parent 0.67644 1.00000 -0.15102 -0.59491 0.34611 -0.08125 +#> log_k_m1 -0.10215 -0.15102 1.00000 0.51808 -0.05236 0.01240 +#> f_parent_ilr_1 -0.76822 -0.59491 0.51808 1.00000 -0.13900 0.03248 +#> sigma_low 0.14294 0.34611 -0.05236 -0.13900 1.00000 -0.16546 +#> rsd_high -0.08783 -0.08125 0.01240 0.03248 -0.16546 1.00000 +#> +#> Backtransformed parameters: +#> Confidence intervals for internally transformed parameters are asymmetric. +#> t-test (unrealistically) based on the assumption of normal distribution +#> for estimators of untransformed parameters. +#> Estimate t value Pr(>t) Lower Upper +#> parent_0 1.007e+02 38.4300 1.180e-28 95.400000 1.061e+02 +#> k_parent 1.006e-01 112.8000 1.718e-43 0.098760 1.024e-01 +#> k_m1 5.167e-03 10.9500 1.171e-12 0.004290 6.223e-03 +#> f_parent_to_m1 5.084e-01 26.0100 2.146e-23 0.468600 5.481e-01 +#> sigma_low 3.050e-03 0.6314 2.661e-01 -0.006786 1.289e-02 +#> rsd_high 7.928e-02 8.4170 6.418e-10 0.060100 9.847e-02 +#> +#> FOCUS Chi2 error levels in percent: +#> err.min n.optim df +#> All data 6.475 4 15 +#> parent 6.573 2 7 +#> m1 4.671 2 8 +#> +#> Resulting formation fractions: +#> ff +#> parent_m1 0.5084 +#> parent_sink 0.4916 +#> +#> Estimated disappearance times: +#> DT50 DT90 +#> parent 6.893 22.9 +#> m1 134.156 445.7 +#> +#> Data: +#> time variable observed predicted residual +#> 0 parent 99.46 100.73434 -1.274340 +#> 0 parent 102.04 100.73434 1.305660 +#> 1 parent 93.50 91.09751 2.402486 +#> 1 parent 92.50 91.09751 1.402486 +#> 3 parent 63.23 74.50141 -11.271410 +#> 3 parent 68.99 74.50141 -5.511410 +#> 7 parent 52.32 49.82880 2.491200 +#> 7 parent 55.13 49.82880 5.301200 +#> 14 parent 27.27 24.64809 2.621908 +#> 14 parent 26.64 24.64809 1.991908 +#> 21 parent 11.50 12.19232 -0.692315 +#> 21 parent 11.64 12.19232 -0.552315 +#> 35 parent 2.85 2.98327 -0.133266 +#> 35 parent 2.91 2.98327 -0.073266 +#> 50 parent 0.69 0.66013 0.029874 +#> 50 parent 0.63 0.66013 -0.030126 +#> 75 parent 0.05 0.05344 -0.003438 +#> 75 parent 0.06 0.05344 0.006562 +#> 1 m1 4.84 4.88645 -0.046451 +#> 1 m1 5.64 4.88645 0.753549 +#> 3 m1 12.91 13.22867 -0.318669 +#> 3 m1 12.96 13.22867 -0.268669 +#> 7 m1 22.97 25.36417 -2.394166 +#> 7 m1 24.47 25.36417 -0.894166 +#> 14 m1 41.69 37.00974 4.680263 +#> 14 m1 33.21 37.00974 -3.799737 +#> 21 m1 44.37 41.90133 2.468669 +#> 21 m1 46.44 41.90133 4.538669 +#> 35 m1 41.22 43.45691 -2.236913 +#> 35 m1 37.95 43.45691 -5.506913 +#> 50 m1 41.19 41.34199 -0.151985 +#> 50 m1 40.01 41.34199 -1.331985 +#> 75 m1 40.09 36.61471 3.475295 +#> 75 m1 33.85 36.61471 -2.764705 +#> 100 m1 31.04 32.20082 -1.160823 +#> 100 m1 33.13 32.20082 0.929177 +#> 120 m1 25.15 29.04130 -3.891304 +#> 120 m1 33.31 29.04130 4.268696
    # } + + +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mkinmod.html b/docs/dev/reference/mkinmod.html new file mode 100644 index 00000000..80a72b2b --- /dev/null +++ b/docs/dev/reference/mkinmod.html @@ -0,0 +1,320 @@ + + + + + + + + +Function to set up a kinetic model with one or more state variables — mkinmod • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    The function usually takes several expressions, each assigning a compound +name to a list, specifying the kinetic model type and reaction or transfer +to other observed compartments. Instead of specifying several expressions, a +list of lists can be given in the speclist argument.

    +
    + +
    mkinmod(
    +  ...,
    +  use_of_ff = "max",
    +  speclist = NULL,
    +  quiet = FALSE,
    +  verbose = FALSE
    +)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + +
    ...

    For each observed variable, a list has to be specified as an +argument, containing at least a component type, specifying the type +of kinetics to use for the variable. Currently, single first order +kinetics "SFO", indeterminate order rate equation kinetics "IORE", or +single first order with reversible binding "SFORB" are implemented for all +variables, while "FOMC", "DFOP" and "HS" can additionally be chosen for +the first variable which is assumed to be the source compartment. +Additionally, each component of the list can include a character vector +to, specifying names of variables to which a transfer is to be +assumed in the model. If the argument use_of_ff is set to "min" +(default) and the model for the compartment is "SFO" or "SFORB", an +additional component of the list can be "sink=FALSE" effectively fixing +the flux to sink to zero.

    use_of_ff

    Specification of the use of formation fractions in the +model equations and, if applicable, the coefficient matrix. If "min", a +minimum use of formation fractions is made in order to avoid fitting the +product of formation fractions and rate constants. If "max", formation +fractions are always used.

    speclist

    The specification of the observed variables and their +submodel types and pathways can be given as a single list using this +argument. Default is NULL.

    quiet

    Should messages be suppressed?

    verbose

    If TRUE, passed to cfunction if +applicable to give detailed information about the C function being built.

    + +

    Value

    + +

    A list of class mkinmod for use with mkinfit, +containing, among others,

    +
    diffs

    A vector of string representations of differential equations, one for +each modelling variable.

    +
    map

    A list containing named character vectors for each observed variable, +specifying the modelling variables by which it is represented.

    +
    use_of_ff

    The content of use_of_ff is passed on in this list component.

    +
    deg_func

    If generated, a function containing the solution of the degradation +model.

    +
    coefmat

    The coefficient matrix, if the system of differential equations can be +represented by one.

    +
    cf

    If generated, a compiled function calculating the derivatives as +returned by cfunction.

    + +

    Details

    + +

    For the definition of model types and their parameters, the equations given +in the FOCUS and NAFTA guidance documents are used.

    +

    Note

    + +

    The IORE submodel is not well tested for metabolites. When using this +model for metabolites, you may want to read the second note in the help +page to mkinfit.

    +

    References

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence +and Degradation Kinetics from Environmental Fate Studies on Pesticides in +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

    +

    NAFTA Technical Working Group on Pesticides (not dated) Guidance for +Evaluating and Calculating Degradation Kinetics in Environmental Media

    + +

    Examples

    +
    +# Specify the SFO model (this is not needed any more, as we can now mkinfit("SFO", ...) +SFO <- mkinmod(parent = mkinsub("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.
    +# \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.
    +# 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 file1bc3f55ac46.c 2> file1bc3f55ac46.c.err.txt +#> Program source: +#> 1: #include <R.h> +#> 2: +#> 3: +#> 4: static double parms [3]; +#> 5: #define k_parent parms[0] +#> 6: #define f_parent_to_m1 parms[1] +#> 7: #define k_m1 parms[2] +#> 8: +#> 9: void initpar(void (* odeparms)(int *, double *)) { +#> 10: int N = 3; +#> 11: odeparms(&N, parms); +#> 12: } +#> 13: +#> 14: +#> 15: void func ( int * n, double * t, double * y, double * f, double * rpar, int * ipar ) { +#> 16: +#> 17: f[0] = - k_parent * y[0]; +#> 18: f[1] = + f_parent_to_m1 * k_parent * y[0] - k_m1 * y[1]; +#> 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")), + 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) +# }
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mkinparplot-1.png b/docs/dev/reference/mkinparplot-1.png new file mode 100644 index 00000000..31800c09 Binary files /dev/null and b/docs/dev/reference/mkinparplot-1.png differ diff --git a/docs/dev/reference/mkinparplot.html b/docs/dev/reference/mkinparplot.html new file mode 100644 index 00000000..790f5e7e --- /dev/null +++ b/docs/dev/reference/mkinparplot.html @@ -0,0 +1,203 @@ + + + + + + + + +Function to plot the confidence intervals obtained using mkinfit — mkinparplot • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function plots the confidence intervals for the parameters fitted using +mkinfit.

    +
    + +
    mkinparplot(object)
    + +

    Arguments

    + + + + + + +
    object

    A fit represented in an mkinfit object.

    + +

    Value

    + +

    Nothing is returned by this function, as it is called for its side +effect, namely to produce a plot.

    + +

    Examples

    +
    +# \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.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mkinplot.html b/docs/dev/reference/mkinplot.html new file mode 100644 index 00000000..b36bcfc2 --- /dev/null +++ b/docs/dev/reference/mkinplot.html @@ -0,0 +1,198 @@ + + + + + + + + +Plot the observed data and the fitted model of an mkinfit object — mkinplot • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Deprecated function. It now only calls the plot method +plot.mkinfit.

    +
    + +
    mkinplot(fit, ...)
    + +

    Arguments

    + + + + + + + + + + +
    fit

    an object of class mkinfit.

    ...

    further arguments passed to plot.mkinfit.

    + +

    Value

    + +

    The function is called for its side effect.

    + +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mkinpredict.html b/docs/dev/reference/mkinpredict.html new file mode 100644 index 00000000..6d83e56f --- /dev/null +++ b/docs/dev/reference/mkinpredict.html @@ -0,0 +1,447 @@ + + + + + + + + +Produce predictions from a kinetic model using specific parameters — mkinpredict • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function produces a time series for all the observed variables in a +kinetic model as specified by mkinmod, using a specific set of +kinetic parameters and initial values for the state variables.

    +
    + +
    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,
    +  ...
    +)
    +
    +# S3 method for mkinmod
    +mkinpredict(
    +  x,
    +  odeparms = c(k_parent_sink = 0.1),
    +  odeini = c(parent = 100),
    +  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,
    +  ...
    +)
    +
    +# S3 method for mkinfit
    +mkinpredict(
    +  x,
    +  odeparms = x$bparms.ode,
    +  odeini = x$bparms.state,
    +  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,
    +  ...
    +)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    x

    A kinetic model as produced by mkinmod, or a kinetic +fit as fitted by mkinfit. In the latter case, the fitted +parameters are used for the prediction.

    odeparms

    A numeric vector specifying the parameters used in the +kinetic model, which is generally defined as a set of ordinary +differential equations.

    odeini

    A numeric vector containing the initial values of the state +variables of the model. Note that the state variables can differ from the +observed variables, for example in the case of the SFORB model.

    outtimes

    A numeric vector specifying the time points for which model +predictions should be generated.

    solution_type

    The method that should be used for producing the +predictions. This should generally be "analytical" if there is only one +observed variable, and usually "deSolve" in the case of several observed +variables. The third possibility "eigen" is faster but not applicable to +some models e.g. using FOMC for the parent compound.

    use_compiled

    If set to FALSE, no compiled version of the +mkinmod model is used, even if is present.

    method.ode

    The solution method passed via mkinpredict +to ode in case the solution type is "deSolve". The default +"lsoda" is performant, but sometimes fails to converge.

    atol

    Absolute error tolerance, passed to ode. Default +is 1e-8, lower than in lsoda.

    rtol

    Absolute error tolerance, passed to ode. Default +is 1e-10, much lower than in lsoda.

    map_output

    Boolean to specify if the output should list values for +the observed variables (default) or for all state variables (if set to +FALSE). Setting this to FALSE has no effect for analytical solutions, +as these always return mapped output.

    ...

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

    + +

    Value

    + +

    A matrix with the numeric solution in wide format

    + +

    Examples

    +
    +SFO <- mkinmod(degradinol = mkinsub("SFO")) +# Compare solution types +mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), 0:20, + solution_type = "analytical")
    #> time degradinol +#> 0 0 100.0000000 +#> 1 1 74.0818221 +#> 2 2 54.8811636 +#> 3 3 40.6569660 +#> 4 4 30.1194212 +#> 5 5 22.3130160 +#> 6 6 16.5298888 +#> 7 7 12.2456428 +#> 8 8 9.0717953 +#> 9 9 6.7205513 +#> 10 10 4.9787068 +#> 11 11 3.6883167 +#> 12 12 2.7323722 +#> 13 13 2.0241911 +#> 14 14 1.4995577 +#> 15 15 1.1108997 +#> 16 16 0.8229747 +#> 17 17 0.6096747 +#> 18 18 0.4516581 +#> 19 19 0.3345965 +#> 20 20 0.2478752
    mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), 0:20, + solution_type = "deSolve")
    #> time degradinol +#> 0 0 100.0000000 +#> 1 1 74.0818221 +#> 2 2 54.8811636 +#> 3 3 40.6569660 +#> 4 4 30.1194212 +#> 5 5 22.3130160 +#> 6 6 16.5298888 +#> 7 7 12.2456428 +#> 8 8 9.0717953 +#> 9 9 6.7205513 +#> 10 10 4.9787068 +#> 11 11 3.6883167 +#> 12 12 2.7323722 +#> 13 13 2.0241911 +#> 14 14 1.4995577 +#> 15 15 1.1108996 +#> 16 16 0.8229747 +#> 17 17 0.6096747 +#> 18 18 0.4516581 +#> 19 19 0.3345965 +#> 20 20 0.2478752
    mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), 0:20, + solution_type = "deSolve", use_compiled = FALSE)
    #> time degradinol +#> 0 0 100.0000000 +#> 1 1 74.0818221 +#> 2 2 54.8811636 +#> 3 3 40.6569660 +#> 4 4 30.1194212 +#> 5 5 22.3130160 +#> 6 6 16.5298888 +#> 7 7 12.2456428 +#> 8 8 9.0717953 +#> 9 9 6.7205513 +#> 10 10 4.9787068 +#> 11 11 3.6883167 +#> 12 12 2.7323722 +#> 13 13 2.0241911 +#> 14 14 1.4995577 +#> 15 15 1.1108996 +#> 16 16 0.8229747 +#> 17 17 0.6096747 +#> 18 18 0.4516581 +#> 19 19 0.3345965 +#> 20 20 0.2478752
    mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), 0:20, + solution_type = "eigen")
    #> time degradinol +#> 0 0 100.0000000 +#> 1 1 74.0818221 +#> 2 2 54.8811636 +#> 3 3 40.6569660 +#> 4 4 30.1194212 +#> 5 5 22.3130160 +#> 6 6 16.5298888 +#> 7 7 12.2456428 +#> 8 8 9.0717953 +#> 9 9 6.7205513 +#> 10 10 4.9787068 +#> 11 11 3.6883167 +#> 12 12 2.7323722 +#> 13 13 2.0241911 +#> 14 14 1.4995577 +#> 15 15 1.1108997 +#> 16 16 0.8229747 +#> 17 17 0.6096747 +#> 18 18 0.4516581 +#> 19 19 0.3345965 +#> 20 20 0.2478752
    +# Compare integration methods to analytical solution +mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), 0:20, + solution_type = "analytical")[21,]
    #> time degradinol +#> 20.0000000 0.2478752
    mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), 0:20, + method = "lsoda")[21,]
    #> time degradinol +#> 20.0000000 0.2478752
    mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), 0:20, + method = "ode45")[21,]
    #> time degradinol +#> 20.0000000 0.2478752
    mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), 0:20, + method = "rk4")[21,]
    #> time degradinol +#> 20.0000000 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 = 0.3), c(degradinol = 100), + seq(0, 20, by = 0.1))[201,]
    #> time degradinol +#> 20.0000000 0.2478752
    mkinpredict(SFO, c(k_degradinol = 0.3), c(degradinol = 100), + seq(0, 20, by = 0.01))[2001,]
    #> time degradinol +#> 20.0000000 0.2478752
    +# Comparison of the performance of solution types +SFO_SFO = mkinmod(parent = list(type = "SFO", to = "m1"), + m1 = list(type = "SFO"), use_of_ff = "max")
    #> Successfully compiled differential equation model from auto-generated C code.
    if(require(rbenchmark)) { + benchmark(replications = 10, order = "relative", columns = c("test", "relative", "elapsed"), + eigen = mkinpredict(SFO_SFO, + c(k_parent = 0.15, f_parent_to_m1 = 0.5, k_m1 = 0.01), + c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), + solution_type = "eigen")[201,], + deSolve_compiled = mkinpredict(SFO_SFO, + c(k_parent = 0.15, f_parent_to_m1 = 0.5, k_m1 = 0.01), + c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), + solution_type = "deSolve")[201,], + deSolve = mkinpredict(SFO_SFO, + c(k_parent = 0.15, f_parent_to_m1 = 0.5, k_m1 = 0.01), + c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), + solution_type = "deSolve", use_compiled = FALSE)[201,], + analytical = mkinpredict(SFO_SFO, + c(k_parent = 0.15, f_parent_to_m1 = 0.5, k_m1 = 0.01), + c(parent = 100, m1 = 0), seq(0, 20, by = 0.1), + solution_type = "analytical", use_compiled = FALSE)[201,]) +}
    #> test relative elapsed +#> 2 deSolve_compiled 1.0 0.005 +#> 4 analytical 1.0 0.005 +#> 1 eigen 4.0 0.020 +#> 3 deSolve 45.6 0.228
    +# \dontrun{ + # Predict from a fitted model + f <- mkinfit(SFO_SFO, FOCUS_2006_C, quiet = TRUE) + f <- mkinfit(SFO_SFO, FOCUS_2006_C, quiet = TRUE, solution_type = "deSolve") + head(mkinpredict(f))
    #> time parent m1 +#> 0 0.0 82.49216 0.000000 +#> 0.1 0.1 80.00562 1.236198 +#> 0.2 0.2 77.59404 2.422818 +#> 0.3 0.3 75.25514 3.561476 +#> 0.4 0.4 72.98675 4.653740 +#> 0.5 0.5 70.78673 5.701130
    # } + +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mkinresplot-1.png b/docs/dev/reference/mkinresplot-1.png new file mode 100644 index 00000000..bb9657b4 Binary files /dev/null and b/docs/dev/reference/mkinresplot-1.png differ diff --git a/docs/dev/reference/mkinresplot.html b/docs/dev/reference/mkinresplot.html new file mode 100644 index 00000000..11e0914e --- /dev/null +++ b/docs/dev/reference/mkinresplot.html @@ -0,0 +1,275 @@ + + + + + + + + +Function to plot residuals stored in an mkin object — mkinresplot • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function plots the residuals for the specified subset of the observed +variables from an mkinfit object. A combined plot of the fitted model and +the residuals can be obtained using plot.mkinfit using the +argument show_residuals = TRUE.

    +
    + +
    mkinresplot(
    +  object,
    +  obs_vars = names(object$mkinmod$map),
    +  xlim = c(0, 1.1 * max(object$data$time)),
    +  standardized = FALSE,
    +  xlab = "Time",
    +  ylab = ifelse(standardized, "Standardized residual", "Residual"),
    +  maxabs = "auto",
    +  legend = TRUE,
    +  lpos = "topright",
    +  col_obs = "auto",
    +  pch_obs = "auto",
    +  frame = TRUE,
    +  ...
    +)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    object

    A fit represented in an mkinfit object.

    obs_vars

    A character vector of names of the observed variables for +which residuals should be plotted. Defaults to all observed variables in +the model

    xlim

    plot range in x direction.

    standardized

    Should the residuals be standardized by dividing by the +standard deviation given by the error model of the fit?

    xlab

    Label for the x axis.

    ylab

    Label for the y axis.

    maxabs

    Maximum absolute value of the residuals. This is used for the +scaling of the y axis and defaults to "auto".

    legend

    Should a legend be plotted?

    lpos

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

    col_obs

    Colors for the observed variables.

    pch_obs

    Symbols to be used for the observed variables.

    frame

    Should a frame be drawn around the plots?

    ...

    further arguments passed to plot.

    + +

    Value

    + +

    Nothing is returned by this function, as it is called for its side +effect, namely to produce a plot.

    +

    See also

    + +

    mkinplot, for a way to plot the data and the fitted +lines of the mkinfit object, and plot_res for a function +combining the plot of the fit and the residual plot.

    + +

    Examples

    +
    +model <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
    #> Successfully compiled differential equation model from auto-generated C code.
    fit <- mkinfit(model, FOCUS_2006_D, quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    mkinresplot(fit, "m1")
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mkinsub.html b/docs/dev/reference/mkinsub.html new file mode 100644 index 00000000..dc4faf0d --- /dev/null +++ b/docs/dev/reference/mkinsub.html @@ -0,0 +1,228 @@ + + + + + + + + +Function to set up a kinetic submodel for one state variable — mkinsub • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This is a convenience function to set up the lists used as arguments for +mkinmod.

    +
    + +
    mkinsub(submodel, to = NULL, sink = TRUE, full_name = NA)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + +
    submodel

    Character vector of length one to specify the submodel type. +See mkinmod for the list of allowed submodel names.

    to

    Vector of the names of the state variable to which a +transformation shall be included in the model.

    sink

    Should a pathway to sink be included in the model in addition to +the pathways to other state variables?

    full_name

    An optional name to be used e.g. for plotting fits +performed with the model. You can use non-ASCII characters here, but then +your R code will not be portable, i.e. may produce unintended plot +results on other operating systems or system configurations.

    + +

    Value

    + +

    A list for use with mkinmod.

    + +

    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.
    +# The same model using mkinsub +SFO_SFO.2 <- mkinmod( + parent = mkinsub("SFO", "m1"), + m1 = mkinsub("SFO"))
    #> Successfully compiled differential equation model from auto-generated C code.
    +# \dontrun{ + # Now supplying full names + SFO_SFO.2 <- mkinmod( + parent = mkinsub("SFO", "m1", full_name = "Test compound"), + m1 = mkinsub("SFO", full_name = "Metabolite M1"))
    #> Successfully compiled differential equation model from auto-generated C code.
    # } +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/mmkin-1.png b/docs/dev/reference/mmkin-1.png new file mode 100644 index 00000000..135d5446 Binary files /dev/null and b/docs/dev/reference/mmkin-1.png differ diff --git a/docs/dev/reference/mmkin-2.png b/docs/dev/reference/mmkin-2.png new file mode 100644 index 00000000..40109afc Binary files /dev/null and b/docs/dev/reference/mmkin-2.png differ diff --git a/docs/dev/reference/mmkin-3.png b/docs/dev/reference/mmkin-3.png new file mode 100644 index 00000000..e80448ab Binary files /dev/null and b/docs/dev/reference/mmkin-3.png differ diff --git a/docs/dev/reference/mmkin-4.png b/docs/dev/reference/mmkin-4.png new file mode 100644 index 00000000..02976ced Binary files /dev/null and b/docs/dev/reference/mmkin-4.png differ diff --git a/docs/dev/reference/mmkin-5.png b/docs/dev/reference/mmkin-5.png new file mode 100644 index 00000000..4c771bc9 Binary files /dev/null and b/docs/dev/reference/mmkin-5.png differ diff --git a/docs/dev/reference/mmkin.html b/docs/dev/reference/mmkin.html new file mode 100644 index 00000000..1b5c1592 --- /dev/null +++ b/docs/dev/reference/mmkin.html @@ -0,0 +1,271 @@ + + + + + + + + +Fit one or more kinetic models with one or more state variables to one or +more datasets — mmkin • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function calls mkinfit on all combinations of models and +datasets specified in its first two arguments.

    +
    + +
    mmkin(
    +  models = c("SFO", "FOMC", "DFOP"),
    +  datasets,
    +  cores = detectCores(),
    +  cluster = NULL,
    +  ...
    +)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + +
    models

    Either a character vector of shorthand names like +c("SFO", "FOMC", "DFOP", "HS", "SFORB"), or an optionally named +list of mkinmod objects.

    datasets

    An optionally named list of datasets suitable as observed +data for mkinfit.

    cores

    The number of cores to be used for multicore processing. This +is only used when the cluster argument is NULL. On Windows +machines, cores > 1 is not supported, you need to use the cluster +argument to use multiple logical processors. Per default, all cores +detected by parallel::detectCores() are used.

    cluster

    A cluster as returned by makeCluster to be used +for parallel execution.

    ...

    Further arguments that will be passed to mkinfit.

    + +

    Value

    + +

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

    +

    See also

    + +

    [.mmkin for subsetting, plot.mmkin for +plotting.

    + +

    Examples

    +
    +# \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) + +time_default <- system.time(fits.0 <- mmkin(models, datasets, quiet = TRUE)) +time_1 <- system.time(fits.4 <- mmkin(models, datasets, cores = 1, quiet = TRUE))
    #> Warning: Optimisation did not converge: +#> false convergence (8)
    +time_default
    #> user system elapsed +#> 4.516 0.456 1.976
    time_1
    #> user system elapsed +#> 5.957 0.001 5.961
    +endpoints(fits.0[["SFO_lin", 2]])
    #> $ff +#> parent_M1 parent_sink M1_M2 M1_sink +#> 0.7340479 0.2659521 0.7505687 0.2494313 +#> +#> $distimes +#> DT50 DT90 +#> parent 0.8777688 2.915885 +#> M1 2.3257457 7.725960 +#> M2 33.7200848 112.015697 +#>
    +# 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 +# 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]]) +# Plotting with mmkin (single brackets, extracting an mmkin object) does not +# allow to plot the observed variables separately +plot(fits.0[1, 1])
    # } + +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/nafta-1.png b/docs/dev/reference/nafta-1.png new file mode 100644 index 00000000..9025f2bb Binary files /dev/null and b/docs/dev/reference/nafta-1.png differ diff --git a/docs/dev/reference/nafta.html b/docs/dev/reference/nafta.html new file mode 100644 index 00000000..fe802c1b --- /dev/null +++ b/docs/dev/reference/nafta.html @@ -0,0 +1,283 @@ + + + + + + + + +Evaluate parent kinetics using the NAFTA guidance — nafta • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    The function fits the SFO, IORE and DFOP models using mmkin +and returns an object of class nafta that has methods for printing +and plotting.

    +

    Print nafta objects. The results for the three models are printed in the +order of increasing model complexity, i.e. SFO, then IORE, and finally DFOP.

    +
    + +
    nafta(ds, title = NA, quiet = FALSE, ...)
    +
    +# S3 method for nafta
    +print(x, quiet = TRUE, digits = 3, ...)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ds

    A dataframe that must contain one variable called "time" with the +time values specified by the time argument, one column called +"name" with the grouping of the observed values, and finally one column of +observed values called "value".

    title

    Optional title of the dataset

    quiet

    Should the evaluation text be shown?

    ...

    Further arguments passed to mmkin (not for the +printing method).

    x

    An nafta object.

    digits

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

    + +

    Source

    + +

    NAFTA (2011) Guidance for evaluating and calculating degradation +kinetics in environmental media. NAFTA Technical Working Group on +Pesticides +https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/guidance-evaluating-and-calculating-degradation +accessed 2019-02-22

    +

    US EPA (2015) Standard Operating Procedure for Using the NAFTA Guidance to +Calculate Representative Half-life Values and Characterizing Pesticide +Degradation +https://www.epa.gov/pesticide-science-and-assessing-pesticide-risks/standard-operating-procedure-using-nafta-guidance

    +

    Value

    + +

    An list of class nafta. The list element named "mmkin" is the +mmkin object containing the fits of the three models. The +list element named "title" contains the title of the dataset used. The +list element "data" contains the dataset used in the fits.

    + +

    Examples

    +
    + nafta_evaluation <- nafta(NAFTA_SOP_Appendix_D, cores = 1)
    #> The SFO model is rejected as S_SFO is equal or higher than the critical value S_c
    #> The representative half-life of the IORE model is longer than the one corresponding
    #> to the terminal degradation rate found with the DFOP model.
    #> The representative half-life obtained from the DFOP model may be used
    print(nafta_evaluation)
    #> Sums of squares: +#> SFO IORE DFOP +#> 1378.6832 615.7730 517.8836 +#> +#> Critical sum of squares for checking the SFO model: +#> [1] 717.4598 +#> +#> Parameters: +#> $SFO +#> Estimate Pr(>t) Lower Upper +#> parent_0 83.7558 1.80e-14 77.18268 90.3288 +#> k_parent_sink 0.0017 7.43e-05 0.00112 0.0026 +#> sigma 8.7518 1.22e-05 5.64278 11.8608 +#> +#> $IORE +#> Estimate Pr(>t) Lower Upper +#> parent_0 9.69e+01 NA 8.88e+01 1.05e+02 +#> k__iore_parent_sink 8.40e-14 NA 1.79e-18 3.94e-09 +#> N_parent 6.68e+00 NA 4.19e+00 9.17e+00 +#> sigma 5.85e+00 NA 3.76e+00 7.94e+00 +#> +#> $DFOP +#> Estimate Pr(>t) Lower Upper +#> parent_0 9.76e+01 1.94e-13 9.02e+01 1.05e+02 +#> k1 4.24e-02 5.92e-03 2.03e-02 8.88e-02 +#> k2 8.24e-04 6.48e-03 3.89e-04 1.75e-03 +#> g 2.88e-01 2.47e-05 1.95e-01 4.03e-01 +#> sigma 5.36e+00 2.22e-05 3.43e+00 7.30e+00 +#> +#> +#> DTx values: +#> DT50 DT90 DT50_rep +#> SFO 407 1350 407 +#> IORE 541 5190000 1560000 +#> DFOP 429 2380 841 +#> +#> Representative half-life: +#> [1] 841.41
    plot(nafta_evaluation)
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/nlme-1.png b/docs/dev/reference/nlme-1.png new file mode 100644 index 00000000..bc04dea8 Binary files /dev/null and b/docs/dev/reference/nlme-1.png differ diff --git a/docs/dev/reference/nlme.html b/docs/dev/reference/nlme.html new file mode 100644 index 00000000..8c64fb47 --- /dev/null +++ b/docs/dev/reference/nlme.html @@ -0,0 +1,281 @@ + + + + + + + + +Helper functions to create nlme models from mmkin row objects — nlme_function • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    These functions facilitate setting up a nonlinear mixed effects model for +an mmkin row object. An mmkin row object is essentially a list of mkinfit +objects that have been obtained by fitting the same model to a list of +datasets. They are used internally by the nlme.mmkin() method.

    +
    + +
    nlme_function(object)
    +
    +mean_degparms(object, random = FALSE)
    +
    +nlme_data(object)
    + +

    Arguments

    + + + + + + + + + + +
    object

    An mmkin row object containing several fits of the same model to different datasets

    random

    Should a list with fixed and random effects be returned?

    + +

    Value

    + +

    A function that can be used with nlme

    +

    If random is FALSE (default), a named vector containing mean values +of the fitted degradation model parameters. If random is TRUE, a list with +fixed and random effects, in the format required by the start argument of +nlme for the case of a single grouping variable ds.

    +

    A groupedData object

    +

    See also

    + + + +

    Examples

    +
    sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) +m_SFO <- mkinmod(parent = mkinsub("SFO")) +d_SFO_1 <- mkinpredict(m_SFO, + c(k_parent = 0.1), + c(parent = 98), sampling_times) +d_SFO_1_long <- mkin_wide_to_long(d_SFO_1, time = "time") +d_SFO_2 <- mkinpredict(m_SFO, + c(k_parent = 0.05), + c(parent = 102), sampling_times) +d_SFO_2_long <- mkin_wide_to_long(d_SFO_2, time = "time") +d_SFO_3 <- mkinpredict(m_SFO, + c(k_parent = 0.02), + c(parent = 103), sampling_times) +d_SFO_3_long <- mkin_wide_to_long(d_SFO_3, time = "time") + +d1 <- add_err(d_SFO_1, function(value) 3, n = 1) +d2 <- add_err(d_SFO_2, function(value) 2, n = 1) +d3 <- add_err(d_SFO_3, function(value) 4, n = 1) +ds <- c(d1 = d1, d2 = d2, d3 = d3) + +f <- mmkin("SFO", ds, cores = 1, quiet = TRUE) +mean_dp <- mean_degparms(f) +grouped_data <- nlme_data(f) +nlme_f <- nlme_function(f) +# These assignments are necessary for these objects to be +# visible to nlme and augPred when evaluation is done by +# pkgdown to generated the html docs. +assign("nlme_f", nlme_f, globalenv()) +assign("grouped_data", grouped_data, globalenv()) + +library(nlme) +m_nlme <- nlme(value ~ nlme_f(name, time, parent_0, log_k_parent_sink), + data = grouped_data, + fixed = parent_0 + log_k_parent_sink ~ 1, + random = pdDiag(parent_0 + log_k_parent_sink ~ 1), + start = mean_dp) +summary(m_nlme)
    #> Nonlinear mixed-effects model fit by maximum likelihood +#> Model: value ~ nlme_f(name, time, parent_0, log_k_parent_sink) +#> Data: grouped_data +#> AIC BIC logLik +#> 252.7798 262.1358 -121.3899 +#> +#> Random effects: +#> Formula: list(parent_0 ~ 1, log_k_parent_sink ~ 1) +#> Level: ds +#> Structure: Diagonal +#> parent_0 log_k_parent_sink Residual +#> StdDev: 0.004139378 0.6800778 2.489396 +#> +#> Fixed effects: parent_0 + log_k_parent_sink ~ 1 +#> Value Std.Error DF t-value p-value +#> parent_0 101.74884 0.6456057 44 157.60213 0 +#> log_k_parent_sink -3.05575 0.4015812 44 -7.60929 0 +#> Correlation: +#> prnt_0 +#> log_k_parent_sink 0.026 +#> +#> Standardized Within-Group Residuals: +#> Min Q1 Med Q3 Max +#> -2.13168782 -0.68780415 0.08282907 0.85913228 2.95298904 +#> +#> Number of Observations: 48 +#> Number of Groups: 3
    plot(augPred(m_nlme, level = 0:1), layout = c(3, 1))
    # augPred does not seem to work on fits with more than one state +# variable + +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/nlme.mmkin-1.png b/docs/dev/reference/nlme.mmkin-1.png new file mode 100644 index 00000000..67f279da Binary files /dev/null and b/docs/dev/reference/nlme.mmkin-1.png differ diff --git a/docs/dev/reference/nlme.mmkin-2.png b/docs/dev/reference/nlme.mmkin-2.png new file mode 100644 index 00000000..16a5d7bd Binary files /dev/null and b/docs/dev/reference/nlme.mmkin-2.png differ diff --git a/docs/dev/reference/nlme.mmkin-3.png b/docs/dev/reference/nlme.mmkin-3.png new file mode 100644 index 00000000..73426834 Binary files /dev/null and b/docs/dev/reference/nlme.mmkin-3.png differ diff --git a/docs/dev/reference/nlme.mmkin-4.png b/docs/dev/reference/nlme.mmkin-4.png new file mode 100644 index 00000000..9b46b425 Binary files /dev/null and b/docs/dev/reference/nlme.mmkin-4.png differ diff --git a/docs/dev/reference/nlme.mmkin-5.png b/docs/dev/reference/nlme.mmkin-5.png new file mode 100644 index 00000000..3398dd4a Binary files /dev/null and b/docs/dev/reference/nlme.mmkin-5.png differ diff --git a/docs/dev/reference/nlme.mmkin-6.png b/docs/dev/reference/nlme.mmkin-6.png new file mode 100644 index 00000000..7b663991 Binary files /dev/null and b/docs/dev/reference/nlme.mmkin-6.png differ diff --git a/docs/dev/reference/nlme.mmkin-7.png b/docs/dev/reference/nlme.mmkin-7.png new file mode 100644 index 00000000..d2c38a63 Binary files /dev/null and b/docs/dev/reference/nlme.mmkin-7.png differ diff --git a/docs/dev/reference/nlme.mmkin.html b/docs/dev/reference/nlme.mmkin.html new file mode 100644 index 00000000..a6716c0f --- /dev/null +++ b/docs/dev/reference/nlme.mmkin.html @@ -0,0 +1,463 @@ + + + + + + + + +Create an nlme model for an mmkin row object — nlme.mmkin • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This functions sets up a nonlinear mixed effects model for an mmkin row +object. An mmkin row object is essentially a list of mkinfit objects that +have been obtained by fitting the same model to a list of datasets.

    +
    + +
    # S3 method for mmkin
    +nlme(
    +  model,
    +  data = sys.frame(sys.parent()),
    +  fixed,
    +  random = fixed,
    +  groups,
    +  start,
    +  correlation = NULL,
    +  weights = NULL,
    +  subset,
    +  method = c("ML", "REML"),
    +  na.action = na.fail,
    +  naPattern,
    +  control = list(),
    +  verbose = FALSE
    +)
    +
    +# S3 method for nlme.mmkin
    +print(x, ...)
    +
    +# S3 method for nlme.mmkin
    +update(object, ...)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    model

    An mmkin row object.

    data

    Ignored, data are taken from the mmkin model

    fixed

    Ignored, all degradation parameters fitted in the +mmkin model are used as fixed parameters

    random

    If not specified, all fixed effects are complemented +with uncorrelated random effects

    groups

    See the documentation of nlme

    start

    If not specified, mean values of the fitted degradation +parameters taken from the mmkin object are used

    correlation

    See the documentation of nlme

    weights

    passed to nlme

    subset

    passed to nlme

    method

    passed to nlme

    na.action

    passed to nlme

    naPattern

    passed to nlme

    control

    passed to nlme

    verbose

    passed to nlme

    x

    An nlme.mmkin object to print

    ...

    Update specifications passed to update.nlme

    object

    An nlme.mmkin object to update

    + +

    Value

    + +

    Upon success, a fitted nlme.mmkin object, which is an nlme object +with additional elements

    +

    See also

    + + + +

    Examples

    +
    ds <- lapply(experimental_data_for_UBA_2019[6:10], + function(x) subset(x$data[c("name", "time", "value")], name == "parent")) +f <- mmkin("SFO", ds, quiet = TRUE, cores = 1) +library(nlme) +endpoints(f[[1]])
    #> $distimes +#> DT50 DT90 +#> parent 11.96183 39.73634 +#>
    f_nlme <- nlme(f) +print(f_nlme)
    #> Nonlinear mixed-effects model fit by maximum likelihood +#> Model: value ~ (mkin::get_deg_func())(name, time, parent_0, log_k_parent_sink) +#> Data: "Not shown" +#> Log-likelihood: -307.5269 +#> Fixed: list(parent_0 ~ 1, log_k_parent_sink ~ 1) +#> parent_0 log_k_parent_sink +#> 85.540979 -3.229602 +#> +#> Random effects: +#> Formula: list(parent_0 ~ 1, log_k_parent_sink ~ 1) +#> Level: ds +#> Structure: Diagonal +#> parent_0 log_k_parent_sink Residual +#> StdDev: 1.308245 1.288586 6.304923 +#> +#> Number of Observations: 90 +#> Number of Groups: 5
    endpoints(f_nlme)
    #> $distimes +#> DT50 DT90 +#> parent 17.51556 58.18543 +#>
    # \dontrun{ + f_nlme_2 <- nlme(f, start = c(parent_0 = 100, log_k_parent_sink = 0.1)) + update(f_nlme_2, random = parent_0 ~ 1)
    #> Nonlinear mixed-effects model fit by maximum likelihood +#> Model: value ~ (mkin::get_deg_func())(name, time, parent_0, log_k_parent_sink) +#> Data: "Not shown" +#> Log-likelihood: -404.3729 +#> Fixed: list(parent_0 ~ 1, log_k_parent_sink ~ 1) +#> parent_0 log_k_parent_sink +#> 75.933480 -3.555983 +#> +#> Random effects: +#> Formula: parent_0 ~ 1 | ds +#> parent_0 Residual +#> StdDev: 0.002416802 21.63027 +#> +#> Number of Observations: 90 +#> Number of Groups: 5
    # Test on some real data + ds_2 <- lapply(experimental_data_for_UBA_2019[6:10], + function(x) x$data[c("name", "time", "value")]) + m_sfo_sfo <- mkinmod(parent = mkinsub("SFO", "A1"), + A1 = mkinsub("SFO"), use_of_ff = "min", quiet = TRUE) + m_sfo_sfo_ff <- mkinmod(parent = mkinsub("SFO", "A1"), + A1 = mkinsub("SFO"), use_of_ff = "max", quiet = TRUE) + m_fomc_sfo <- mkinmod(parent = mkinsub("FOMC", "A1"), + A1 = mkinsub("SFO"), quiet = TRUE) + m_dfop_sfo <- mkinmod(parent = mkinsub("DFOP", "A1"), + A1 = mkinsub("SFO"), quiet = TRUE) + + f_2 <- mmkin(list("SFO-SFO" = m_sfo_sfo, + "SFO-SFO-ff" = m_sfo_sfo_ff, + "FOMC-SFO" = m_fomc_sfo, + "DFOP-SFO" = m_dfop_sfo), + ds_2, quiet = TRUE) + plot(f_2["SFO-SFO", 3:4]) # Separate fits for datasets 3 and 4
    + f_nlme_sfo_sfo <- nlme(f_2["SFO-SFO", ]) + # plot(f_nlme_sfo_sfo) # not feasible with pkgdown figures + plot(f_nlme_sfo_sfo, 3:4) # Global mixed model: Fits for datasets 3 and 4
    + # With formation fractions + f_nlme_sfo_sfo_ff <- nlme(f_2["SFO-SFO-ff", ]) + plot(f_nlme_sfo_sfo_ff, 3:4) # chi2 different due to different df attribution
    + # For more parameters, we need to increase pnlsMaxIter and the tolerance + # to get convergence + f_nlme_fomc_sfo <- nlme(f_2["FOMC-SFO", ], + control = list(pnlsMaxIter = 100, tolerance = 1e-4), verbose = TRUE)
    #> +#> **Iteration 1 +#> LME step: Loglik: -394.1603, nlminb iterations: 2 +#> reStruct parameters: +#> ds1 ds2 ds3 ds4 ds5 +#> -0.2079863 0.8563823 1.7454253 1.0917707 1.2756955 +#> Beginning PNLS step: .. completed fit_nlme() step. +#> PNLS step: RSS = 643.8814 +#> fixed effects: 94.17379 -5.473189 -0.6970234 -0.202509 2.103883 +#> iterations: 100 +#> Convergence crit. (must all become <= tolerance = 0.0001): +#> fixed reStruct +#> 0.7959873 0.1447512 +#> +#> **Iteration 2 +#> LME step: Loglik: -396.3824, nlminb iterations: 7 +#> reStruct parameters: +#> ds1 ds2 ds3 ds4 ds5 +#> -1.712406e-01 -2.278541e-05 1.842120e+00 1.073975e+00 1.322924e+00 +#> Beginning PNLS step: .. completed fit_nlme() step. +#> PNLS step: RSS = 643.8025 +#> fixed effects: 94.17385 -5.473491 -0.6970406 -0.2025139 2.103871 +#> iterations: 100 +#> Convergence crit. (must all become <= tolerance = 0.0001): +#> fixed reStruct +#> 5.51758e-05 1.26861e-03 +#> +#> **Iteration 3 +#> LME step: Loglik: -396.3825, nlminb iterations: 7 +#> reStruct parameters: +#> ds1 ds2 ds3 ds4 ds5 +#> -0.1712500923 -0.0001515734 1.8420972550 1.0739796967 1.3229177241 +#> Beginning PNLS step: .. completed fit_nlme() step. +#> PNLS step: RSS = 643.7941 +#> fixed effects: 94.17386 -5.473523 -0.6970424 -0.2025146 2.103869 +#> iterations: 100 +#> Convergence crit. (must all become <= tolerance = 0.0001): +#> fixed reStruct +#> 5.792621e-06 1.335434e-04 +#> +#> **Iteration 4 +#> LME step: Loglik: -396.3825, nlminb iterations: 7 +#> reStruct parameters: +#> ds1 ds2 ds3 ds4 ds5 +#> -0.1712517206 -0.0001651603 1.8420950864 1.0739800294 1.3229173529 +#> Beginning PNLS step: .. completed fit_nlme() step. +#> PNLS step: RSS = 643.7949 +#> fixed effects: 94.17386 -5.473521 -0.6970423 -0.2025145 2.10387 +#> iterations: 100 +#> Convergence crit. (must all become <= tolerance = 0.0001): +#> fixed reStruct +#> 4.025781e-07 9.628656e-06
    f_nlme_dfop_sfo <- nlme(f_2["DFOP-SFO", ], + control = list(pnlsMaxIter = 120, tolerance = 5e-4), verbose = TRUE)
    #> +#> **Iteration 1 +#> LME step: Loglik: -404.9583, nlminb iterations: 1 +#> reStruct parameters: +#> ds1 ds2 ds3 ds4 ds5 ds6 +#> -0.4114357 0.9798641 1.6990035 0.7293314 0.3354323 1.7113047 +#> Beginning PNLS step: .. completed fit_nlme() step. +#> PNLS step: RSS = 630.3642 +#> fixed effects: 93.82269 -5.455991 -0.6788957 -1.862196 -4.199671 0.0553284 +#> iterations: 120 +#> Convergence crit. (must all become <= tolerance = 0.0005): +#> fixed reStruct +#> 0.7879730 0.5822574 +#> +#> **Iteration 2 +#> LME step: Loglik: -407.7755, nlminb iterations: 11 +#> reStruct parameters: +#> ds1 ds2 ds3 ds4 ds5 ds6 +#> -0.371224105 0.003056163 1.789939431 0.724671132 0.301602942 1.754200482 +#> Beginning PNLS step: .. completed fit_nlme() step. +#> PNLS step: RSS = 630.364 +#> fixed effects: 93.82269 -5.455991 -0.6788958 -1.862196 -4.199671 0.05532834 +#> iterations: 120 +#> Convergence crit. (must all become <= tolerance = 0.0005): +#> fixed reStruct +#> 9.814652e-07 1.059239e-05
    plot(f_2["FOMC-SFO", 3:4])
    plot(f_nlme_fomc_sfo, 3:4)
    + plot(f_2["DFOP-SFO", 3:4])
    plot(f_nlme_dfop_sfo, 3:4)
    + anova(f_nlme_dfop_sfo, f_nlme_fomc_sfo, f_nlme_sfo_sfo)
    #> Model df AIC BIC logLik Test L.Ratio p-value +#> f_nlme_dfop_sfo 1 13 843.8547 884.6201 -408.9274 +#> f_nlme_fomc_sfo 2 11 818.5151 853.0089 -398.2576 1 vs 2 21.33957 <.0001 +#> f_nlme_sfo_sfo 3 9 1085.1821 1113.4043 -533.5910 2 vs 3 270.66697 <.0001
    anova(f_nlme_dfop_sfo, f_nlme_sfo_sfo) # if we ignore FOMC
    #> Model df AIC BIC logLik Test L.Ratio p-value +#> f_nlme_dfop_sfo 1 13 843.8547 884.6201 -408.9274 +#> f_nlme_sfo_sfo 2 9 1085.1821 1113.4043 -533.5910 1 vs 2 249.3274 <.0001
    + endpoints(f_nlme_sfo_sfo)
    #> $ff +#> parent_sink parent_A1 A1_sink +#> 0.5912432 0.4087568 1.0000000 +#> +#> $distimes +#> DT50 DT90 +#> parent 19.13518 63.5657 +#> A1 66.02155 219.3189 +#>
    endpoints(f_nlme_dfop_sfo)
    #> $ff +#> parent_A1 parent_sink +#> 0.2768574 0.7231426 +#> +#> $distimes +#> DT50 DT90 DT50_k1 DT50_k2 +#> parent 11.07091 104.6320 4.462384 46.20825 +#> A1 162.30518 539.1661 NA NA +#>
    # } +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/nobs.mkinfit.html b/docs/dev/reference/nobs.mkinfit.html new file mode 100644 index 00000000..06575d54 --- /dev/null +++ b/docs/dev/reference/nobs.mkinfit.html @@ -0,0 +1,197 @@ + + + + + + + + +Number of observations on which an mkinfit object was fitted — nobs.mkinfit • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Number of observations on which an mkinfit object was fitted

    +
    + +
    # S3 method for mkinfit
    +nobs(object, ...)
    + +

    Arguments

    + + + + + + + + + + +
    object

    An mkinfit object

    ...

    For compatibility with the generic method

    + +

    Value

    + +

    The number of rows in the data included in the mkinfit object

    + +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/parms.html b/docs/dev/reference/parms.html new file mode 100644 index 00000000..6a46dad0 --- /dev/null +++ b/docs/dev/reference/parms.html @@ -0,0 +1,292 @@ + + + + + + + + +Extract model parameters from mkinfit models — parms • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function always returns degradation model parameters as well as error +model parameters, in order to avoid working with a fitted model without +considering the error structure that was assumed for the fit.

    +
    + +
    parms(object, ...)
    +
    +# S3 method for mkinfit
    +parms(object, transformed = FALSE, ...)
    +
    +# S3 method for mmkin
    +parms(object, transformed = FALSE, ...)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    object

    A fitted model object. Methods are implemented for +mkinfit() objects and for mmkin() objects.

    ...

    Not used

    transformed

    Should the parameters be returned +as used internally during the optimisation?

    + +

    Value

    + +

    For mkinfit objects, a numeric vector of fitted model parameters. +For mmkin row objects, a matrix with the parameters with a +row for each dataset. If the mmkin object has more than one row, a list of +such matrices is returned.

    + +

    Examples

    +
    # mkinfit objects +fit <- mkinfit("SFO", FOCUS_2006_C, quiet = TRUE) +parms(fit)
    #> parent_0 k_parent_sink sigma +#> 82.4921598 0.3060633 4.6730124
    parms(fit, transformed = TRUE)
    #> parent_0 log_k_parent_sink sigma +#> 82.492160 -1.183963 4.673012
    +# mmkin objects +ds <- lapply(experimental_data_for_UBA_2019[6:10], + function(x) subset(x$data[c("name", "time", "value")])) +names(ds) <- paste("Dataset", 6:10) +# \dontrun{ +fits <- mmkin(c("SFO", "FOMC", "DFOP"), ds, quiet = TRUE, cores = 1) +parms(fits["SFO", ])
    #> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 +#> parent_0 88.52275400 82.666781678 86.8547308 91.7779306 82.14809450 +#> k_parent_sink 0.05794659 0.009647805 0.2102974 0.1232258 0.00720421 +#> sigma 5.15274487 7.040168584 3.6769645 6.4669234 6.50457673
    parms(fits[, 2])
    #> $SFO +#> Dataset 7 +#> parent_0 82.666781678 +#> k_parent_sink 0.009647805 +#> sigma 7.040168584 +#> +#> $FOMC +#> Dataset 7 +#> parent_0 92.6837649 +#> alpha 0.4967832 +#> beta 14.1451255 +#> sigma 1.9167519 +#> +#> $DFOP +#> Dataset 7 +#> parent_0 91.058971503 +#> k1 0.044946770 +#> k2 0.002868336 +#> g 0.526942415 +#> sigma 2.221302196 +#>
    parms(fits)
    #> $SFO +#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 +#> parent_0 88.52275400 82.666781678 86.8547308 91.7779306 82.14809450 +#> k_parent_sink 0.05794659 0.009647805 0.2102974 0.1232258 0.00720421 +#> sigma 5.15274487 7.040168584 3.6769645 6.4669234 6.50457673 +#> +#> $FOMC +#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 +#> parent_0 95.558575 92.6837649 90.719787 98.383939 94.8481458 +#> alpha 1.338667 0.4967832 1.639099 1.074460 0.2805272 +#> beta 13.033315 14.1451255 5.007077 4.397126 6.9052224 +#> sigma 1.847671 1.9167519 1.066063 3.146056 1.6222778 +#> +#> $DFOP +#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 +#> parent_0 96.55213663 91.058971503 90.34509469 98.14858850 94.311323409 +#> k1 0.21954589 0.044946770 0.41232289 0.31697588 0.080663853 +#> k2 0.02957934 0.002868336 0.07581767 0.03260384 0.003425417 +#> g 0.44845068 0.526942415 0.66091965 0.65322767 0.342652880 +#> sigma 1.35690468 2.221302196 1.34169076 2.87159846 1.942067831 +#>
    parms(fits, transformed = TRUE)
    #> $SFO +#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 +#> parent_0 88.522754 82.666782 86.854731 91.777931 82.148094 +#> log_k_parent_sink -2.848234 -4.641025 -1.559232 -2.093737 -4.933090 +#> sigma 5.152745 7.040169 3.676964 6.466923 6.504577 +#> +#> $FOMC +#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 +#> parent_0 95.5585751 92.6837649 90.7197870 98.38393896 94.848146 +#> log_alpha 0.2916741 -0.6996015 0.4941466 0.07181817 -1.271085 +#> log_beta 2.5675088 2.6493701 1.6108523 1.48095106 1.932278 +#> sigma 1.8476712 1.9167519 1.0660627 3.14605557 1.622278 +#> +#> $DFOP +#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10 +#> parent_0 96.5521366 91.05897150 90.3450947 98.1485885 94.311323 +#> log_k1 -1.5161940 -3.10227638 -0.8859485 -1.1489296 -2.517465 +#> log_k2 -3.5206791 -5.85402317 -2.5794240 -3.4233253 -5.676532 +#> g_ilr -0.1463234 0.07627854 0.4719196 0.4477805 -0.460676 +#> sigma 1.3569047 2.22130220 1.3416908 2.8715985 1.942068 +#>
    # } +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/plot.mkinfit-1.png b/docs/dev/reference/plot.mkinfit-1.png new file mode 100644 index 00000000..c6a415d7 Binary files /dev/null and b/docs/dev/reference/plot.mkinfit-1.png differ diff --git a/docs/dev/reference/plot.mkinfit-2.png b/docs/dev/reference/plot.mkinfit-2.png new file mode 100644 index 00000000..5dd3731e Binary files /dev/null and b/docs/dev/reference/plot.mkinfit-2.png differ diff --git a/docs/dev/reference/plot.mkinfit-3.png b/docs/dev/reference/plot.mkinfit-3.png new file mode 100644 index 00000000..59cf8f8d Binary files /dev/null and b/docs/dev/reference/plot.mkinfit-3.png differ diff --git a/docs/dev/reference/plot.mkinfit-4.png b/docs/dev/reference/plot.mkinfit-4.png new file mode 100644 index 00000000..d9867952 Binary files /dev/null and b/docs/dev/reference/plot.mkinfit-4.png differ diff --git a/docs/dev/reference/plot.mkinfit-5.png b/docs/dev/reference/plot.mkinfit-5.png new file mode 100644 index 00000000..1109c8df Binary files /dev/null and b/docs/dev/reference/plot.mkinfit-5.png differ diff --git a/docs/dev/reference/plot.mkinfit-6.png b/docs/dev/reference/plot.mkinfit-6.png new file mode 100644 index 00000000..230c90e9 Binary files /dev/null and b/docs/dev/reference/plot.mkinfit-6.png differ diff --git a/docs/dev/reference/plot.mkinfit-7.png b/docs/dev/reference/plot.mkinfit-7.png new file mode 100644 index 00000000..b23427b5 Binary files /dev/null and b/docs/dev/reference/plot.mkinfit-7.png differ diff --git a/docs/dev/reference/plot.mkinfit.html b/docs/dev/reference/plot.mkinfit.html new file mode 100644 index 00000000..b9331f1a --- /dev/null +++ b/docs/dev/reference/plot.mkinfit.html @@ -0,0 +1,379 @@ + + + + + + + + +Plot the observed data and the fitted model of an mkinfit object — plot.mkinfit • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    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.

    +
    + +
    # 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,
    +  row_layout = FALSE,
    +  lpos = "topright",
    +  inset = c(0.05, 0.05),
    +  show_errmin = FALSE,
    +  errmin_digits = 3,
    +  frame = TRUE,
    +  ...
    +)
    +
    +plot_sep(
    +  fit,
    +  show_errmin = TRUE,
    +  show_residuals = ifelse(identical(fit$err_mod, "const"), TRUE, "standardized"),
    +  ...
    +)
    +
    +plot_res(
    +  fit,
    +  sep_obs = FALSE,
    +  show_errmin = sep_obs,
    +  standardized = ifelse(identical(fit$err_mod, "const"), FALSE, TRUE),
    +  ...
    +)
    +
    +plot_err(fit, sep_obs = FALSE, show_errmin = sep_obs, ...)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    x

    Alias for fit introduced for compatibility with the generic S3 +method.

    fit

    An object of class mkinfit.

    obs_vars

    A character vector of names of the observed variables for +which the data and the model should be plotted. Defauls to all observed +variables in the model.

    xlab

    Label for the x axis.

    ylab

    Label for the y axis.

    xlim

    Plot range in x direction.

    ylim

    Plot range in y direction.

    col_obs

    Colors used for plotting the observed data and the +corresponding model prediction lines.

    pch_obs

    Symbols to be used for plotting the data.

    lty_obs

    Line types to be used for the model predictions.

    add

    Should the plot be added to an existing plot?

    legend

    Should a legend be added to the plot?

    show_residuals

    Should residuals be shown? If only one plot of the +fits is shown, the residual plot is in the lower third of the plot. +Otherwise, i.e. if "sep_obs" is given, the residual plots will be located +to the right of the plots of the fitted curves. If this is set to +'standardized', a plot of the residuals divided by the standard deviation +given by the fitted error model will be shown.

    show_errplot

    Should squared residuals and the error model be shown? +If only one plot of the fits is shown, this plot is in the lower third of +the plot. Otherwise, i.e. if "sep_obs" is given, the residual plots will +be located to the right of the plots of the fitted curves.

    maxabs

    Maximum absolute value of the residuals. This is used for the +scaling of the y axis and defaults to "auto".

    sep_obs

    Should the observed variables be shown in separate subplots? +If yes, residual plots requested by "show_residuals" will be shown next +to, not below the plot of the fits.

    rel.height.middle

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

    row_layout

    Should we use a row layout where the residual plot or the +error model plot is shown to the right?

    lpos

    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.

    show_errmin

    Should the FOCUS chi2 error value be shown in the upper +margin of the plot?

    errmin_digits

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

    frame

    Should a frame be drawn around the plots?

    ...

    Further arguments passed to plot.

    standardized

    When calling 'plot_res', should the residuals be +standardized in the residual plot?

    + +

    Value

    + +

    The function is called for its side effect.

    +

    Details

    + +

    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.

    + +

    Examples

    +
    +# 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)
    #> Warning: Observations with value of zero were removed from the data
    fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE, error_model = "tc")
    #> Warning: Observations with value of zero were removed from the data
    plot(fit)
    plot_res(fit)
    plot_res(fit, standardized = FALSE)
    plot_err(fit)
    +# Show the observed variables separately, with residuals +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"))
    +# Show the observed variables separately, with the error model +plot(fit, sep_obs = TRUE, show_errplot = TRUE, lpos = c("topright", "bottomright"), + show_errmin = TRUE)
    # } + +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/plot.mmkin-1.png b/docs/dev/reference/plot.mmkin-1.png new file mode 100644 index 00000000..8cf969c9 Binary files /dev/null and b/docs/dev/reference/plot.mmkin-1.png differ diff --git a/docs/dev/reference/plot.mmkin-2.png b/docs/dev/reference/plot.mmkin-2.png new file mode 100644 index 00000000..45d67b55 Binary files /dev/null and b/docs/dev/reference/plot.mmkin-2.png differ diff --git a/docs/dev/reference/plot.mmkin-3.png b/docs/dev/reference/plot.mmkin-3.png new file mode 100644 index 00000000..c58b371a Binary files /dev/null and b/docs/dev/reference/plot.mmkin-3.png differ diff --git a/docs/dev/reference/plot.mmkin-4.png b/docs/dev/reference/plot.mmkin-4.png new file mode 100644 index 00000000..47cd7eec Binary files /dev/null and b/docs/dev/reference/plot.mmkin-4.png differ diff --git a/docs/dev/reference/plot.mmkin-5.png b/docs/dev/reference/plot.mmkin-5.png new file mode 100644 index 00000000..44037bb4 Binary files /dev/null and b/docs/dev/reference/plot.mmkin-5.png differ diff --git a/docs/dev/reference/plot.mmkin.html b/docs/dev/reference/plot.mmkin.html new file mode 100644 index 00000000..ca1ec266 --- /dev/null +++ b/docs/dev/reference/plot.mmkin.html @@ -0,0 +1,287 @@ + + + + + + + + +Plot model fits (observed and fitted) and the residuals for a row or column +of an mmkin object — plot.mmkin • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    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.

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

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    x

    An object of class mmkin, with either one row or one +column.

    main

    The main title placed on the outer margin of the plot.

    legends

    An index for the fits for which legends should be shown.

    resplot

    Should the residuals plotted against time, using +mkinresplot, or as squared residuals against predicted +values, with the error model, using mkinerrplot.

    standardized

    Should the residuals be standardized? This option +is passed to mkinresplot, it only takes effect if +resplot = "time".

    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.

    errmin_digits

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

    cex

    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.

    ymax

    Maximum y axis value for plot.mkinfit.

    ...

    Further arguments passed to plot.mkinfit and +mkinresplot.

    + +

    Value

    + +

    The function is called for its side effect.

    +

    Details

    + +

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

    + +

    Examples

    +
    + # \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", ])
    plot(fits["FOMC", ], show_errmin = FALSE)
    + # 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])
    + # Show the error models + plot(fits["FOMC", ], resplot = "errmod")
    # } + +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/plot.nafta.html b/docs/dev/reference/plot.nafta.html new file mode 100644 index 00000000..dab84955 --- /dev/null +++ b/docs/dev/reference/plot.nafta.html @@ -0,0 +1,210 @@ + + + + + + + + +Plot the results of the three models used in the NAFTA scheme. — plot.nafta • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    The plots are ordered with increasing complexity of the model in this +function (SFO, then IORE, then DFOP).

    +
    + +
    # S3 method for nafta
    +plot(x, legend = FALSE, main = "auto", ...)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + +
    x

    An object of class nafta.

    legend

    Should a legend be added?

    main

    Possibility to override the main title of the plot.

    ...

    Further arguments passed to plot.mmkin.

    + +

    Value

    + +

    The function is called for its side effect.

    +

    Details

    + +

    Calls plot.mmkin.

    + +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/plot.nlme.mmkin-1.png b/docs/dev/reference/plot.nlme.mmkin-1.png new file mode 100644 index 00000000..fe2ef7d3 Binary files /dev/null and b/docs/dev/reference/plot.nlme.mmkin-1.png differ diff --git a/docs/dev/reference/plot.nlme.mmkin-2.png b/docs/dev/reference/plot.nlme.mmkin-2.png new file mode 100644 index 00000000..c82d0271 Binary files /dev/null and b/docs/dev/reference/plot.nlme.mmkin-2.png differ diff --git a/docs/dev/reference/plot.nlme.mmkin.html b/docs/dev/reference/plot.nlme.mmkin.html new file mode 100644 index 00000000..fd40b975 --- /dev/null +++ b/docs/dev/reference/plot.nlme.mmkin.html @@ -0,0 +1,275 @@ + + + + + + + + +Plot a fitted nonlinear mixed model obtained via an mmkin row object — plot.nlme.mmkin • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Plot a fitted nonlinear mixed model obtained via an mmkin row object

    +
    + +
    # S3 method for nlme.mmkin
    +plot(
    +  x,
    +  i = 1:ncol(x$mmkin_orig),
    +  main = "auto",
    +  legends = 1,
    +  resplot = c("time", "errmod"),
    +  standardized = FALSE,
    +  show_errmin = TRUE,
    +  errmin_var = "All data",
    +  errmin_digits = 3,
    +  cex = 0.7,
    +  rel.height.middle = 0.9,
    +  ymax = "auto",
    +  ...
    +)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    x

    An object of class nlme.mmkin

    i

    A numeric index to select datasets for which to plot the nlme fit, +in case plots get too large

    main

    The main title placed on the outer margin of the plot.

    legends

    An index for the fits for which legends should be shown.

    resplot

    Should the residuals plotted against time, using +mkinresplot, or as squared residuals against predicted +values, with the error model, using mkinerrplot.

    standardized

    Should the residuals be standardized? This option +is passed to mkinresplot, it only takes effect if +resplot = "time".

    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.

    errmin_digits

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

    cex

    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.

    ymax

    Maximum y axis value for plot.mkinfit.

    ...

    Further arguments passed to plot.mkinfit and +mkinresplot.

    + +

    Value

    + +

    The function is called for its side effect.

    + +

    Examples

    +
    ds <- lapply(experimental_data_for_UBA_2019[6:10], + function(x) subset(x$data[c("name", "time", "value")], name == "parent")) +f <- mmkin("SFO", ds, quiet = TRUE, cores = 1) +#plot(f) # too many panels for pkgdown +plot(f[, 3:4])
    library(nlme) +f_nlme <- nlme(f) + +#plot(f_nlme) # too many panels for pkgdown +plot(f_nlme, 3:4)
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/print.mkinds.html b/docs/dev/reference/print.mkinds.html new file mode 100644 index 00000000..0539c7da --- /dev/null +++ b/docs/dev/reference/print.mkinds.html @@ -0,0 +1,194 @@ + + + + + + + + +Print mkinds objects — print.mkinds • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Print mkinds objects

    +
    + +
    # S3 method for mkinds
    +print(x, ...)
    + +

    Arguments

    + + + + + + + + + + +
    x

    An mkinds object.

    ...

    Not used.

    + + +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/print.mkinmod.html b/docs/dev/reference/print.mkinmod.html new file mode 100644 index 00000000..fd0f624a --- /dev/null +++ b/docs/dev/reference/print.mkinmod.html @@ -0,0 +1,217 @@ + + + + + + + + +Print mkinmod objects — print.mkinmod • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Print mkinmod objects in a way that the user finds his way to get to its +components.

    +
    + +
    # S3 method for mkinmod
    +print(x, ...)
    + +

    Arguments

    + + + + + + + + + + +
    x

    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 +#> Use of formation fractions $use_of_ff: max +#> Specification $spec: +#> $parent +#> $type: SFO; $to: M1; $sink: TRUE +#> $M1 +#> $type: SFO; $to: M2; $sink: TRUE +#> $M2 +#> $type: SFO; $sink: TRUE +#> Coefficient matrix $coefmat available +#> Compiled model $cf available +#> Differential equations: +#> d_parent/dt = - k_parent * parent +#> d_M1/dt = + f_parent_to_M1 * k_parent * parent - k_M1 * M1 +#> d_M2/dt = + f_M1_to_M2 * k_M1 * M1 - k_M2 * M2
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/reexports.html b/docs/dev/reference/reexports.html new file mode 100644 index 00000000..fe27de4b --- /dev/null +++ b/docs/dev/reference/reexports.html @@ -0,0 +1,190 @@ + + + + + + + + +Objects exported from other packages — reexports • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    These objects are imported from other packages. Follow the links +below to see their documentation.

    + +
    lmtest

    lrtest

    + + +
    + + + + +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/residuals.mkinfit.html b/docs/dev/reference/residuals.mkinfit.html new file mode 100644 index 00000000..89552630 --- /dev/null +++ b/docs/dev/reference/residuals.mkinfit.html @@ -0,0 +1,204 @@ + + + + + + + + +Extract residuals from an mkinfit model — residuals.mkinfit • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Extract residuals from an mkinfit model

    +
    + +
    # S3 method for mkinfit
    +residuals(object, standardized = FALSE, ...)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    object

    A mkinfit object

    standardized

    Should the residuals be standardized by dividing by the +standard deviation obtained from the fitted error model?

    ...

    Not used

    + + +

    Examples

    +
    f <- mkinfit("DFOP", FOCUS_2006_C, quiet = TRUE) +residuals(f)
    #> [1] 0.09726306 -0.13912135 -0.15351176 0.73388319 -0.08657030 -0.93204730 +#> [7] -0.03269102 1.45347805 -0.88423710
    residuals(f, standardized = TRUE)
    #> [1] 0.13969820 -0.19981894 -0.22048777 1.05407086 -0.12434027 -1.33869248 +#> [7] -0.04695387 2.08761953 -1.27002305
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/saemix-1.png b/docs/dev/reference/saemix-1.png new file mode 100644 index 00000000..0d79300d Binary files /dev/null and b/docs/dev/reference/saemix-1.png differ diff --git a/docs/dev/reference/saemix-2.png b/docs/dev/reference/saemix-2.png new file mode 100644 index 00000000..04de70b5 Binary files /dev/null and b/docs/dev/reference/saemix-2.png differ diff --git a/docs/dev/reference/saemix.html b/docs/dev/reference/saemix.html new file mode 100644 index 00000000..ad16a81b --- /dev/null +++ b/docs/dev/reference/saemix.html @@ -0,0 +1,446 @@ + + + + + + + + +Create saemix models from mmkin row objects — saemix_model • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function sets up a nonlinear mixed effects model for an mmkin row +object for use with the saemix package. An mmkin row object is essentially a +list of mkinfit objects that have been obtained by fitting the same model to +a list of datasets.

    +
    + +
    saemix_model(object, cores = parallel::detectCores())
    +
    +saemix_data(object, ...)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    object

    An mmkin row object containing several fits of the same model to different datasets

    cores

    The number of cores to be used for multicore processing. +On Windows machines, cores > 1 is currently not supported.

    ...

    Further parameters passed to saemix::saemixData

    + +

    Value

    + +

    An saemix::SaemixModel object.

    +

    An saemix::SaemixData object.

    +

    Details

    + +

    Starting values for the fixed effects (population mean parameters, argument psi0 of +saemix::saemixModel() are the mean values of the parameters found using +mmkin. Starting variances of the random effects (argument omega.init) are the +variances of the deviations of the parameters from these mean values.

    + +

    Examples

    +
    ds <- lapply(experimental_data_for_UBA_2019[6:10], + function(x) subset(x$data[c("name", "time", "value")])) +names(ds) <- paste("Dataset", 6:10) +sfo_sfo <- mkinmod(parent = mkinsub("SFO", "A1"), + A1 = mkinsub("SFO"))
    #> Successfully compiled differential equation model from auto-generated C code.
    # \dontrun{ +f_mmkin <- mmkin(list("SFO-SFO" = sfo_sfo), ds, quiet = TRUE) +library(saemix)
    #> Package saemix, version 3.1.9000 +#> please direct bugs, questions and feedback to emmanuelle.comets@inserm.fr
    m_saemix <- saemix_model(f_mmkin)
    #> +#> +#> The following SaemixModel object was successfully created: +#> +#> Nonlinear mixed-effects model +#> Model function: Mixed model generated from mmkin object Model type: structural +#> function (psi, id, xidep) +#> { +#> uid <- unique(id) +#> res_list <- parallel::mclapply(uid, function(i) { +#> transparms_optim <- psi[i, ] +#> names(transparms_optim) <- names(degparms_optim) +#> odeini_optim <- transparms_optim[odeini_optim_parm_names] +#> names(odeini_optim) <- gsub("_0$", "", odeini_optim_parm_names) +#> odeini <- c(odeini_optim, odeini_fixed)[names(mkin_model$diffs)] +#> ode_transparms_optim_names <- setdiff(names(transparms_optim), +#> odeini_optim_parm_names) +#> odeparms_optim <- backtransform_odeparms(transparms_optim[ode_transparms_optim_names], +#> mkin_model, transform_rates = object[[1]]$transform_rates, +#> transform_fractions = object[[1]]$transform_fractions) +#> odeparms <- c(odeparms_optim, odeparms_fixed) +#> xidep_i <- subset(xidep, id == i) +#> if (analytical) { +#> out_values <- mkin_model$deg_func(xidep_i, odeini, +#> odeparms) +#> } +#> else { +#> i_time <- xidep_i$time +#> i_name <- xidep_i$name +#> out_wide <- mkinpredict(mkin_model, odeparms = odeparms, +#> odeini = odeini, solution_type = object[[1]]$solution_type, +#> outtimes = sort(unique(i_time))) +#> out_index <- cbind(as.character(i_time), as.character(i_name)) +#> out_values <- out_wide[out_index] +#> } +#> return(out_values) +#> }, mc.cores = cores) +#> res <- unlist(res_list) +#> return(res) +#> } +#> <bytecode: 0x55555e4213d8> +#> <environment: 0x55555c47cdf0> +#> Nb of parameters: 4 +#> parameter names: parent_0 log_k_parent log_k_A1 f_parent_ilr_1 +#> distribution: +#> Parameter Distribution Estimated +#> [1,] parent_0 normal Estimated +#> [2,] log_k_parent normal Estimated +#> [3,] log_k_A1 normal Estimated +#> [4,] f_parent_ilr_1 normal Estimated +#> Variance-covariance matrix: +#> parent_0 log_k_parent log_k_A1 f_parent_ilr_1 +#> parent_0 1 0 0 0 +#> log_k_parent 0 1 0 0 +#> log_k_A1 0 0 1 0 +#> f_parent_ilr_1 0 0 0 1 +#> Error model: constant , initial values: a.1=1 +#> No covariate in the model. +#> Initial values +#> parent_0 log_k_parent log_k_A1 f_parent_ilr_1 +#> Pop.CondInit 86.53449 -3.207005 -3.060308 -1.920449
    d_saemix <- saemix_data(f_mmkin)
    #> +#> +#> The following SaemixData object was successfully created: +#> +#> Object of class SaemixData +#> longitudinal data for use with the SAEM algorithm +#> Dataset ds_saemix +#> Structured data: value ~ time + name | ds +#> X variable for graphs: time ()
    saemix_options <- list(seed = 123456, + save = FALSE, save.graphs = FALSE, displayProgress = FALSE, + nbiter.saemix = c(200, 80)) +f_saemix <- saemix(m_saemix, d_saemix, saemix_options)
    #> Running main SAEM algorithm +#> [1] "Wed May 27 05:55:50 2020" +#> .. +#> Minimisation finished +#> [1] "Wed May 27 06:01:54 2020"
    #> Nonlinear mixed-effects model fit by the SAEM algorithm +#> ----------------------------------- +#> ---- Data ---- +#> ----------------------------------- +#> Object of class SaemixData +#> longitudinal data for use with the SAEM algorithm +#> Dataset ds_saemix +#> Structured data: value ~ time + name | ds +#> X variable for graphs: time () +#> Dataset characteristics: +#> number of subjects: 5 +#> number of observations: 170 +#> average/min/max nb obs: 34.00 / 30 / 38 +#> First 10 lines of data: +#> ds time name value mdv cens occ ytype +#> 1 Dataset 6 0 parent 97.2 0 0 1 1 +#> 2 Dataset 6 0 parent 96.4 0 0 1 1 +#> 3 Dataset 6 3 parent 71.1 0 0 1 1 +#> 4 Dataset 6 3 parent 69.2 0 0 1 1 +#> 5 Dataset 6 6 parent 58.1 0 0 1 1 +#> 6 Dataset 6 6 parent 56.6 0 0 1 1 +#> 7 Dataset 6 10 parent 44.4 0 0 1 1 +#> 8 Dataset 6 10 parent 43.4 0 0 1 1 +#> 9 Dataset 6 20 parent 33.3 0 0 1 1 +#> 10 Dataset 6 20 parent 29.2 0 0 1 1 +#> ----------------------------------- +#> ---- Model ---- +#> ----------------------------------- +#> Nonlinear mixed-effects model +#> Model function: Mixed model generated from mmkin object Model type: structural +#> function (psi, id, xidep) +#> { +#> uid <- unique(id) +#> res_list <- parallel::mclapply(uid, function(i) { +#> transparms_optim <- psi[i, ] +#> names(transparms_optim) <- names(degparms_optim) +#> odeini_optim <- transparms_optim[odeini_optim_parm_names] +#> names(odeini_optim) <- gsub("_0$", "", odeini_optim_parm_names) +#> odeini <- c(odeini_optim, odeini_fixed)[names(mkin_model$diffs)] +#> ode_transparms_optim_names <- setdiff(names(transparms_optim), +#> odeini_optim_parm_names) +#> odeparms_optim <- backtransform_odeparms(transparms_optim[ode_transparms_optim_names], +#> mkin_model, transform_rates = object[[1]]$transform_rates, +#> transform_fractions = object[[1]]$transform_fractions) +#> odeparms <- c(odeparms_optim, odeparms_fixed) +#> xidep_i <- subset(xidep, id == i) +#> if (analytical) { +#> out_values <- mkin_model$deg_func(xidep_i, odeini, +#> odeparms) +#> } +#> else { +#> i_time <- xidep_i$time +#> i_name <- xidep_i$name +#> out_wide <- mkinpredict(mkin_model, odeparms = odeparms, +#> odeini = odeini, solution_type = object[[1]]$solution_type, +#> outtimes = sort(unique(i_time))) +#> out_index <- cbind(as.character(i_time), as.character(i_name)) +#> out_values <- out_wide[out_index] +#> } +#> return(out_values) +#> }, mc.cores = cores) +#> res <- unlist(res_list) +#> return(res) +#> } +#> <bytecode: 0x55555e4213d8> +#> <environment: 0x55555c47cdf0> +#> Nb of parameters: 4 +#> parameter names: parent_0 log_k_parent log_k_A1 f_parent_ilr_1 +#> distribution: +#> Parameter Distribution Estimated +#> [1,] parent_0 normal Estimated +#> [2,] log_k_parent normal Estimated +#> [3,] log_k_A1 normal Estimated +#> [4,] f_parent_ilr_1 normal Estimated +#> Variance-covariance matrix: +#> parent_0 log_k_parent log_k_A1 f_parent_ilr_1 +#> parent_0 1 0 0 0 +#> log_k_parent 0 1 0 0 +#> log_k_A1 0 0 1 0 +#> f_parent_ilr_1 0 0 0 1 +#> Error model: constant , initial values: a.1=1 +#> No covariate in the model. +#> Initial values +#> parent_0 log_k_parent log_k_A1 f_parent_ilr_1 +#> Pop.CondInit 86.53449 -3.207005 -3.060308 -1.920449 +#> ----------------------------------- +#> ---- Key algorithm options ---- +#> ----------------------------------- +#> Estimation of individual parameters (MAP) +#> Estimation of standard errors and linearised log-likelihood +#> Estimation of log-likelihood by importance sampling +#> Number of iterations: K1=200, K2=80 +#> Number of chains: 10 +#> Seed: 123456 +#> Number of MCMC iterations for IS: 5000 +#> Simulations: +#> nb of simulated datasets used for npde: 1000 +#> nb of simulated datasets used for VPC: 100 +#> Input/output +#> save the results to a file: FALSE +#> save the graphs to files: FALSE +#> ---------------------------------------------------- +#> ---- Results ---- +#> ---------------------------------------------------- +#> ----------------- Fixed effects ------------------ +#> ---------------------------------------------------- +#> Parameter Estimate SE CV(%) +#> [1,] parent_0 86.14 1.61 1.9 +#> [2,] log_k_parent -3.21 0.59 18.5 +#> [3,] log_k_A1 -4.66 0.30 6.4 +#> [4,] f_parent_ilr_1 -0.33 0.30 91.7 +#> [5,] a.1 4.68 0.27 5.8 +#> ---------------------------------------------------- +#> ----------- Variance of random effects ----------- +#> ---------------------------------------------------- +#> Parameter Estimate SE CV(%) +#> parent_0 omega2.parent_0 7.71 8.14 106 +#> log_k_parent omega2.log_k_parent 1.76 1.12 63 +#> log_k_A1 omega2.log_k_A1 0.26 0.26 101 +#> f_parent_ilr_1 omega2.f_parent_ilr_1 0.39 0.28 71 +#> ---------------------------------------------------- +#> ------ Correlation matrix of random effects ------ +#> ---------------------------------------------------- +#> omega2.parent_0 omega2.log_k_parent omega2.log_k_A1 +#> omega2.parent_0 1 0 0 +#> omega2.log_k_parent 0 1 0 +#> omega2.log_k_A1 0 0 1 +#> omega2.f_parent_ilr_1 0 0 0 +#> omega2.f_parent_ilr_1 +#> omega2.parent_0 0 +#> omega2.log_k_parent 0 +#> omega2.log_k_A1 0 +#> omega2.f_parent_ilr_1 1 +#> ---------------------------------------------------- +#> --------------- Statistical criteria ------------- +#> ---------------------------------------------------- +#> Likelihood computed by linearisation +#> -2LL= 1064.364 +#> AIC = 1082.364 +#> BIC = 1078.848 +#> +#> Likelihood computed by importance sampling +#> -2LL= 1063.462 +#> AIC = 1081.462 +#> BIC = 1077.947 +#> ----------------------------------------------------
    plot(f_saemix, plot.type = "convergence")
    #> Plotting convergence plots
    # } +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/schaefer07_complex_case-1.png b/docs/dev/reference/schaefer07_complex_case-1.png new file mode 100644 index 00000000..7cf7484d Binary files /dev/null and b/docs/dev/reference/schaefer07_complex_case-1.png differ diff --git a/docs/dev/reference/schaefer07_complex_case.html b/docs/dev/reference/schaefer07_complex_case.html new file mode 100644 index 00000000..308db2db --- /dev/null +++ b/docs/dev/reference/schaefer07_complex_case.html @@ -0,0 +1,239 @@ + + + + + + + + +Metabolism data set used for checking the software quality of KinGUI — schaefer07_complex_case • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This dataset was used for a comparison of KinGUI and ModelMaker to check the + software quality of KinGUI in the original publication (Schäfer et al., 2007). + The results from the fitting are also included.

    +
    + +
    schaefer07_complex_case
    + + +

    Format

    + +

    The data set is a data frame with 8 observations on the following 6 variables.

    +
    time

    a numeric vector

    +
    parent

    a numeric vector

    +
    A1

    a numeric vector

    +
    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

    +

    References

    + +

    Schäfer D, Mikolasch B, Rainbird P and Harvey B (2007). KinGUI: a new kinetic + software tool for evaluations according to FOCUS degradation kinetics. In: Del + Re AAM, Capri E, Fragoulis G and Trevisan M (Eds.). Proceedings of the XIII + Symposium Pesticide Chemistry, Piacenza, 2007, p. 916-923.

    + +

    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.
    # \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.4479609 0.5520391 +#> +#> $distimes +#> DT50 DT90 +#> parent 13.95078 46.34350 +#> A1 49.75343 165.27733 +#> B1 37.26907 123.80517 +#> C1 11.23131 37.30959 +#> A2 28.50638 94.69614 +#>
    # } + # 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 +#> 4 metabolite A1 degradation rate 0.0139 0.0136 2.2 +#> 5 metabolite A1 DT50 49.9600 50.8900 1.8 +#> 6 metabolite B1 formation fraction 0.1866 0.1818 2.6 +#> 7 metabolite B1 degradation rate 0.0175 0.0172 1.7 +#> 8 metabolite B1 DT50 39.6100 40.2400 1.6 +#> 9 metabolite C1 formation fraction 0.4331 0.4486 3.5 +#> 10 metabolite C1 degradation rate 0.0638 0.0700 8.9 +#> 11 metabolite C1 DT50 10.8700 9.9000 9.8 +#> 12 metabolite A2 formation fraction 0.4529 0.4559 0.7 +#> 13 metabolite A2 degradation rate 0.0245 0.0244 0.4 +#> 14 metabolite A2 DT50 28.2400 28.4500 0.7
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/sigma_twocomp.html b/docs/dev/reference/sigma_twocomp.html new file mode 100644 index 00000000..eac61a11 --- /dev/null +++ b/docs/dev/reference/sigma_twocomp.html @@ -0,0 +1,219 @@ + + + + + + + + +Two-component error model — sigma_twocomp • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Function describing the standard deviation of the measurement error in +dependence of the measured value \(y\):

    +
    + +
    sigma_twocomp(y, sigma_low, rsd_high)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    y

    The magnitude of the observed value

    sigma_low

    The asymptotic minimum of the standard deviation for low +observed values

    rsd_high

    The coefficient describing the increase of the standard +deviation with the magnitude of the observed value

    + +

    Value

    + +

    The standard deviation of the response variable.

    +

    Details

    + +

    $$\sigma = \sqrt{ \sigma_{low}^2 + y^2 * {rsd}_{high}^2}$$ sigma = +sqrt(sigma_low^2 + y^2 * rsd_high^2)

    +

    This is the error model used for example by Werner et al. (1978). The model +proposed by Rocke and Lorenzato (1995) can be written in this form as well, +but assumes approximate lognormal distribution of errors for high values of +y.

    +

    References

    + +

    Werner, Mario, Brooks, Samuel H., and Knott, Lancaster B. (1978) +Additive, Multiplicative, and Mixed Analytical Errors. Clinical Chemistry +24(11), 1895-1898.

    +

    Rocke, David M. and Lorenzato, Stefan (1995) A two-component model for +measurement error in analytical chemistry. Technometrics 37(2), 176-184.

    + +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/summary.mkinfit.html b/docs/dev/reference/summary.mkinfit.html new file mode 100644 index 00000000..99d7d7c4 --- /dev/null +++ b/docs/dev/reference/summary.mkinfit.html @@ -0,0 +1,337 @@ + + + + + + + + +Summary method for class "mkinfit" — summary.mkinfit • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    Lists model equations, initial parameter values, optimised parameters with +some uncertainty statistics, the chi2 error levels calculated according to +FOCUS guidance (2006) as defined therein, formation fractions, DT50 values +and optionally the data, consisting of observed, predicted and residual +values.

    +
    + +
    # S3 method for mkinfit
    +summary(object, data = TRUE, distimes = TRUE, alpha = 0.05, ...)
    +
    +# S3 method for summary.mkinfit
    +print(x, digits = max(3, getOption("digits") - 3), ...)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    object

    an object of class mkinfit.

    data

    logical, indicating whether the data should be included in the +summary.

    distimes

    logical, indicating whether DT50 and DT90 values should be +included.

    alpha

    error level for confidence interval estimation from t +distribution

    ...

    optional arguments passed to methods like print.

    x

    an object of class summary.mkinfit.

    digits

    Number of digits to use for printing

    + +

    Value

    + +

    The summary function returns a list with components, among others

    +
    version, Rversion

    The mkin and R versions used

    +
    date.fit, date.summary

    The dates where the fit and the summary were +produced

    +
    diffs

    The differential equations used in the model

    +
    use_of_ff

    Was maximum or minimum use made of formation fractions

    +
    bpar

    Optimised and backtransformed +parameters

    +
    data

    The data (see Description above).

    +
    start

    The starting values and bounds, if applicable, for optimised +parameters.

    +
    fixed

    The values of fixed parameters.

    +
    errmin

    The chi2 error levels for +each observed variable.

    +
    bparms.ode

    All backtransformed ODE +parameters, for use as starting parameters for related models.

    +
    errparms

    Error model parameters.

    +
    ff

    The estimated formation fractions derived from the fitted +model.

    +
    distimes

    The DT50 and DT90 values for each observed variable.

    +
    SFORB

    If applicable, eigenvalues of SFORB components of the model.

    +The print method is called for its side effect, i.e. printing the summary. + +

    References

    + +

    FOCUS (2006) “Guidance Document on Estimating Persistence +and Degradation Kinetics from Environmental Fate Studies on Pesticides in +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

    + +

    Examples

    +
    + summary(mkinfit(mkinmod(parent = mkinsub("SFO")), FOCUS_2006_A, quiet = TRUE))
    #> mkin version used for fitting: 0.9.50.3 +#> R version used for fitting: 4.0.0 +#> Date of fit: Wed May 27 06:02:05 2020 +#> Date of summary: Wed May 27 06:02:05 2020 +#> +#> Equations: +#> d_parent/dt = - k_parent * parent +#> +#> Model predictions using solution type analytical +#> +#> Fitted using 131 model solutions performed in 0.027 s +#> +#> Error model: Constant variance +#> +#> Error model algorithm: OLS +#> +#> Starting values for parameters to be optimised: +#> value type +#> parent_0 101.24 state +#> k_parent 0.10 deparm +#> +#> Starting values for the transformed parameters actually optimised: +#> value lower upper +#> parent_0 101.240000 -Inf Inf +#> log_k_parent -2.302585 -Inf Inf +#> +#> Fixed parameter values: +#> None +#> +#> Results: +#> +#> AIC BIC logLik +#> 55.28197 55.5203 -24.64099 +#> +#> Optimised, transformed parameters with symmetric confidence intervals: +#> Estimate Std. Error Lower Upper +#> parent_0 109.200 3.70400 99.630 118.700 +#> log_k_parent -3.291 0.09176 -3.527 -3.055 +#> sigma 5.266 1.31600 1.882 8.649 +#> +#> Parameter correlation: +#> parent_0 log_k_parent sigma +#> parent_0 1.000e+00 5.428e-01 1.648e-07 +#> log_k_parent 5.428e-01 1.000e+00 2.513e-07 +#> sigma 1.648e-07 2.513e-07 1.000e+00 +#> +#> Backtransformed parameters: +#> Confidence intervals for internally transformed parameters are asymmetric. +#> t-test (unrealistically) based on the assumption of normal distribution +#> for estimators of untransformed parameters. +#> Estimate t value Pr(>t) Lower Upper +#> parent_0 109.20000 29.47 4.218e-07 99.6300 118.70000 +#> k_parent 0.03722 10.90 5.650e-05 0.0294 0.04712 +#> sigma 5.26600 4.00 5.162e-03 1.8820 8.64900 +#> +#> FOCUS Chi2 error levels in percent: +#> err.min n.optim df +#> All data 8.385 2 6 +#> parent 8.385 2 6 +#> +#> Estimated disappearance times: +#> DT50 DT90 +#> parent 18.62 61.87 +#> +#> Data: +#> time variable observed predicted residual +#> 0 parent 101.24 109.153 -7.9132 +#> 3 parent 99.27 97.622 1.6484 +#> 7 parent 90.11 84.119 5.9913 +#> 14 parent 72.19 64.826 7.3641 +#> 30 parent 29.71 35.738 -6.0283 +#> 62 parent 5.98 10.862 -4.8818 +#> 90 parent 1.54 3.831 -2.2911 +#> 118 parent 0.39 1.351 -0.9613
    +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/synthetic_data_for_UBA_2014-1.png b/docs/dev/reference/synthetic_data_for_UBA_2014-1.png new file mode 100644 index 00000000..02976ced Binary files /dev/null and b/docs/dev/reference/synthetic_data_for_UBA_2014-1.png differ diff --git a/docs/dev/reference/synthetic_data_for_UBA_2014.html b/docs/dev/reference/synthetic_data_for_UBA_2014.html new file mode 100644 index 00000000..da4af114 --- /dev/null +++ b/docs/dev/reference/synthetic_data_for_UBA_2014.html @@ -0,0 +1,470 @@ + + + + + + + + +Synthetic datasets for one parent compound with two metabolites — synthetic_data_for_UBA_2014 • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    The 12 datasets were generated using four different models and three different + variance components. The four models are either the SFO or the DFOP model with either + two sequential or two parallel metabolites.

    +

    Variance component 'a' is based on a normal distribution with standard deviation of 3, + Variance component 'b' is also based on a normal distribution, but with a standard deviation of 7. + Variance component 'c' is based on the error model from Rocke and Lorenzato (1995), with the + minimum standard deviation (for small y values) of 0.5, and a proportionality constant of 0.07 + for the increase of the standard deviation with y. Note that this is a simplified version + of the error model proposed by Rocke and Lorenzato (1995), as in their model the error of the + measured values approximates lognormal distribution for high values, whereas we are using + normally distributed error components all along.

    +

    Initial concentrations for metabolites and all values where adding the variance component resulted + in a value below the assumed limit of detection of 0.1 were set to NA.

    +

    As an example, the first dataset has the title SFO_lin_a and is based on the SFO model + with two sequential metabolites (linear pathway), with added variance component 'a'.

    +

    Compare also the code in the example section to see the degradation models.

    +
    + +
    synthetic_data_for_UBA_2014
    + + +

    Format

    + +

    A list containing twelve datasets as an R6 class defined by mkinds, + 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

    + +

    Ranke (2014) Prüfung und Validierung von Modellierungssoftware als Alternative + zu ModelMaker 4.0, Umweltbundesamt Projektnummer 27452

    +

    Rocke, David M. und Lorenzato, Stefan (1995) A two-component model for + measurement error in analytical chemistry. Technometrics 37(2), 176-184.

    + +

    Examples

    +
    # \dontrun{ +# The data have been generated using the following kinetic models +m_synth_SFO_lin <- mkinmod(parent = list(type = "SFO", to = "M1"), + M1 = list(type = "SFO", to = "M2"), + M2 = list(type = "SFO"), use_of_ff = "max")
    #> Successfully compiled differential equation model from auto-generated C code.
    + +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")
    #> Successfully compiled differential equation model from auto-generated C code.
    +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")
    #> Successfully compiled differential equation model from auto-generated C code.
    +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")
    #> Successfully compiled differential equation model from auto-generated C code.
    +# 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")) + +# Original function used or 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 %in% c("M1", "M2"), "value"] <- 0 +# 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)
    #> mkin version used for fitting: 0.9.50.3 +#> R version used for fitting: 4.0.0 +#> Date of fit: Wed May 27 06:02:14 2020 +#> Date of summary: Wed May 27 06:02:14 2020 +#> +#> Equations: +#> d_parent/dt = - k_parent * parent +#> d_M1/dt = + f_parent_to_M1 * k_parent * parent - k_M1 * M1 +#> d_M2/dt = + f_M1_to_M2 * k_M1 * M1 - k_M2 * M2 +#> +#> Model predictions using solution type deSolve +#> +#> Fitted using 817 model solutions performed in 0.623 s +#> +#> Error model: Constant variance +#> +#> Error model algorithm: OLS +#> +#> Starting values for parameters to be optimised: +#> value type +#> parent_0 101.3500 state +#> k_parent 0.1000 deparm +#> k_M1 0.1001 deparm +#> k_M2 0.1002 deparm +#> f_parent_to_M1 0.5000 deparm +#> f_M1_to_M2 0.5000 deparm +#> +#> Starting values for the transformed parameters actually optimised: +#> value lower upper +#> parent_0 101.350000 -Inf Inf +#> log_k_parent -2.302585 -Inf Inf +#> log_k_M1 -2.301586 -Inf Inf +#> log_k_M2 -2.300587 -Inf Inf +#> f_parent_ilr_1 0.000000 -Inf Inf +#> f_M1_ilr_1 0.000000 -Inf Inf +#> +#> Fixed parameter values: +#> value type +#> M1_0 0 state +#> M2_0 0 state +#> +#> Results: +#> +#> AIC BIC logLik +#> 188.7274 200.3723 -87.36368 +#> +#> Optimised, transformed parameters with symmetric confidence intervals: +#> Estimate Std. Error Lower Upper +#> parent_0 102.1000 1.57000 98.8600 105.3000 +#> log_k_parent -0.3020 0.03885 -0.3812 -0.2229 +#> log_k_M1 -1.2070 0.07123 -1.3520 -1.0620 +#> log_k_M2 -3.9010 0.06571 -4.0350 -3.7670 +#> f_parent_ilr_1 0.8492 0.16640 0.5103 1.1880 +#> f_M1_ilr_1 0.6780 0.17600 0.3196 1.0360 +#> sigma 2.2730 0.25740 1.7490 2.7970 +#> +#> Parameter correlation: +#> parent_0 log_k_parent log_k_M1 log_k_M2 f_parent_ilr_1 +#> parent_0 1.000e+00 3.933e-01 -1.605e-01 2.819e-02 -4.624e-01 +#> log_k_parent 3.933e-01 1.000e+00 -4.082e-01 7.166e-02 -5.682e-01 +#> log_k_M1 -1.605e-01 -4.082e-01 1.000e+00 -3.929e-01 7.478e-01 +#> log_k_M2 2.819e-02 7.166e-02 -3.929e-01 1.000e+00 -2.658e-01 +#> f_parent_ilr_1 -4.624e-01 -5.682e-01 7.478e-01 -2.658e-01 1.000e+00 +#> f_M1_ilr_1 1.614e-01 4.102e-01 -8.109e-01 5.419e-01 -8.605e-01 +#> sigma -1.384e-07 -2.581e-07 9.499e-08 1.518e-07 1.236e-07 +#> f_M1_ilr_1 sigma +#> parent_0 1.614e-01 -1.384e-07 +#> log_k_parent 4.102e-01 -2.581e-07 +#> log_k_M1 -8.109e-01 9.499e-08 +#> log_k_M2 5.419e-01 1.518e-07 +#> f_parent_ilr_1 -8.605e-01 1.236e-07 +#> f_M1_ilr_1 1.000e+00 8.795e-09 +#> sigma 8.795e-09 1.000e+00 +#> +#> Backtransformed parameters: +#> Confidence intervals for internally transformed parameters are asymmetric. +#> t-test (unrealistically) based on the assumption of normal distribution +#> for estimators of untransformed parameters. +#> Estimate t value Pr(>t) Lower Upper +#> parent_0 102.10000 65.000 7.281e-36 98.86000 105.30000 +#> k_parent 0.73930 25.740 2.948e-23 0.68310 0.80020 +#> k_M1 0.29920 14.040 1.577e-15 0.25880 0.34590 +#> k_M2 0.02023 15.220 1.653e-16 0.01769 0.02312 +#> f_parent_to_M1 0.76870 18.370 7.295e-19 0.67300 0.84290 +#> f_M1_to_M2 0.72290 14.500 6.418e-16 0.61110 0.81240 +#> sigma 2.27300 8.832 2.161e-10 1.74900 2.79700 +#> +#> FOCUS Chi2 error levels in percent: +#> err.min n.optim df +#> All data 8.454 6 17 +#> parent 8.660 2 6 +#> M1 10.583 2 5 +#> M2 3.586 2 6 +#> +#> Resulting formation fractions: +#> ff +#> parent_M1 0.7687 +#> parent_sink 0.2313 +#> M1_M2 0.7229 +#> M1_sink 0.2771 +#> +#> Estimated disappearance times: +#> DT50 DT90 +#> parent 0.9376 3.114 +#> M1 2.3170 7.697 +#> M2 34.2689 113.839 +#> +#> Data: +#> time variable observed predicted residual +#> 0 parent 101.5 1.021e+02 -0.56248 +#> 0 parent 101.2 1.021e+02 -0.86248 +#> 1 parent 53.9 4.873e+01 5.17118 +#> 1 parent 47.5 4.873e+01 -1.22882 +#> 3 parent 10.4 1.111e+01 -0.70773 +#> 3 parent 7.6 1.111e+01 -3.50773 +#> 7 parent 1.1 5.772e-01 0.52283 +#> 7 parent 0.3 5.772e-01 -0.27717 +#> 14 parent 3.5 3.264e-03 3.49674 +#> 28 parent 3.2 1.045e-07 3.20000 +#> 90 parent 0.6 9.535e-10 0.60000 +#> 120 parent 3.5 -5.941e-10 3.50000 +#> 1 M1 36.4 3.479e+01 1.61088 +#> 1 M1 37.4 3.479e+01 2.61088 +#> 3 M1 34.3 3.937e+01 -5.07027 +#> 3 M1 39.8 3.937e+01 0.42973 +#> 7 M1 15.1 1.549e+01 -0.38715 +#> 7 M1 17.8 1.549e+01 2.31285 +#> 14 M1 5.8 1.995e+00 3.80469 +#> 14 M1 1.2 1.995e+00 -0.79531 +#> 60 M1 0.5 2.111e-06 0.50000 +#> 90 M1 3.2 -9.676e-10 3.20000 +#> 120 M1 1.5 7.671e-10 1.50000 +#> 120 M1 0.6 7.671e-10 0.60000 +#> 1 M2 4.8 4.455e+00 0.34517 +#> 3 M2 20.9 2.153e+01 -0.62527 +#> 3 M2 19.3 2.153e+01 -2.22527 +#> 7 M2 42.0 4.192e+01 0.07941 +#> 7 M2 43.1 4.192e+01 1.17941 +#> 14 M2 49.4 4.557e+01 3.83353 +#> 14 M2 44.3 4.557e+01 -1.26647 +#> 28 M2 34.6 3.547e+01 -0.87275 +#> 28 M2 33.0 3.547e+01 -2.47275 +#> 60 M2 18.8 1.858e+01 0.21837 +#> 60 M2 17.6 1.858e+01 -0.98163 +#> 90 M2 10.6 1.013e+01 0.47130 +#> 90 M2 10.8 1.013e+01 0.67130 +#> 120 M2 9.8 5.521e+00 4.27893 +#> 120 M2 3.3 5.521e+00 -2.22107
    # } +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/test_data_from_UBA_2014-1.png b/docs/dev/reference/test_data_from_UBA_2014-1.png new file mode 100644 index 00000000..431181cf Binary files /dev/null and b/docs/dev/reference/test_data_from_UBA_2014-1.png differ diff --git a/docs/dev/reference/test_data_from_UBA_2014-2.png b/docs/dev/reference/test_data_from_UBA_2014-2.png new file mode 100644 index 00000000..4a064163 Binary files /dev/null and b/docs/dev/reference/test_data_from_UBA_2014-2.png differ diff --git a/docs/dev/reference/test_data_from_UBA_2014.html b/docs/dev/reference/test_data_from_UBA_2014.html new file mode 100644 index 00000000..291e3959 --- /dev/null +++ b/docs/dev/reference/test_data_from_UBA_2014.html @@ -0,0 +1,251 @@ + + + + + + + + +Three experimental datasets from two water sediment systems and one soil — test_data_from_UBA_2014 • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    The datasets were used for the comparative validation of several kinetic evaluation + software packages (Ranke, 2014).

    +
    + +
    test_data_from_UBA_2014
    + + +

    Format

    + +

    A list containing three datasets as an R6 class defined by mkinds. + 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

    + +

    Ranke (2014) Prüfung und Validierung von Modellierungssoftware als Alternative + zu ModelMaker 4.0, Umweltbundesamt Projektnummer 27452

    + +

    Examples

    +
    # \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 + # large parameter correlations, among other reasons (e.g. the adequacy of the + # 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
    #> Warning: Could not calculate correlation; no covariance matrix
    #> Estimate se_notrans t value Pr(>t) Lower Upper +#> parent_w_0 95.91998116 NA NA NA NA NA +#> k_parent_w 0.41145375 NA NA NA NA NA +#> k_parent_s 0.04663944 NA NA NA NA NA +#> f_parent_w_to_parent_s 0.12467894 NA NA NA NA NA +#> f_parent_s_to_parent_w 0.50000000 NA NA NA NA NA +#> sigma 3.13612618 NA NA NA NA NA
    mkinerrmin(f_river)
    #> err.min n.optim df +#> All data 0.1090929 5 6 +#> parent_w 0.0817436 3 3 +#> parent_s 0.1619965 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")), + 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 +#> parent_0 76.55425584 0.859186419 89.1008681 1.113862e-26 74.755958720 +#> k_parent 0.12081956 0.004601919 26.2541703 1.077361e-16 0.111561576 +#> k_M1 0.84258629 0.806165149 1.0451783 1.545282e-01 0.113778910 +#> k_M2 0.04210878 0.017083049 2.4649452 1.170195e-02 0.018013823 +#> k_M3 0.01122919 0.007245870 1.5497364 6.885076e-02 0.002909418 +#> f_parent_to_M1 0.32240193 0.240785518 1.3389590 9.819221e-02 NA +#> f_parent_to_M2 0.16099854 0.033691991 4.7785404 6.531224e-05 NA +#> f_M1_to_M3 0.27921506 0.269425582 1.0363346 1.565282e-01 0.022977955 +#> f_M2_to_M3 0.55641331 0.595121774 0.9349571 1.807710e-01 0.008002320 +#> sigma 1.14005399 0.149696423 7.6157731 1.727024e-07 0.826735778 +#> Upper +#> parent_0 78.35255297 +#> k_parent 0.13084582 +#> k_M1 6.23974738 +#> k_M2 0.09843271 +#> k_M3 0.04334017 +#> f_parent_to_M1 NA +#> f_parent_to_M2 NA +#> f_M1_to_M3 0.86450905 +#> f_M2_to_M3 0.99489911 +#> sigma 1.45337221
    mkinerrmin(f_soil)
    #> err.min n.optim df +#> All data 0.09649963 9 20 +#> parent 0.04721283 2 6 +#> M1 0.26551208 2 5 +#> M2 0.20327575 2 5 +#> M3 0.05196550 3 4
    # } +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/transform_odeparms.html b/docs/dev/reference/transform_odeparms.html new file mode 100644 index 00000000..d0858eda --- /dev/null +++ b/docs/dev/reference/transform_odeparms.html @@ -0,0 +1,319 @@ + + + + + + + + +Functions to transform and backtransform kinetic parameters for fitting — transform_odeparms • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    The transformations are intended to map parameters that should only take on +restricted values to the full scale of real numbers. For kinetic rate +constants and other parameters that can only take on positive values, a +simple log transformation is used. For compositional parameters, such as the +formations fractions that should always sum up to 1 and can not be negative, +the ilr transformation is used.

    +
    + +
    transform_odeparms(
    +  parms,
    +  mkinmod,
    +  transform_rates = TRUE,
    +  transform_fractions = TRUE
    +)
    +
    +backtransform_odeparms(
    +  transparms,
    +  mkinmod,
    +  transform_rates = TRUE,
    +  transform_fractions = TRUE
    +)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + +
    parms

    Parameters of kinetic models as used in the differential +equations.

    mkinmod

    The kinetic model of class mkinmod, containing +the names of the model variables that are needed for grouping the +formation fractions before ilr transformation, the parameter +names and the information if the pathway to sink is included in the model.

    transform_rates

    Boolean specifying if kinetic rate constants should +be transformed in the model specification used in the fitting for better +compliance with the assumption of normal distribution of the estimator. If +TRUE, also alpha and beta parameters of the FOMC model are +log-transformed, as well as k1 and k2 rate constants for the DFOP and HS +models and the break point tb of the HS model.

    transform_fractions

    Boolean specifying if formation fractions +constants should be transformed in the model specification used in the +fitting for better compliance with the assumption of normal distribution +of the estimator. The default (TRUE) is to do transformations. The g +parameter of the DFOP and HS models are also transformed, as they can also +be seen as compositional data. The transformation used for these +transformations is the ilr transformation.

    transparms

    Transformed parameters of kinetic models as used in the +fitting procedure.

    + +

    Value

    + +

    A vector of transformed or backtransformed parameters

    +

    Details

    + +

    The transformation of sets of formation fractions is fragile, as it supposes +the same ordering of the components in forward and backward transformation. +This is no problem for the internal use in mkinfit.

    + +

    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) +# Transformed and backtransformed parameters +print(fit.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.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
    +# \dontrun{ +# Compare to the version without transforming rate parameters +fit.2 <- mkinfit(SFO_SFO, FOCUS_2006_D, transform_rates = FALSE, quiet = TRUE)
    #> Warning: Observations with value of zero were removed from the data
    #> Error in if (cost < cost.current) { assign("cost.current", cost, inherits = TRUE) if (!quiet) cat(ifelse(OLS, "Sum of squared residuals", "Negative log-likelihood"), " at call ", calls, ": ", cost.current, "\n", sep = "")}: missing value where TRUE/FALSE needed
    #> Timing stopped at: 0.003 0 0.003
    fit.2.s <- summary(fit.2)
    #> Error in summary(fit.2): object 'fit.2' not found
    print(fit.2.s$par, 3)
    #> Error in print(fit.2.s$par, 3): object 'fit.2.s' not found
    print(fit.2.s$bpar, 3)
    #> Error in print(fit.2.s$bpar, 3): object 'fit.2.s' not found
    # } + +initials <- fit$start$value +names(initials) <- rownames(fit$start) +transformed <- fit$start_transformed$value +names(transformed) <- rownames(fit$start_transformed) +transform_odeparms(initials, SFO_SFO)
    #> parent_0 log_k_parent log_k_m1 f_parent_ilr_1 +#> 100.750000 -2.302585 -2.301586 0.000000
    backtransform_odeparms(transformed, SFO_SFO)
    #> parent_0 k_parent k_m1 f_parent_to_m1 +#> 100.7500 0.1000 0.1001 0.5000
    +# \dontrun{ +# The case of formation fractions +SFO_SFO.ff <- mkinmod( + 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 +#> 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 +#> 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) +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"), + 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 +#> 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 +#> 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
    # } + +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/reference/update.mkinfit-1.png b/docs/dev/reference/update.mkinfit-1.png new file mode 100644 index 00000000..4cbefa56 Binary files /dev/null and b/docs/dev/reference/update.mkinfit-1.png differ diff --git a/docs/dev/reference/update.mkinfit-2.png b/docs/dev/reference/update.mkinfit-2.png new file mode 100644 index 00000000..f432f6f8 Binary files /dev/null and b/docs/dev/reference/update.mkinfit-2.png differ diff --git a/docs/dev/reference/update.mkinfit.html b/docs/dev/reference/update.mkinfit.html new file mode 100644 index 00000000..d6363edf --- /dev/null +++ b/docs/dev/reference/update.mkinfit.html @@ -0,0 +1,214 @@ + + + + + + + + +Update an mkinfit model with different arguments — update.mkinfit • mkin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + +
    + +
    +
    + + +
    +

    This function will return an updated mkinfit object. The fitted degradation +model parameters from the old fit are used as starting values for the +updated fit. Values specified as 'parms.ini' and/or 'state.ini' will +override these starting values.

    +
    + +
    # S3 method for mkinfit
    +update(object, ..., evaluate = TRUE)
    + +

    Arguments

    + + + + + + + + + + + + + + +
    object

    An mkinfit object to be updated

    ...

    Arguments to mkinfit that should replace +the arguments from the original call. Arguments set to NULL will +remove arguments given in the original call

    evaluate

    Should the call be evaluated or returned as a call

    + + +

    Examples

    +
    # \dontrun{ +fit <- mkinfit("SFO", subset(FOCUS_2006_D, value != 0), quiet = TRUE) +parms(fit)
    #> parent_0 k_parent_sink sigma +#> 99.44423886 0.09793574 3.39632469
    fit_2 <- update(fit, error_model = "tc") +parms(fit_2)
    #> parent_0 k_parent_sink sigma_low rsd_high +#> 1.008549e+02 1.005665e-01 3.752222e-03 6.763434e-02
    plot_err(fit_2)
    # } +
    +
    + +
    + + +
    + + +
    +

    Site built with pkgdown 1.5.1.

    +
    + +
    +
    + + + + + + + + diff --git a/docs/dev/sitemap.xml b/docs/dev/sitemap.xml new file mode 100644 index 00000000..e284abf6 --- /dev/null +++ b/docs/dev/sitemap.xml @@ -0,0 +1,222 @@ + + + + https://pkgdown.jrwb.de/mkin/index.html + + + https://pkgdown.jrwb.de/mkin/reference/AIC.mmkin.html + + + https://pkgdown.jrwb.de/mkin/reference/CAKE_export.html + + + https://pkgdown.jrwb.de/mkin/reference/DFOP.solution.html + + + https://pkgdown.jrwb.de/mkin/reference/Extract.mmkin.html + + + https://pkgdown.jrwb.de/mkin/reference/FOCUS_2006_DFOP_ref_A_to_B.html + + + https://pkgdown.jrwb.de/mkin/reference/FOCUS_2006_FOMC_ref_A_to_F.html + + + https://pkgdown.jrwb.de/mkin/reference/FOCUS_2006_HS_ref_A_to_F.html + + + https://pkgdown.jrwb.de/mkin/reference/FOCUS_2006_SFO_ref_A_to_F.html + + + https://pkgdown.jrwb.de/mkin/reference/FOCUS_2006_datasets.html + + + https://pkgdown.jrwb.de/mkin/reference/FOMC.solution.html + + + https://pkgdown.jrwb.de/mkin/reference/HS.solution.html + + + https://pkgdown.jrwb.de/mkin/reference/IORE.solution.html + + + https://pkgdown.jrwb.de/mkin/reference/NAFTA_SOP_2015.html + + + https://pkgdown.jrwb.de/mkin/reference/NAFTA_SOP_Attachment.html + + + https://pkgdown.jrwb.de/mkin/reference/SFO.solution.html + + + https://pkgdown.jrwb.de/mkin/reference/SFORB.solution.html + + + https://pkgdown.jrwb.de/mkin/reference/add_err.html + + + https://pkgdown.jrwb.de/mkin/reference/aw.html + + + https://pkgdown.jrwb.de/mkin/reference/confint.mkinfit.html + + + https://pkgdown.jrwb.de/mkin/reference/create_deg_func.html + + + https://pkgdown.jrwb.de/mkin/reference/endpoints.html + + + https://pkgdown.jrwb.de/mkin/reference/experimental_data_for_UBA.html + + + https://pkgdown.jrwb.de/mkin/reference/get_deg_func.html + + + https://pkgdown.jrwb.de/mkin/reference/ilr.html + + + https://pkgdown.jrwb.de/mkin/reference/loftest.html + + + https://pkgdown.jrwb.de/mkin/reference/logLik.mkinfit.html + + + https://pkgdown.jrwb.de/mkin/reference/logistic.solution.html + + + https://pkgdown.jrwb.de/mkin/reference/lrtest.mkinfit.html + + + https://pkgdown.jrwb.de/mkin/reference/max_twa_parent.html + + + https://pkgdown.jrwb.de/mkin/reference/mccall81_245T.html + + + https://pkgdown.jrwb.de/mkin/reference/mkin_long_to_wide.html + + + https://pkgdown.jrwb.de/mkin/reference/mkin_wide_to_long.html + + + https://pkgdown.jrwb.de/mkin/reference/mkinds.html + + + https://pkgdown.jrwb.de/mkin/reference/mkinerrmin.html + + + https://pkgdown.jrwb.de/mkin/reference/mkinerrplot.html + + + https://pkgdown.jrwb.de/mkin/reference/mkinfit.html + + + https://pkgdown.jrwb.de/mkin/reference/mkinmod.html + + + https://pkgdown.jrwb.de/mkin/reference/mkinparplot.html + + + https://pkgdown.jrwb.de/mkin/reference/mkinplot.html + + + https://pkgdown.jrwb.de/mkin/reference/mkinpredict.html + + + https://pkgdown.jrwb.de/mkin/reference/mkinresplot.html + + + https://pkgdown.jrwb.de/mkin/reference/mkinsub.html + + + https://pkgdown.jrwb.de/mkin/reference/mmkin.html + + + https://pkgdown.jrwb.de/mkin/reference/nafta.html + + + https://pkgdown.jrwb.de/mkin/reference/nlme.html + + + https://pkgdown.jrwb.de/mkin/reference/nlme.mmkin.html + + + https://pkgdown.jrwb.de/mkin/reference/nobs.mkinfit.html + + + https://pkgdown.jrwb.de/mkin/reference/parms.html + + + https://pkgdown.jrwb.de/mkin/reference/plot.mkinfit.html + + + https://pkgdown.jrwb.de/mkin/reference/plot.mmkin.html + + + https://pkgdown.jrwb.de/mkin/reference/plot.nafta.html + + + https://pkgdown.jrwb.de/mkin/reference/plot.nlme.mmkin.html + + + https://pkgdown.jrwb.de/mkin/reference/print.mkinds.html + + + https://pkgdown.jrwb.de/mkin/reference/print.mkinmod.html + + + https://pkgdown.jrwb.de/mkin/reference/reexports.html + + + https://pkgdown.jrwb.de/mkin/reference/residuals.mkinfit.html + + + https://pkgdown.jrwb.de/mkin/reference/saemix.html + + + https://pkgdown.jrwb.de/mkin/reference/schaefer07_complex_case.html + + + https://pkgdown.jrwb.de/mkin/reference/sigma_twocomp.html + + + https://pkgdown.jrwb.de/mkin/reference/summary.mkinfit.html + + + https://pkgdown.jrwb.de/mkin/reference/synthetic_data_for_UBA_2014.html + + + https://pkgdown.jrwb.de/mkin/reference/test_data_from_UBA_2014.html + + + https://pkgdown.jrwb.de/mkin/reference/transform_odeparms.html + + + https://pkgdown.jrwb.de/mkin/reference/update.mkinfit.html + + + https://pkgdown.jrwb.de/mkin/articles/FOCUS_D.html + + + https://pkgdown.jrwb.de/mkin/articles/FOCUS_L.html + + + https://pkgdown.jrwb.de/mkin/articles/mkin.html + + + https://pkgdown.jrwb.de/mkin/articles/twa.html + + + https://pkgdown.jrwb.de/mkin/articles/web_only/FOCUS_Z.html + + + https://pkgdown.jrwb.de/mkin/articles/web_only/NAFTA_examples.html + + + https://pkgdown.jrwb.de/mkin/articles/web_only/benchmarks.html + + + https://pkgdown.jrwb.de/mkin/articles/web_only/compiled_models.html + + diff --git a/vignettes/web_only/mkin_benchmarks.rda b/vignettes/web_only/mkin_benchmarks.rda index a95680c0..c38cd1ea 100644 Binary files a/vignettes/web_only/mkin_benchmarks.rda and b/vignettes/web_only/mkin_benchmarks.rda differ -- cgit v1.2.1