aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-05-13 16:20:23 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2020-05-13 16:20:23 +0200
commit218a9c55bd80fb708b15fa7196422f759bfe4b27 (patch)
treead4b2aa4b561b3118d1ca8ee5e6b34fbd2dfcfe8
parent36bc31c52cbe4b686f5562e21ee110380481dff8 (diff)
Further formatting improvement of benchmark vignette
Also, use .rmd extension instead of .Rmd for vignettes.
-rw-r--r--GNUmakefile10
-rw-r--r--docs/articles/web_only/benchmarks.html146
-rw-r--r--docs/pkgdown.yml2
-rw-r--r--vignettes/FOCUS_D.rmd (renamed from vignettes/FOCUS_D.Rmd)146
-rw-r--r--vignettes/FOCUS_L.rmd (renamed from vignettes/FOCUS_L.Rmd)542
-rw-r--r--vignettes/mkin.rmd (renamed from vignettes/mkin.Rmd)0
-rw-r--r--vignettes/twa.rmd (renamed from vignettes/twa.Rmd)0
-rw-r--r--vignettes/web_only/FOCUS_Z.rmd (renamed from vignettes/web_only/FOCUS_Z.Rmd)0
-rw-r--r--vignettes/web_only/NAFTA_examples.rmd (renamed from vignettes/web_only/NAFTA_examples.Rmd)0
-rw-r--r--vignettes/web_only/benchmarks.html136
-rw-r--r--vignettes/web_only/benchmarks.rmd (renamed from vignettes/web_only/benchmarks.Rmd)39
-rw-r--r--vignettes/web_only/compiled_models.rmd (renamed from vignettes/web_only/compiled_models.Rmd)282
-rw-r--r--vignettes/web_only/mkin_benchmarks.rdabin854 -> 854 bytes
13 files changed, 631 insertions, 672 deletions
diff --git a/GNUmakefile b/GNUmakefile
index abc115af..d2476218 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -89,15 +89,15 @@ testcheck: test check
README.html: README.md
"$(RBIN)/Rscript" -e "rmarkdown::render('README.md', output_format = 'html_document', output_options = list(mathjax = NULL))"
-vignettes/%.html: vignettes/mkin_vignettes.css vignettes/references.bib vignettes/%.Rmd
- "$(RBIN)/Rscript" -e "tools::buildVignette(file = 'vignettes/$*.Rmd', dir = 'vignettes')"
+vignettes/%.html: vignettes/mkin_vignettes.css vignettes/references.bib vignettes/%.rmd
+ "$(RBIN)/Rscript" -e "tools::buildVignette(file = 'vignettes/$*.rmd', dir = 'vignettes')"
vignettes: vignettes/mkin.html vignettes/FOCUS_D.html vignettes/FOCUS_L.html vignettes/twa.html
-vignettes/web_only/%.html: vignettes/references.bib vignettes/web_only/%.Rmd
- "$(RBIN)/Rscript" -e "tools::buildVignette(file = 'vignettes/web_only/$*.Rmd', dir = 'vignettes/web_only')"
+vignettes/web_only/%.html: vignettes/references.bib vignettes/web_only/%.rmd
+ "$(RBIN)/Rscript" -e "tools::buildVignette(file = 'vignettes/web_only/$*.rmd', dir = 'vignettes/web_only')"
-articles: vignettes/web_only/FOCUS_Z.html vignettes/web_only/compiled_models.html
+articles: vignettes/web_only/FOCUS_Z.html vignettes/web_only/compiled_models.html vignettes/web_only/benchmarks.html
pd: roxygen
"$(RBIN)/Rscript" -e "pkgdown::build_site(run_dont_run = TRUE, lazy = TRUE)"
diff --git a/docs/articles/web_only/benchmarks.html b/docs/articles/web_only/benchmarks.html
index b0bb5196..202ec25f 100644
--- a/docs/articles/web_only/benchmarks.html
+++ b/docs/articles/web_only/benchmarks.html
@@ -100,38 +100,21 @@
<h1 data-toc-skip>Benchmark timings for mkin</h1>
<h4 class="author">Johannes Ranke</h4>
- <h4 class="date">2020-05-12</h4>
+ <h4 class="date">2020-05-13</h4>
- <small class="dont-index">Source: <a href="http://github.com/jranke/mkin/blob/master/vignettes/web_only/benchmarks.Rmd"><code>vignettes/web_only/benchmarks.Rmd</code></a></small>
- <div class="hidden name"><code>benchmarks.Rmd</code></div>
+ <small class="dont-index">Source: <a href="http://github.com/jranke/mkin/blob/master/vignettes/web_only/benchmarks.rmd"><code>vignettes/web_only/benchmarks.rmd</code></a></small>
+ <div class="hidden name"><code>benchmarks.rmd</code></div>
</div>
-<p>Each system is characterized by its CPU type, the operating system type and the mkin version. Currently only values for one system are available.</p>
-<div class="sourceCode" id="cb1"><html><body><pre class="r"><span class="no">cpu_model</span> <span class="kw">&lt;-</span> <span class="kw pkg">benchmarkme</span><span class="kw ns">::</span><span class="fu"><a href="https://rdrr.io/pkg/benchmarkme/man/get_cpu.html">get_cpu</a></span>()$<span class="no">model_name</span>
-<span class="no">operating_system</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/Sys.info.html">Sys.info</a></span>()<span class="kw">[[</span><span class="st">"sysname"</span>]]
-<span class="no">mkin_version</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/character.html">as.character</a></span>(<span class="fu"><a href="https://rdrr.io/r/utils/packageDescription.html">packageVersion</a></span>(<span class="st">"mkin"</span>))
-<span class="no">system_string</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/paste.html">paste0</a></span>(<span class="no">operating_system</span>, <span class="st">", "</span>, <span class="no">cpu_model</span>, <span class="st">", mkin version "</span>, <span class="no">mkin_version</span>)
-<span class="fu"><a href="https://rdrr.io/r/base/load.html">load</a></span>(<span class="st">"~/git/mkin/vignettes/web_only/mkin_benchmarks.rda"</span>)
-<span class="no">mkin_benchmarks</span>[<span class="no">system_string</span>, <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"CPU"</span>, <span class="st">"OS"</span>, <span class="st">"mkin"</span>)] <span class="kw">&lt;-</span>
- <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="no">cpu_model</span>, <span class="no">operating_system</span>, <span class="no">mkin_version</span>)
-
-<span class="kw">if</span> (<span class="no">mkin_version</span> <span class="kw">&gt;</span> <span class="st">"0.9.48.1"</span>) {
- <span class="no">mmkin_bench</span> <span class="kw">&lt;-</span> <span class="kw">function</span>(<span class="no">models</span>, <span class="no">datasets</span>, <span class="no">error_model</span> <span class="kw">=</span> <span class="st">"const"</span>) {
- <span class="fu"><a href="../../reference/mmkin.html">mmkin</a></span>(<span class="no">models</span>, <span class="no">datasets</span>, <span class="kw">error_model</span> <span class="kw">=</span> <span class="no">error_model</span>, <span class="kw">cores</span> <span class="kw">=</span> <span class="fl">1</span>, <span class="kw">quiet</span> <span class="kw">=</span> <span class="fl">TRUE</span>)
- }
-} <span class="kw">else</span> {
- <span class="no">mmkin_bench</span> <span class="kw">&lt;-</span> <span class="kw">function</span>(<span class="no">models</span>, <span class="no">datasets</span>, <span class="no">error_model</span> <span class="kw">=</span> <span class="kw">NULL</span>) {
- <span class="fu"><a href="../../reference/mmkin.html">mmkin</a></span>(<span class="no">models</span>, <span class="no">datasets</span>, <span class="kw">reweight.method</span> <span class="kw">=</span> <span class="no">error_model</span>, <span class="kw">cores</span> <span class="kw">=</span> <span class="fl">1</span>, <span class="kw">quiet</span> <span class="kw">=</span> <span class="fl">TRUE</span>)
- }
-}</pre></body></html></div>
+<p>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.</p>
<div id="test-cases" class="section level2">
<h2 class="hasAnchor">
<a href="#test-cases" class="anchor"></a>Test cases</h2>
<p>Parent only:</p>
-<div class="sourceCode" id="cb2"><html><body><pre class="r"><span class="no">FOCUS_C</span> <span class="kw">&lt;-</span> <span class="no">FOCUS_2006_C</span>
+<div class="sourceCode" id="cb1"><html><body><pre class="r"><span class="no">FOCUS_C</span> <span class="kw">&lt;-</span> <span class="no">FOCUS_2006_C</span>
<span class="no">FOCUS_D</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/subset.html">subset</a></span>(<span class="no">FOCUS_2006_D</span>, <span class="no">value</span> <span class="kw">!=</span> <span class="fl">0</span>)
<span class="no">parent_datasets</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="no">FOCUS_C</span>, <span class="no">FOCUS_D</span>)
@@ -139,25 +122,22 @@
<span class="no">t2</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/system.time.html">system.time</a></span>(<span class="fu">mmkin_bench</span>(<span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"SFO"</span>, <span class="st">"FOMC"</span>, <span class="st">"DFOP"</span>, <span class="st">"HS"</span>), <span class="no">parent_datasets</span>,
<span class="kw">error_model</span> <span class="kw">=</span> <span class="st">"tc"</span>))<span class="kw">[[</span><span class="st">"elapsed"</span>]]</pre></body></html></div>
<p>One metabolite:</p>
-<div class="sourceCode" id="cb3"><html><body><pre class="r"><span class="no">SFO_SFO</span> <span class="kw">&lt;-</span> <span class="fu"><a href="../../reference/mkinmod.html">mkinmod</a></span>(
+<div class="sourceCode" id="cb2"><html><body><pre class="r"><span class="no">SFO_SFO</span> <span class="kw">&lt;-</span> <span class="fu"><a href="../../reference/mkinmod.html">mkinmod</a></span>(
<span class="kw">parent</span> <span class="kw">=</span> <span class="fu"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"m1"</span>),
- <span class="kw">m1</span> <span class="kw">=</span> <span class="fu"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))</pre></body></html></div>
-<pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre>
-<div class="sourceCode" id="cb5"><html><body><pre class="r"><span class="no">FOMC_SFO</span> <span class="kw">&lt;-</span> <span class="fu"><a href="../../reference/mkinmod.html">mkinmod</a></span>(
+ <span class="kw">m1</span> <span class="kw">=</span> <span class="fu"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))
+<span class="no">FOMC_SFO</span> <span class="kw">&lt;-</span> <span class="fu"><a href="../../reference/mkinmod.html">mkinmod</a></span>(
<span class="kw">parent</span> <span class="kw">=</span> <span class="fu"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"FOMC"</span>, <span class="st">"m1"</span>),
- <span class="kw">m1</span> <span class="kw">=</span> <span class="fu"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))</pre></body></html></div>
-<pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre>
-<div class="sourceCode" id="cb7"><html><body><pre class="r"><span class="no">DFOP_SFO</span> <span class="kw">&lt;-</span> <span class="fu"><a href="../../reference/mkinmod.html">mkinmod</a></span>(
+ <span class="kw">m1</span> <span class="kw">=</span> <span class="fu"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))
+<span class="no">DFOP_SFO</span> <span class="kw">&lt;-</span> <span class="fu"><a href="../../reference/mkinmod.html">mkinmod</a></span>(
<span class="kw">parent</span> <span class="kw">=</span> <span class="fu"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"FOMC"</span>, <span class="st">"m1"</span>),
- <span class="kw">m1</span> <span class="kw">=</span> <span class="fu"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))</pre></body></html></div>
-<pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre>
-<div class="sourceCode" id="cb9"><html><body><pre class="r"><span class="no">t3</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/system.time.html">system.time</a></span>(<span class="fu">mmkin_bench</span>(<span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="no">SFO_SFO</span>, <span class="no">FOMC_SFO</span>, <span class="no">DFOP_SFO</span>), <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="no">FOCUS_D</span>)))<span class="kw">[[</span><span class="st">"elapsed"</span>]]
+ <span class="kw">m1</span> <span class="kw">=</span> <span class="fu"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))
+<span class="no">t3</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/system.time.html">system.time</a></span>(<span class="fu">mmkin_bench</span>(<span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="no">SFO_SFO</span>, <span class="no">FOMC_SFO</span>, <span class="no">DFOP_SFO</span>), <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="no">FOCUS_D</span>)))<span class="kw">[[</span><span class="st">"elapsed"</span>]]
<span class="no">t4</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/system.time.html">system.time</a></span>(<span class="fu">mmkin_bench</span>(<span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="no">SFO_SFO</span>, <span class="no">FOMC_SFO</span>, <span class="no">DFOP_SFO</span>), <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="no">FOCUS_D</span>),
<span class="kw">error_model</span> <span class="kw">=</span> <span class="st">"tc"</span>))<span class="kw">[[</span><span class="st">"elapsed"</span>]]
<span class="no">t5</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/system.time.html">system.time</a></span>(<span class="fu">mmkin_bench</span>(<span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="no">SFO_SFO</span>, <span class="no">FOMC_SFO</span>, <span class="no">DFOP_SFO</span>), <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="no">FOCUS_D</span>),
<span class="kw">error_model</span> <span class="kw">=</span> <span class="st">"obs"</span>))<span class="kw">[[</span><span class="st">"elapsed"</span>]]</pre></body></html></div>
<p>Two metabolites, synthetic data:</p>
-<div class="sourceCode" id="cb10"><html><body><pre class="r"><span class="no">m_synth_SFO_lin</span> <span class="kw">&lt;-</span> <span class="fu"><a href="../../reference/mkinmod.html">mkinmod</a></span>(<span class="kw">parent</span> <span class="kw">=</span> <span class="fu"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"M1"</span>),
+<div class="sourceCode" id="cb3"><html><body><pre class="r"><span class="no">m_synth_SFO_lin</span> <span class="kw">&lt;-</span> <span class="fu"><a href="../../reference/mkinmod.html">mkinmod</a></span>(<span class="kw">parent</span> <span class="kw">=</span> <span class="fu"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"M1"</span>),
<span class="kw">M1</span> <span class="kw">=</span> <span class="fu"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"M2"</span>),
<span class="kw">M2</span> <span class="kw">=</span> <span class="fu"><a href="../../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>),
<span class="kw">use_of_ff</span> <span class="kw">=</span> <span class="st">"max"</span>, <span class="kw">quiet</span> <span class="kw">=</span> <span class="fl">TRUE</span>)
@@ -183,57 +163,55 @@
<span class="kw">error_model</span> <span class="kw">=</span> <span class="st">"obs"</span>))<span class="kw">[[</span><span class="st">"elapsed"</span>]]
<span class="no">t11</span> <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/system.time.html">system.time</a></span>(<span class="fu">mmkin_bench</span>(<span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="no">m_synth_DFOP_par</span>), <span class="fu"><a href="https://rdrr.io/r/base/list.html">list</a></span>(<span class="no">DFOP_par_c</span>),
<span class="kw">error_model</span> <span class="kw">=</span> <span class="st">"obs"</span>))<span class="kw">[[</span><span class="st">"elapsed"</span>]]</pre></body></html></div>
-<div class="sourceCode" id="cb11"><html><body><pre class="r"><span class="no">mkin_benchmarks</span>[<span class="no">system_string</span>, <span class="fu"><a href="https://rdrr.io/r/base/paste.html">paste0</a></span>(<span class="st">"t"</span>, <span class="fl">1</span>:<span class="fl">11</span>)] <span class="kw">&lt;-</span>
+<div class="sourceCode" id="cb4"><html><body><pre class="r"><span class="no">mkin_benchmarks</span>[<span class="no">system_string</span>, <span class="fu"><a href="https://rdrr.io/r/base/paste.html">paste0</a></span>(<span class="st">"t"</span>, <span class="fl">1</span>:<span class="fl">11</span>)] <span class="kw">&lt;-</span>
<span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="no">t1</span>, <span class="no">t2</span>, <span class="no">t3</span>, <span class="no">t4</span>, <span class="no">t5</span>, <span class="no">t6</span>, <span class="no">t7</span>, <span class="no">t8</span>, <span class="no">t9</span>, <span class="no">t10</span>, <span class="no">t11</span>)
<span class="fu"><a href="https://rdrr.io/r/base/save.html">save</a></span>(<span class="no">mkin_benchmarks</span>, <span class="kw">file</span> <span class="kw">=</span> <span class="st">"~/git/mkin/vignettes/web_only/mkin_benchmarks.rda"</span>)</pre></body></html></div>
</div>
<div id="results" class="section level2">
<h2 class="hasAnchor">
<a href="#results" class="anchor"></a>Results</h2>
-<p>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.</p>
-<div class="sourceCode" id="cb12"><html><body><pre class="r"><span class="fu"><a href="https://rdrr.io/r/base/colnames.html">rownames</a></span>(<span class="no">mkin_benchmarks</span>) <span class="kw">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/character.html">as.character</a></span>(<span class="no">mkin_benchmarks</span>$<span class="no">mkin</span>)</pre></body></html></div>
+<p>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.</p>
<p>Benchmarks for all available error models are shown.</p>
<div id="parent-only" class="section level3">
<h3 class="hasAnchor">
<a href="#parent-only" class="anchor"></a>Parent only</h3>
-<p>Constant variance and two-component error model:</p>
-<div class="sourceCode" id="cb13"><html><body><pre class="r"><span class="fu">kable</span>(<span class="no">mkin_benchmarks</span>[, <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"t1"</span>, <span class="st">"t2"</span>)])</pre></body></html></div>
+<p>Constant variance (t1) and two-component error model (t2) for four models fitted to two datasets, i.e. eight fits for each test.</p>
<table class="table">
<thead><tr class="header">
-<th></th>
-<th align="right">t1</th>
-<th align="right">t2</th>
+<th align="left">mkin version</th>
+<th align="right">t1 [s]</th>
+<th align="right">t2 [s]</th>
</tr></thead>
<tbody>
<tr class="odd">
-<td>0.9.48.1</td>
+<td align="left">0.9.48.1</td>
<td align="right">3.610</td>
<td align="right">11.019</td>
</tr>
<tr class="even">
-<td>0.9.49.1</td>
+<td align="left">0.9.49.1</td>
<td align="right">8.184</td>
<td align="right">22.889</td>
</tr>
<tr class="odd">
-<td>0.9.49.2</td>
+<td align="left">0.9.49.2</td>
<td align="right">7.064</td>
<td align="right">12.558</td>
</tr>
<tr class="even">
-<td>0.9.49.3</td>
+<td align="left">0.9.49.3</td>
<td align="right">7.296</td>
<td align="right">21.239</td>
</tr>
<tr class="odd">
-<td>0.9.49.4</td>
+<td align="left">0.9.49.4</td>
<td align="right">5.936</td>
<td align="right">20.545</td>
</tr>
<tr class="even">
-<td>0.9.50.2</td>
-<td align="right">1.659</td>
-<td align="right">3.900</td>
+<td align="left">0.9.50.2</td>
+<td align="right">1.704</td>
+<td align="right">3.909</td>
</tr>
</tbody>
</table>
@@ -241,51 +219,50 @@
<div id="one-metabolite" class="section level3">
<h3 class="hasAnchor">
<a href="#one-metabolite" class="anchor"></a>One metabolite</h3>
-<p>Constant variance, variance by variable and two-component error model:</p>
-<div class="sourceCode" id="cb14"><html><body><pre class="r"><span class="fu">kable</span>(<span class="no">mkin_benchmarks</span>[, <span class="fu"><a href="https://rdrr.io/r/base/c.html">c</a></span>(<span class="st">"t3"</span>, <span class="st">"t4"</span>, <span class="st">"t5"</span>)])</pre></body></html></div>
+<p>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.</p>
<table class="table">
<thead><tr class="header">
-<th></th>
-<th align="right">t3</th>
-<th align="right">t4</th>
-<th align="right">t5</th>
+<th align="left">mkin version</th>
+<th align="right">t3 [s]</th>
+<th align="right">t4 [s]</th>
+<th align="right">t5 [s]</th>
</tr></thead>
<tbody>
<tr class="odd">
-<td>0.9.48.1</td>
+<td align="left">0.9.48.1</td>
<td align="right">3.764</td>
<td align="right">14.347</td>
<td align="right">9.495</td>
</tr>
<tr class="even">
-<td>0.9.49.1</td>
+<td align="left">0.9.49.1</td>
<td align="right">4.649</td>
<td align="right">13.789</td>
<td align="right">6.395</td>
</tr>
<tr class="odd">
-<td>0.9.49.2</td>
+<td align="left">0.9.49.2</td>
<td align="right">4.786</td>
<td align="right">8.461</td>
<td align="right">5.675</td>
</tr>
<tr class="even">
-<td>0.9.49.3</td>
+<td align="left">0.9.49.3</td>
<td align="right">4.510</td>
<td align="right">13.805</td>
<td align="right">7.386</td>
</tr>
<tr class="odd">
-<td>0.9.49.4</td>
+<td align="left">0.9.49.4</td>
<td align="right">4.446</td>
<td align="right">15.335</td>
<td align="right">6.002</td>
</tr>
<tr class="even">
-<td>0.9.50.2</td>
-<td align="right">1.389</td>
-<td align="right">6.106</td>
-<td align="right">2.716</td>
+<td align="left">0.9.50.2</td>
+<td align="right">1.370</td>
+<td align="right">6.147</td>
+<td align="right">2.747</td>
</tr>
</tbody>
</table>
@@ -293,21 +270,20 @@
<div id="two-metabolites" class="section level3">
<h3 class="hasAnchor">
<a href="#two-metabolites" class="anchor"></a>Two metabolites</h3>
-<p>Two different datasets, for each constant variance, variance by variable and two-component error model are shown:</p>
-<div class="sourceCode" id="cb15"><html><body><pre class="r"><span class="fu">kable</span>(<span class="no">mkin_benchmarks</span>[, <span class="fu"><a href="https://rdrr.io/r/base/paste.html">paste0</a></span>(<span class="st">"t"</span>, <span class="fl">6</span>:<span class="fl">11</span>)])</pre></body></html></div>
+<p>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.</p>
<table class="table">
<thead><tr class="header">
-<th></th>
-<th align="right">t6</th>
-<th align="right">t7</th>
-<th align="right">t8</th>
-<th align="right">t9</th>
-<th align="right">t10</th>
-<th align="right">t11</th>
+<th align="left">mkin version</th>
+<th align="right">t6 [s]</th>
+<th align="right">t7 [s]</th>
+<th align="right">t8 [s]</th>
+<th align="right">t9 [s]</th>
+<th align="right">t10 [s]</th>
+<th align="right">t11 [s]</th>
</tr></thead>
<tbody>
<tr class="odd">
-<td>0.9.48.1</td>
+<td align="left">0.9.48.1</td>
<td align="right">2.623</td>
<td align="right">4.587</td>
<td align="right">7.525</td>
@@ -316,7 +292,7 @@
<td align="right">31.267</td>
</tr>
<tr class="even">
-<td>0.9.49.1</td>
+<td align="left">0.9.49.1</td>
<td align="right">2.542</td>
<td align="right">4.128</td>
<td align="right">4.632</td>
@@ -325,7 +301,7 @@
<td align="right">5.636</td>
</tr>
<tr class="odd">
-<td>0.9.49.2</td>
+<td align="left">0.9.49.2</td>
<td align="right">2.723</td>
<td align="right">4.478</td>
<td align="right">4.862</td>
@@ -334,7 +310,7 @@
<td align="right">5.574</td>
</tr>
<tr class="even">
-<td>0.9.49.3</td>
+<td align="left">0.9.49.3</td>
<td align="right">2.643</td>
<td align="right">4.374</td>
<td align="right">7.020</td>
@@ -343,7 +319,7 @@
<td align="right">7.365</td>
</tr>
<tr class="odd">
-<td>0.9.49.4</td>
+<td align="left">0.9.49.4</td>
<td align="right">2.635</td>
<td align="right">4.259</td>
<td align="right">4.737</td>
@@ -352,13 +328,13 @@
<td align="right">5.626</td>
</tr>
<tr class="even">
-<td>0.9.50.2</td>
-<td align="right">0.751</td>
-<td align="right">1.209</td>
-<td align="right">1.270</td>
-<td align="right">2.859</td>
-<td align="right">2.026</td>
-<td align="right">2.963</td>
+<td align="left">0.9.50.2</td>
+<td align="right">0.761</td>
+<td align="right">1.213</td>
+<td align="right">1.287</td>
+<td align="right">2.886</td>
+<td align="right">2.054</td>
+<td align="right">2.984</td>
</tr>
</tbody>
</table>
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml
index cd82d482..922e556c 100644
--- a/docs/pkgdown.yml
+++ b/docs/pkgdown.yml
@@ -10,7 +10,7 @@ articles:
NAFTA_examples: web_only/NAFTA_examples.html
benchmarks: web_only/benchmarks.html
compiled_models: web_only/compiled_models.html
-last_built: 2020-05-12T17:10Z
+last_built: 2020-05-13T14:16Z
urls:
reference: https://pkgdown.jrwb.de/mkin/reference
article: https://pkgdown.jrwb.de/mkin/articles
diff --git a/vignettes/FOCUS_D.Rmd b/vignettes/FOCUS_D.rmd
index 02c2c467..b857a3c3 100644
--- a/vignettes/FOCUS_D.Rmd
+++ b/vignettes/FOCUS_D.rmd
@@ -1,73 +1,73 @@
----
-title: Example evaluation of FOCUS Example Dataset D
-author: Johannes Ranke
-date: "`r Sys.Date()`"
-output:
-rmarkdown::html_vignette:
- mathjax: null
-vignette: >
- %\VignetteIndexEntry{Example evaluation of FOCUS Example Dataset D}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE, message = FALSE}
-library(knitr)
-opts_chunk$set(tidy = FALSE, cache = FALSE)
-library(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`.
-
-
-```{r data}
-library(mkin, quietly = TRUE)
-print(FOCUS_2006_D)
-```
-
-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.
-
-```{r model}
-SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
-print(SFO_SFO$diffs)
-```
-
-We do the fitting without progress report (`quiet = TRUE`).
-
-
-```{r fit}
-fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
-```
-
-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.
-
-```{r plot, fig.height = 6, fig.width = 8}
-plot_sep(fit, lpos = c("topright", "bottomright"))
-```
-
-Confidence intervals for the parameter estimates are obtained using the `mkinparplot` function.
-
-
-```{r plot_2, fig.height = 4, fig.width = 8}
-mkinparplot(fit)
-```
-
-A comprehensive report of the results is obtained using the `summary` method for `mkinfit`
-objects.
-
-
-```{r}
-summary(fit)
-```
+---
+title: Example evaluation of FOCUS Example Dataset D
+author: Johannes Ranke
+date: "`r Sys.Date()`"
+output:
+rmarkdown::html_vignette:
+ mathjax: null
+vignette: >
+ %\VignetteIndexEntry{Example evaluation of FOCUS Example Dataset D}
+ %\VignetteEngine{knitr::rmarkdown}
+ %\VignetteEncoding{UTF-8}
+---
+
+```{r, include = FALSE, message = FALSE}
+library(knitr)
+opts_chunk$set(tidy = FALSE, cache = FALSE)
+library(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`.
+
+
+```{r data}
+library(mkin, quietly = TRUE)
+print(FOCUS_2006_D)
+```
+
+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.
+
+```{r model}
+SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO"))
+print(SFO_SFO$diffs)
+```
+
+We do the fitting without progress report (`quiet = TRUE`).
+
+
+```{r fit}
+fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE)
+```
+
+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.
+
+```{r plot, fig.height = 6, fig.width = 8}
+plot_sep(fit, lpos = c("topright", "bottomright"))
+```
+
+Confidence intervals for the parameter estimates are obtained using the `mkinparplot` function.
+
+
+```{r plot_2, fig.height = 4, fig.width = 8}
+mkinparplot(fit)
+```
+
+A comprehensive report of the results is obtained using the `summary` method for `mkinfit`
+objects.
+
+
+```{r}
+summary(fit)
+```
diff --git a/vignettes/FOCUS_L.Rmd b/vignettes/FOCUS_L.rmd
index fa6155d2..e017b674 100644
--- a/vignettes/FOCUS_L.Rmd
+++ b/vignettes/FOCUS_L.rmd
@@ -1,271 +1,271 @@
----
-title: "Example evaluation of FOCUS Laboratory Data L1 to L3"
-author: "Johannes Ranke"
-date: "`r Sys.Date()`"
-output:
- html_document:
- toc: true
- toc_float:
- collapsed: false
- mathjax: null
- fig_retina: null
-references:
-- id: ranke2014
- title: <span class="nocase">Prüfung und Validierung von Modellierungssoftware als Alternative zu
- ModelMaker 4.0</span>
- author:
- - family: Ranke
- given: Johannes
- type: report
- issued:
- year: 2014
- number: "Umweltbundesamt Projektnummer 27452"
-vignette: >
- %\VignetteIndexEntry{Example evaluation of FOCUS Laboratory Data L1 to L3}
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE}
-library(knitr)
-opts_chunk$set(tidy = FALSE, cache = FALSE)
-```
-
-# Laboratory Data L1
-
-The following code defines example dataset L1 from the FOCUS kinetics
-report, p. 284:
-
-```{r}
-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.
-
-```{r}
-m.L1.SFO <- mkinfit("SFO", FOCUS_2006_L1_mkin, quiet = TRUE)
-summary(m.L1.SFO)
-```
-
-A plot of the fit is obtained with the plot function for mkinfit objects.
-
-```{r fig.width = 6, fig.height = 5}
-plot(m.L1.SFO, show_errmin = TRUE, main = "FOCUS L1 - SFO")
-```
-
-The residual plot can be easily obtained by
-
-```{r fig.width = 6, fig.height = 5}
-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.
-
-```{r fig.width = 6, fig.height = 5}
-m.L1.FOMC <- mkinfit("FOMC", FOCUS_2006_L1_mkin, quiet=TRUE)
-plot(m.L1.FOMC, show_errmin = TRUE, main = "FOCUS L1 - FOMC")
-summary(m.L1.FOMC, data = FALSE)
-```
-
-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 [@ranke2014].
-
-# Laboratory Data L2
-
-The following code defines example dataset L2 from the FOCUS kinetics
-report, p. 287:
-
-```{r}
-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.
-
-```{r fig.width = 7, fig.height = 6}
-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.
-
-```{r fig.width = 7, fig.height = 6}
-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)
-```
-
-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.
-
-```{r fig.width = 7, fig.height = 6}
-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)
-```
-
-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.
-
-```{r}
-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.
-
-```{r fig.height = 8}
-# 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.
-
-```{r fig.height = 5}
-summary(mm.L3[["DFOP", 1]])
-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:
-
-```{r}
-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:
-
-```{r fig.height = 6}
-# 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.
-
-
-```{r fig.height = 8}
-summary(mm.L4[["SFO", 1]], data = FALSE)
-summary(mm.L4[["FOMC", 1]], data = FALSE)
-```
-
-
-# References
+---
+title: "Example evaluation of FOCUS Laboratory Data L1 to L3"
+author: "Johannes Ranke"
+date: "`r Sys.Date()`"
+output:
+ html_document:
+ toc: true
+ toc_float:
+ collapsed: false
+ mathjax: null
+ fig_retina: null
+references:
+- id: ranke2014
+ title: <span class="nocase">Prüfung und Validierung von Modellierungssoftware als Alternative zu
+ ModelMaker 4.0</span>
+ author:
+ - family: Ranke
+ given: Johannes
+ type: report
+ issued:
+ year: 2014
+ number: "Umweltbundesamt Projektnummer 27452"
+vignette: >
+ %\VignetteIndexEntry{Example evaluation of FOCUS Laboratory Data L1 to L3}
+ %\VignetteEngine{knitr::rmarkdown}
+ %\VignetteEncoding{UTF-8}
+---
+
+```{r, include = FALSE}
+library(knitr)
+opts_chunk$set(tidy = FALSE, cache = FALSE)
+```
+
+# Laboratory Data L1
+
+The following code defines example dataset L1 from the FOCUS kinetics
+report, p. 284:
+
+```{r}
+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.
+
+```{r}
+m.L1.SFO <- mkinfit("SFO", FOCUS_2006_L1_mkin, quiet = TRUE)
+summary(m.L1.SFO)
+```
+
+A plot of the fit is obtained with the plot function for mkinfit objects.
+
+```{r fig.width = 6, fig.height = 5}
+plot(m.L1.SFO, show_errmin = TRUE, main = "FOCUS L1 - SFO")
+```
+
+The residual plot can be easily obtained by
+
+```{r fig.width = 6, fig.height = 5}
+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.
+
+```{r fig.width = 6, fig.height = 5}
+m.L1.FOMC <- mkinfit("FOMC", FOCUS_2006_L1_mkin, quiet=TRUE)
+plot(m.L1.FOMC, show_errmin = TRUE, main = "FOCUS L1 - FOMC")
+summary(m.L1.FOMC, data = FALSE)
+```
+
+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 [@ranke2014].
+
+# Laboratory Data L2
+
+The following code defines example dataset L2 from the FOCUS kinetics
+report, p. 287:
+
+```{r}
+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.
+
+```{r fig.width = 7, fig.height = 6}
+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.
+
+```{r fig.width = 7, fig.height = 6}
+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)
+```
+
+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.
+
+```{r fig.width = 7, fig.height = 6}
+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)
+```
+
+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.
+
+```{r}
+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.
+
+```{r fig.height = 8}
+# 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.
+
+```{r fig.height = 5}
+summary(mm.L3[["DFOP", 1]])
+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:
+
+```{r}
+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:
+
+```{r fig.height = 6}
+# 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.
+
+
+```{r fig.height = 8}
+summary(mm.L4[["SFO", 1]], data = FALSE)
+summary(mm.L4[["FOMC", 1]], data = FALSE)
+```
+
+
+# References
diff --git a/vignettes/mkin.Rmd b/vignettes/mkin.rmd
index acca0e44..acca0e44 100644
--- a/vignettes/mkin.Rmd
+++ b/vignettes/mkin.rmd
diff --git a/vignettes/twa.Rmd b/vignettes/twa.rmd
index 6f283eb2..6f283eb2 100644
--- a/vignettes/twa.Rmd
+++ b/vignettes/twa.rmd
diff --git a/vignettes/web_only/FOCUS_Z.Rmd b/vignettes/web_only/FOCUS_Z.rmd
index 2da7fde7..2da7fde7 100644
--- a/vignettes/web_only/FOCUS_Z.Rmd
+++ b/vignettes/web_only/FOCUS_Z.rmd
diff --git a/vignettes/web_only/NAFTA_examples.Rmd b/vignettes/web_only/NAFTA_examples.rmd
index 26a9240a..26a9240a 100644
--- a/vignettes/web_only/NAFTA_examples.Rmd
+++ b/vignettes/web_only/NAFTA_examples.rmd
diff --git a/vignettes/web_only/benchmarks.html b/vignettes/web_only/benchmarks.html
index 821399e4..043b777f 100644
--- a/vignettes/web_only/benchmarks.html
+++ b/vignettes/web_only/benchmarks.html
@@ -11,7 +11,7 @@
<meta name="author" content="Johannes Ranke" />
-<meta name="date" content="2020-05-12" />
+<meta name="date" content="2020-05-13" />
<title>Benchmark timings for mkin</title>
@@ -1583,29 +1583,12 @@ div.tocify {
<h1 class="title toc-ignore">Benchmark timings for mkin</h1>
<h4 class="author">Johannes Ranke</h4>
-<h4 class="date">2020-05-12</h4>
+<h4 class="date">2020-05-13</h4>
</div>
-<p>Each system is characterized by its CPU type, the operating system type and the mkin version. Currently only values for one system are available.</p>
-<pre class="r"><code>cpu_model &lt;- benchmarkme::get_cpu()$model_name
-operating_system &lt;- Sys.info()[[&quot;sysname&quot;]]
-mkin_version &lt;- as.character(packageVersion(&quot;mkin&quot;))
-system_string &lt;- paste0(operating_system, &quot;, &quot;, cpu_model, &quot;, mkin version &quot;, mkin_version)
-load(&quot;~/git/mkin/vignettes/web_only/mkin_benchmarks.rda&quot;)
-mkin_benchmarks[system_string, c(&quot;CPU&quot;, &quot;OS&quot;, &quot;mkin&quot;)] &lt;-
- c(cpu_model, operating_system, mkin_version)
-
-if (mkin_version &gt; &quot;0.9.48.1&quot;) {
- mmkin_bench &lt;- function(models, datasets, error_model = &quot;const&quot;) {
- mmkin(models, datasets, error_model = error_model, cores = 1, quiet = TRUE)
- }
-} else {
- mmkin_bench &lt;- function(models, datasets, error_model = NULL) {
- mmkin(models, datasets, reweight.method = error_model, cores = 1, quiet = TRUE)
- }
-}</code></pre>
+<p>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.</p>
<div id="test-cases" class="section level2">
<h2>Test cases</h2>
<p>Parent only:</p>
@@ -1619,17 +1602,14 @@ t2 &lt;- system.time(mmkin_bench(c(&quot;SFO&quot;, &quot;FOMC&quot;, &quot;DFOP
<p>One metabolite:</p>
<pre class="r"><code>SFO_SFO &lt;- mkinmod(
parent = mkinsub(&quot;SFO&quot;, &quot;m1&quot;),
- m1 = mkinsub(&quot;SFO&quot;))</code></pre>
-<pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre>
-<pre class="r"><code>FOMC_SFO &lt;- mkinmod(
+ m1 = mkinsub(&quot;SFO&quot;))
+FOMC_SFO &lt;- mkinmod(
parent = mkinsub(&quot;FOMC&quot;, &quot;m1&quot;),
- m1 = mkinsub(&quot;SFO&quot;))</code></pre>
-<pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre>
-<pre class="r"><code>DFOP_SFO &lt;- mkinmod(
+ m1 = mkinsub(&quot;SFO&quot;))
+DFOP_SFO &lt;- mkinmod(
parent = mkinsub(&quot;FOMC&quot;, &quot;m1&quot;),
- m1 = mkinsub(&quot;SFO&quot;))</code></pre>
-<pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre>
-<pre class="r"><code>t3 &lt;- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D)))[[&quot;elapsed&quot;]]
+ m1 = mkinsub(&quot;SFO&quot;))
+t3 &lt;- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D)))[[&quot;elapsed&quot;]]
t4 &lt;- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D),
error_model = &quot;tc&quot;))[[&quot;elapsed&quot;]]
t5 &lt;- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D),
@@ -1667,127 +1647,123 @@ save(mkin_benchmarks, file = &quot;~/git/mkin/vignettes/web_only/mkin_benchmarks
</div>
<div id="results" class="section level2">
<h2>Results</h2>
-<p>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.</p>
-<pre class="r"><code>rownames(mkin_benchmarks) &lt;- as.character(mkin_benchmarks$mkin)</code></pre>
+<p>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.</p>
<p>Benchmarks for all available error models are shown.</p>
<div id="parent-only" class="section level3">
<h3>Parent only</h3>
-<p>Constant variance and two-component error model:</p>
-<pre class="r"><code>kable(mkin_benchmarks[, c(&quot;t1&quot;, &quot;t2&quot;)])</code></pre>
+<p>Constant variance (t1) and two-component error model (t2) for four models fitted to two datasets, i.e. eight fits for each test.</p>
<table>
<thead>
<tr class="header">
-<th></th>
-<th align="right">t1</th>
-<th align="right">t2</th>
+<th align="left">mkin version</th>
+<th align="right">t1 [s]</th>
+<th align="right">t2 [s]</th>
</tr>
</thead>
<tbody>
<tr class="odd">
-<td>0.9.48.1</td>
+<td align="left">0.9.48.1</td>
<td align="right">3.610</td>
<td align="right">11.019</td>
</tr>
<tr class="even">
-<td>0.9.49.1</td>
+<td align="left">0.9.49.1</td>
<td align="right">8.184</td>
<td align="right">22.889</td>
</tr>
<tr class="odd">
-<td>0.9.49.2</td>
+<td align="left">0.9.49.2</td>
<td align="right">7.064</td>
<td align="right">12.558</td>
</tr>
<tr class="even">
-<td>0.9.49.3</td>
+<td align="left">0.9.49.3</td>
<td align="right">7.296</td>
<td align="right">21.239</td>
</tr>
<tr class="odd">
-<td>0.9.49.4</td>
+<td align="left">0.9.49.4</td>
<td align="right">5.936</td>
<td align="right">20.545</td>
</tr>
<tr class="even">
-<td>0.9.50.2</td>
-<td align="right">1.559</td>
-<td align="right">3.929</td>
+<td align="left">0.9.50.2</td>
+<td align="right">1.547</td>
+<td align="right">3.928</td>
</tr>
</tbody>
</table>
</div>
<div id="one-metabolite" class="section level3">
<h3>One metabolite</h3>
-<p>Constant variance, variance by variable and two-component error model:</p>
-<pre class="r"><code>kable(mkin_benchmarks[, c(&quot;t3&quot;, &quot;t4&quot;, &quot;t5&quot;)])</code></pre>
+<p>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.</p>
<table>
<thead>
<tr class="header">
-<th></th>
-<th align="right">t3</th>
-<th align="right">t4</th>
-<th align="right">t5</th>
+<th align="left">mkin version</th>
+<th align="right">t3 [s]</th>
+<th align="right">t4 [s]</th>
+<th align="right">t5 [s]</th>
</tr>
</thead>
<tbody>
<tr class="odd">
-<td>0.9.48.1</td>
+<td align="left">0.9.48.1</td>
<td align="right">3.764</td>
<td align="right">14.347</td>
<td align="right">9.495</td>
</tr>
<tr class="even">
-<td>0.9.49.1</td>
+<td align="left">0.9.49.1</td>
<td align="right">4.649</td>
<td align="right">13.789</td>
<td align="right">6.395</td>
</tr>
<tr class="odd">
-<td>0.9.49.2</td>
+<td align="left">0.9.49.2</td>
<td align="right">4.786</td>
<td align="right">8.461</td>
<td align="right">5.675</td>
</tr>
<tr class="even">
-<td>0.9.49.3</td>
+<td align="left">0.9.49.3</td>
<td align="right">4.510</td>
<td align="right">13.805</td>
<td align="right">7.386</td>
</tr>
<tr class="odd">
-<td>0.9.49.4</td>
+<td align="left">0.9.49.4</td>
<td align="right">4.446</td>
<td align="right">15.335</td>
<td align="right">6.002</td>
</tr>
<tr class="even">
-<td>0.9.50.2</td>
-<td align="right">1.352</td>
-<td align="right">6.110</td>
-<td align="right">2.841</td>
+<td align="left">0.9.50.2</td>
+<td align="right">1.371</td>
+<td align="right">6.154</td>
+<td align="right">2.720</td>
</tr>
</tbody>
</table>
</div>
<div id="two-metabolites" class="section level3">
<h3>Two metabolites</h3>
-<p>Two different datasets, for each constant variance, variance by variable and two-component error model are shown:</p>
-<pre class="r"><code>kable(mkin_benchmarks[, paste0(&quot;t&quot;, 6:11)])</code></pre>
+<p>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.</p>
<table>
<thead>
<tr class="header">
-<th></th>
-<th align="right">t6</th>
-<th align="right">t7</th>
-<th align="right">t8</th>
-<th align="right">t9</th>
-<th align="right">t10</th>
-<th align="right">t11</th>
+<th align="left">mkin version</th>
+<th align="right">t6 [s]</th>
+<th align="right">t7 [s]</th>
+<th align="right">t8 [s]</th>
+<th align="right">t9 [s]</th>
+<th align="right">t10 [s]</th>
+<th align="right">t11 [s]</th>
</tr>
</thead>
<tbody>
<tr class="odd">
-<td>0.9.48.1</td>
+<td align="left">0.9.48.1</td>
<td align="right">2.623</td>
<td align="right">4.587</td>
<td align="right">7.525</td>
@@ -1796,7 +1772,7 @@ save(mkin_benchmarks, file = &quot;~/git/mkin/vignettes/web_only/mkin_benchmarks
<td align="right">31.267</td>
</tr>
<tr class="even">
-<td>0.9.49.1</td>
+<td align="left">0.9.49.1</td>
<td align="right">2.542</td>
<td align="right">4.128</td>
<td align="right">4.632</td>
@@ -1805,7 +1781,7 @@ save(mkin_benchmarks, file = &quot;~/git/mkin/vignettes/web_only/mkin_benchmarks
<td align="right">5.636</td>
</tr>
<tr class="odd">
-<td>0.9.49.2</td>
+<td align="left">0.9.49.2</td>
<td align="right">2.723</td>
<td align="right">4.478</td>
<td align="right">4.862</td>
@@ -1814,7 +1790,7 @@ save(mkin_benchmarks, file = &quot;~/git/mkin/vignettes/web_only/mkin_benchmarks
<td align="right">5.574</td>
</tr>
<tr class="even">
-<td>0.9.49.3</td>
+<td align="left">0.9.49.3</td>
<td align="right">2.643</td>
<td align="right">4.374</td>
<td align="right">7.020</td>
@@ -1823,7 +1799,7 @@ save(mkin_benchmarks, file = &quot;~/git/mkin/vignettes/web_only/mkin_benchmarks
<td align="right">7.365</td>
</tr>
<tr class="odd">
-<td>0.9.49.4</td>
+<td align="left">0.9.49.4</td>
<td align="right">2.635</td>
<td align="right">4.259</td>
<td align="right">4.737</td>
@@ -1832,13 +1808,13 @@ save(mkin_benchmarks, file = &quot;~/git/mkin/vignettes/web_only/mkin_benchmarks
<td align="right">5.626</td>
</tr>
<tr class="even">
-<td>0.9.50.2</td>
-<td align="right">0.759</td>
-<td align="right">1.204</td>
-<td align="right">1.275</td>
-<td align="right">2.837</td>
-<td align="right">2.026</td>
-<td align="right">2.976</td>
+<td align="left">0.9.50.2</td>
+<td align="right">0.742</td>
+<td align="right">1.203</td>
+<td align="right">1.282</td>
+<td align="right">2.845</td>
+<td align="right">2.037</td>
+<td align="right">2.987</td>
</tr>
</tbody>
</table>
diff --git a/vignettes/web_only/benchmarks.Rmd b/vignettes/web_only/benchmarks.rmd
index 990c2fee..7ae12451 100644
--- a/vignettes/web_only/benchmarks.Rmd
+++ b/vignettes/web_only/benchmarks.rmd
@@ -20,9 +20,11 @@ library("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.
+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.
-```{r}
+```{r include = FALSE}
cpu_model <- benchmarkme::get_cpu()$model_name
operating_system <- Sys.info()[["sysname"]]
mkin_version <- as.character(packageVersion("mkin"))
@@ -58,7 +60,7 @@ t2 <- system.time(mmkin_bench(c("SFO", "FOMC", "DFOP", "HS"), parent_datasets,
One metabolite:
-```{r one_metabolite}
+```{r one_metabolite, message = FALSE}
SFO_SFO <- mkinmod(
parent = mkinsub("SFO", "m1"),
m1 = mkinsub("SFO"))
@@ -77,7 +79,7 @@ t5 <- system.time(mmkin_bench(list(SFO_SFO, FOMC_SFO, DFOP_SFO), list(FOCUS_D),
Two metabolites, synthetic data:
-```{r two_metabolites}
+```{r two_metabolites, message = FALSE}
m_synth_SFO_lin <- mkinmod(parent = mkinsub("SFO", "M1"),
M1 = mkinsub("SFO", "M2"),
M2 = mkinsub("SFO"),
@@ -116,9 +118,11 @@ save(mkin_benchmarks, file = "~/git/mkin/vignettes/web_only/mkin_benchmarks.rda"
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.
-```{r}
-rownames(mkin_benchmarks) <- as.character(mkin_benchmarks$mkin)
+```{r, include = FALSE}
+dimnames(mkin_benchmarks) <- list(as.character(mkin_benchmarks$mkin),
+ c("CPU", "OS", "mkin version", paste0("t", 1:11, " [s]")))
```
@@ -126,25 +130,28 @@ Benchmarks for all available error models are shown.
### Parent only
-Constant variance and two-component error model:
+Constant variance (t1) and two-component error model (t2) for four models
+fitted to two datasets, i.e. eight fits for each test.
-```{r}
-kable(mkin_benchmarks[, c("t1", "t2")])
+```{r, echo = FALSE}
+kable(mkin_benchmarks[, 4:5], rownames = "mkin version")
```
### One metabolite
-Constant variance, variance by variable and two-component error model:
+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.
-```{r}
-kable(mkin_benchmarks[, c("t3", "t4", "t5")])
+```{r, echo = FALSE}
+kable(mkin_benchmarks[, 6:8], rownames = "mkin version")
```
### Two metabolites
-Two different datasets, for each constant variance, variance by variable and
-two-component error model are shown:
+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.
-```{r}
-kable(mkin_benchmarks[, paste0("t", 6:11)])
+```{r, echo = FALSE}
+kable(mkin_benchmarks[, 9:14], rownames = "mkin version")
```
diff --git a/vignettes/web_only/compiled_models.Rmd b/vignettes/web_only/compiled_models.rmd
index f99ea808..0b8c617a 100644
--- a/vignettes/web_only/compiled_models.Rmd
+++ b/vignettes/web_only/compiled_models.rmd
@@ -1,141 +1,141 @@
----
-title: "Performance benefit by using compiled model definitions in mkin"
-author: "Johannes Ranke"
-output:
- html_document:
- toc: true
- toc_float: true
- code_folding: show
- fig_retina: null
-date: "`r Sys.Date()`"
-vignette: >
- %\VignetteEngine{knitr::rmarkdown}
- %\VignetteEncoding{UTF-8}
----
-
-```{r, include = FALSE}
-library(knitr)
-opts_chunk$set(tidy = FALSE, cache = FALSE)
-```
-
-## 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
-
-```{r check_gcc, eval = FALSE}
-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
-
-```{r Rprofile, eval = FALSE}
-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
-
-```{r HOME, eval = FALSE}
-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.
-
-```{r create_SFO_SFO}
-library("mkin", quietly = TRUE)
-SFO_SFO <- mkinmod(
- parent = mkinsub("SFO", "m1"),
- m1 = mkinsub("SFO"))
-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.
-
-```{r benchmark_SFO_SFO, fig.height = 3, message = FALSE, warning = FALSE}
-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")
-}
-```
-
-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.
-
-```{r benchmark_FOMC_SFO, fig.height = 3, warning = FALSE}
-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")
-}
-```
-
-Here we get a performance benefit of a factor of
-`r factor_FOMC_SFO`
-using the version of the differential equation model compiled from C code!
-
-This vignette was built with mkin `r utils::packageVersion("mkin")` on
-
-```{r sessionInfo, echo = FALSE}
-cat(utils::capture.output(utils::sessionInfo())[1:3], sep = "\n")
-if(!inherits(try(cpuinfo <- readLines("/proc/cpuinfo")), "try-error")) {
- cat(gsub("model name\t: ", "CPU model: ", cpuinfo[grep("model name", cpuinfo)[1]]))
-}
-```
+---
+title: "Performance benefit by using compiled model definitions in mkin"
+author: "Johannes Ranke"
+output:
+ html_document:
+ toc: true
+ toc_float: true
+ code_folding: show
+ fig_retina: null
+date: "`r Sys.Date()`"
+vignette: >
+ %\VignetteEngine{knitr::rmarkdown}
+ %\VignetteEncoding{UTF-8}
+---
+
+```{r, include = FALSE}
+library(knitr)
+opts_chunk$set(tidy = FALSE, cache = FALSE)
+```
+
+## 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
+
+```{r check_gcc, eval = FALSE}
+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
+
+```{r Rprofile, eval = FALSE}
+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
+
+```{r HOME, eval = FALSE}
+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.
+
+```{r create_SFO_SFO}
+library("mkin", quietly = TRUE)
+SFO_SFO <- mkinmod(
+ parent = mkinsub("SFO", "m1"),
+ m1 = mkinsub("SFO"))
+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.
+
+```{r benchmark_SFO_SFO, fig.height = 3, message = FALSE, warning = FALSE}
+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")
+}
+```
+
+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.
+
+```{r benchmark_FOMC_SFO, fig.height = 3, warning = FALSE}
+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")
+}
+```
+
+Here we get a performance benefit of a factor of
+`r factor_FOMC_SFO`
+using the version of the differential equation model compiled from C code!
+
+This vignette was built with mkin `r utils::packageVersion("mkin")` on
+
+```{r sessionInfo, echo = FALSE}
+cat(utils::capture.output(utils::sessionInfo())[1:3], sep = "\n")
+if(!inherits(try(cpuinfo <- readLines("/proc/cpuinfo")), "try-error")) {
+ cat(gsub("model name\t: ", "CPU model: ", cpuinfo[grep("model name", cpuinfo)[1]]))
+}
+```
diff --git a/vignettes/web_only/mkin_benchmarks.rda b/vignettes/web_only/mkin_benchmarks.rda
index 268e5efe..c88ca4d6 100644
--- a/vignettes/web_only/mkin_benchmarks.rda
+++ b/vignettes/web_only/mkin_benchmarks.rda
Binary files differ

Contact - Imprint