diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2018-03-01 14:32:46 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2018-03-01 14:32:46 +0100 |
commit | 6653ff2507f45eae909f491a9af3f1eb5358a600 (patch) | |
tree | 03a43f9cf86cc1d675eba1c6f9c5e31da9c2acdd /docs/articles | |
parent | a767013f407f7495492af6a1ceba4cf2b8aae839 (diff) |
Static documentation rebuilt using current pkgdown::build_site()
Diffstat (limited to 'docs/articles')
39 files changed, 195 insertions, 709 deletions
diff --git a/docs/articles/FOCUS_D.R b/docs/articles/FOCUS_D.R deleted file mode 100644 index b831e14e..00000000 --- a/docs/articles/FOCUS_D.R +++ /dev/null @@ -1,24 +0,0 @@ -## ---- include = FALSE---------------------------------------------------- -library(knitr) -opts_chunk$set(tidy = FALSE, cache = TRUE) - -## ----data---------------------------------------------------------------- -library("mkin", quietly = TRUE) -print(FOCUS_2006_D) - -## ----model--------------------------------------------------------------- -SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), m1 = mkinsub("SFO")) -print(SFO_SFO$diffs) - -## ----fit----------------------------------------------------------------- -fit <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE) - -## ----plot, fig.height = 6, fig.width = 8--------------------------------- -plot_sep(fit, lpos = c("topright", "bottomright")) - -## ----plot_2, fig.height = 4, fig.width = 8------------------------------- -mkinparplot(fit) - -## ------------------------------------------------------------------------ -summary(fit) - diff --git a/docs/articles/FOCUS_D.html b/docs/articles/FOCUS_D.html index d9dd8ad5..af04f755 100644 --- a/docs/articles/FOCUS_D.html +++ b/docs/articles/FOCUS_D.html @@ -8,8 +8,11 @@ <title>Example evaluation of FOCUS Example Dataset D • mkin</title> <!-- jquery --><script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script><!-- Font Awesome icons --><link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> -<!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> -<script src="../jquery.sticky-kit.min.js"></script><script src="../pkgdown.js"></script><!-- mathjax --><script src="https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!--[if lt IE 9]> +<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js" integrity="sha384-cV+rhyOuRHc9Ub/91rihWcGmMmCXDeksTtCihMupQHSsi8GIIRDG0ThDc3HGQFJ3" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script><script src="../pkgdown.js"></script><meta property="og:title" content="Example evaluation of FOCUS Example Dataset D"> +<meta property="og:description" content=""> +<meta name="twitter:card" content="summary"> +<!-- mathjax --><script src="https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> @@ -77,7 +80,7 @@ <h1>Example evaluation of FOCUS Example Dataset D</h1> <h4 class="author">Johannes Ranke</h4> - <h4 class="date">2018-01-16</h4> + <h4 class="date">2018-03-01</h4> </div> @@ -85,7 +88,7 @@ <div class="contents"> <p>This is just a very simple vignette showing how to fit a degradation model for a parent compound with one transformation product using <code>mkin</code>. After loading the library we look a the data. We have observed concentrations in the column named <code>value</code> at the times specified in column <code>time</code> for the two observed variables named <code>parent</code> and <code>m1</code>.</p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>(<span class="st">"mkin"</span>, <span class="dt">quietly =</span> <span class="ot">TRUE</span>) -<span class="kw">print</span>(FOCUS_2006_D)</code></pre></div> +<span class="kw">print</span>(FOCUS_<span class="dv">2006</span>_D)</code></pre></div> <pre><code>## name time value ## 1 parent 0 99.46 ## 2 parent 0 102.04 @@ -135,13 +138,13 @@ <p>The call to mkinmod returns a degradation model. The differential equations represented in R code can be found in the character vector <code>$diffs</code> of the <code>mkinmod</code> object. If a C compiler (gcc) is installed and functional, the differential equation model will be compiled from auto-generated C code.</p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">SFO_SFO <-<span class="st"> </span><span class="kw"><a href="../reference/mkinmod.html">mkinmod</a></span>(<span class="dt">parent =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"m1"</span>), <span class="dt">m1 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))</code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">print</span>(SFO_SFO$diffs)</code></pre></div> +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">print</span>(SFO_SFO<span class="op">$</span>diffs)</code></pre></div> <pre><code>## parent ## "d_parent = - k_parent_sink * parent - k_parent_m1 * parent" ## m1 ## "d_m1 = + k_parent_m1 * parent - k_m1_sink * m1"</code></pre> <p>We do the fitting without progress report (<code>quiet = TRUE</code>).</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">fit <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_2006_D, <span class="dt">quiet =</span> <span class="ot">TRUE</span>)</code></pre></div> +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">fit <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_<span class="dv">2006</span>_D, <span class="dt">quiet =</span> <span class="ot">TRUE</span>)</code></pre></div> <p>A plot of the fit including a residual plot for both observed variables is obtained using the <code>plot_sep</code> method for <code>mkinfit</code> objects, which shows separate graphs for all compounds and their residuals.</p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw"><a href="../reference/plot.mkinfit.html">plot_sep</a></span>(fit, <span class="dt">lpos =</span> <span class="kw">c</span>(<span class="st">"topright"</span>, <span class="st">"bottomright"</span>))</code></pre></div> <p><img src="FOCUS_D_files/figure-html/plot-1.png" width="768"></p> @@ -150,10 +153,10 @@ <p><img src="FOCUS_D_files/figure-html/plot_2-1.png" width="768"></p> <p>A comprehensive report of the results is obtained using the <code>summary</code> method for <code>mkinfit</code> objects.</p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(fit)</code></pre></div> -<pre><code>## mkin version: 0.9.46.1 -## R version: 3.4.1 -## Date of fit: Thu Sep 14 12:15:01 2017 -## Date of summary: Thu Sep 14 12:15:02 2017 +<pre><code>## mkin version: 0.9.46.3 +## R version: 3.4.3 +## Date of fit: Thu Mar 1 14:17:55 2018 +## Date of summary: Thu Mar 1 14:17:55 2018 ## ## Equations: ## d_parent/dt = - k_parent_sink * parent - k_parent_m1 * parent @@ -161,7 +164,7 @@ ## ## Model predictions using solution type deSolve ## -## Fitted with method Port using 153 model solutions performed in 1.14 s +## Fitted with method Port using 153 model solutions performed in 0.993 s ## ## Weighting: none ## @@ -286,7 +289,7 @@ </div> <div class="pkgdown"> - <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> + <p>Site built with <a href="http://pkgdown.r-lib.org/">pkgdown</a>.</p> </div> </footer> diff --git a/docs/articles/FOCUS_D_files/figure-html/plot-1.png b/docs/articles/FOCUS_D_files/figure-html/plot-1.png Binary files differindex 75c4c299..b4fa2ff4 100644 --- a/docs/articles/FOCUS_D_files/figure-html/plot-1.png +++ b/docs/articles/FOCUS_D_files/figure-html/plot-1.png diff --git a/docs/articles/FOCUS_D_files/figure-html/plot_2-1.png b/docs/articles/FOCUS_D_files/figure-html/plot_2-1.png Binary files differindex 94e7e2b3..ba06ce31 100644 --- a/docs/articles/FOCUS_D_files/figure-html/plot_2-1.png +++ b/docs/articles/FOCUS_D_files/figure-html/plot_2-1.png diff --git a/docs/articles/FOCUS_L.html b/docs/articles/FOCUS_L.html index 42ec2df1..5de06ad5 100644 --- a/docs/articles/FOCUS_L.html +++ b/docs/articles/FOCUS_L.html @@ -8,8 +8,11 @@ <title>Example evaluation of FOCUS Laboratory Data L1 to L3 • mkin</title> <!-- jquery --><script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script><!-- Font Awesome icons --><link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> -<!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> -<script src="../jquery.sticky-kit.min.js"></script><script src="../pkgdown.js"></script><!-- mathjax --><script src="https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!--[if lt IE 9]> +<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js" integrity="sha384-cV+rhyOuRHc9Ub/91rihWcGmMmCXDeksTtCihMupQHSsi8GIIRDG0ThDc3HGQFJ3" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script><script src="../pkgdown.js"></script><meta property="og:title" content="Example evaluation of FOCUS Laboratory Data L1 to L3"> +<meta property="og:description" content=""> +<meta name="twitter:card" content="summary"> +<!-- mathjax --><script src="https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> @@ -77,7 +80,7 @@ <h1>Example evaluation of FOCUS Laboratory Data L1 to L3</h1> <h4 class="author">Johannes Ranke</h4> - <h4 class="date">2018-01-16</h4> + <h4 class="date">2018-03-01</h4> </div> @@ -88,27 +91,27 @@ <a href="#laboratory-data-l1" class="anchor"></a>Laboratory Data L1</h1> <p>The following code defines example dataset L1 from the FOCUS kinetics report, p. 284:</p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>(<span class="st">"mkin"</span>, <span class="dt">quietly =</span> <span class="ot">TRUE</span>) -FOCUS_2006_L1 =<span class="st"> </span><span class="kw">data.frame</span>( +FOCUS_<span class="dv">2006</span>_L1 =<span class="st"> </span><span class="kw">data.frame</span>( <span class="dt">t =</span> <span class="kw">rep</span>(<span class="kw">c</span>(<span class="dv">0</span>, <span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">3</span>, <span class="dv">5</span>, <span class="dv">7</span>, <span class="dv">14</span>, <span class="dv">21</span>, <span class="dv">30</span>), <span class="dt">each =</span> <span class="dv">2</span>), <span class="dt">parent =</span> <span class="kw">c</span>(<span class="fl">88.3</span>, <span class="fl">91.4</span>, <span class="fl">85.6</span>, <span class="fl">84.5</span>, <span class="fl">78.9</span>, <span class="fl">77.6</span>, <span class="fl">72.0</span>, <span class="fl">71.9</span>, <span class="fl">50.3</span>, <span class="fl">59.4</span>, <span class="fl">47.0</span>, <span class="fl">45.1</span>, <span class="fl">27.7</span>, <span class="fl">27.3</span>, <span class="fl">10.0</span>, <span class="fl">10.4</span>, <span class="fl">2.9</span>, <span class="fl">4.0</span>)) -FOCUS_2006_L1_mkin <-<span class="st"> </span><span class="kw"><a href="../reference/mkin_wide_to_long.html">mkin_wide_to_long</a></span>(FOCUS_2006_L1)</code></pre></div> +FOCUS_<span class="dv">2006</span>_L1_mkin <-<span class="st"> </span><span class="kw"><a href="../reference/mkin_wide_to_long.html">mkin_wide_to_long</a></span>(FOCUS_<span class="dv">2006</span>_L1)</code></pre></div> <p>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.</p> <p>Since mkin version 0.9-32 (July 2014), we can use shorthand notation like <code>"SFO"</code> 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.</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.L1.SFO <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(<span class="st">"SFO"</span>, FOCUS_2006_L1_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.L1.SFO <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(<span class="st">"SFO"</span>, FOCUS_<span class="dv">2006</span>_L1_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) <span class="kw">summary</span>(m.L1.SFO)</code></pre></div> -<pre><code>## mkin version: 0.9.47.1 +<pre><code>## mkin version: 0.9.46.3 ## R version: 3.4.3 -## Date of fit: Tue Jan 16 06:11:06 2018 -## Date of summary: Tue Jan 16 06:11:06 2018 +## Date of fit: Thu Mar 1 14:31:57 2018 +## Date of summary: Thu Mar 1 14:31:57 2018 ## ## Equations: ## d_parent/dt = - k_parent_sink * parent ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 37 model solutions performed in 0.245 s +## Fitted with method Port using 37 model solutions performed in 0.24 s ## ## Weighting: none ## @@ -185,28 +188,21 @@ FOCUS_2006_L1_mkin <-<span class="st"> </span><span class="kw"><a href="../re <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw"><a href="../reference/mkinresplot.html">mkinresplot</a></span>(m.L1.SFO, <span class="dt">ylab =</span> <span class="st">"Observed"</span>, <span class="dt">xlab =</span> <span class="st">"Time"</span>)</code></pre></div> <p><img src="FOCUS_L_files/figure-html/unnamed-chunk-5-1.png" width="576"></p> <p>For comparison, the FOMC model is fitted as well, and the <span class="math inline">\(\chi^2\)</span> error level is checked.</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.L1.FOMC <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(<span class="st">"FOMC"</span>, FOCUS_2006_L1_mkin, <span class="dt">quiet=</span><span class="ot">TRUE</span>)</code></pre></div> -<pre><code>## Warning in mkinfit("FOMC", FOCUS_2006_L1_mkin, quiet = TRUE): Optimisation by method Port did not converge. -## Convergence code is 1</code></pre> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">plot</span>(m.L1.FOMC, <span class="dt">show_errmin =</span> <span class="ot">TRUE</span>, <span class="dt">main =</span> <span class="st">"FOCUS L1 - FOMC"</span>)</code></pre></div> +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.L1.FOMC <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(<span class="st">"FOMC"</span>, FOCUS_<span class="dv">2006</span>_L1_mkin, <span class="dt">quiet=</span><span class="ot">TRUE</span>) +<span class="kw">plot</span>(m.L1.FOMC, <span class="dt">show_errmin =</span> <span class="ot">TRUE</span>, <span class="dt">main =</span> <span class="st">"FOCUS L1 - FOMC"</span>)</code></pre></div> <p><img src="FOCUS_L_files/figure-html/unnamed-chunk-6-1.png" width="576"></p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(m.L1.FOMC, <span class="dt">data =</span> <span class="ot">FALSE</span>)</code></pre></div> -<pre><code>## mkin version: 0.9.47.1 +<pre><code>## mkin version: 0.9.46.3 ## R version: 3.4.3 -## Date of fit: Tue Jan 16 06:11:07 2018 -## Date of summary: Tue Jan 16 06:11:07 2018 -## -## -## Warning: Optimisation by method Port did not converge. -## Convergence code is 1 -## +## Date of fit: Thu Mar 1 14:31:59 2018 +## Date of summary: Thu Mar 1 14:32:00 2018 ## ## Equations: ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 155 model solutions performed in 0.424 s +## Fitted with method Port using 611 model solutions performed in 1.375 s ## ## Weighting: none ## @@ -226,16 +222,16 @@ FOCUS_2006_L1_mkin <-<span class="st"> </span><span class="kw"><a href="../re ## None ## ## Optimised, transformed parameters with symmetric confidence intervals: -## Estimate Std. Error Lower Upper -## parent_0 92.47 1.449 89.38 95.56 -## log_alpha 11.35 435.800 -917.60 940.30 -## log_beta 13.70 435.800 -915.20 942.60 +## Estimate Std. Error Lower Upper +## parent_0 92.47 1.482 89.31 95.63 +## log_alpha 11.25 598.200 -1264.00 1286.00 +## log_beta 13.60 598.200 -1261.00 1289.00 ## ## Parameter correlation: ## parent_0 log_alpha log_beta -## parent_0 1.0000 0.2209 0.2208 -## log_alpha 0.2209 1.0000 1.0000 -## log_beta 0.2208 1.0000 1.0000 +## parent_0 1.0000 -0.3016 -0.3016 +## log_alpha -0.3016 1.0000 1.0000 +## log_beta -0.3016 1.0000 1.0000 ## ## Residual standard error: 3.045 on 15 degrees of freedom ## @@ -244,9 +240,9 @@ FOCUS_2006_L1_mkin <-<span class="st"> </span><span class="kw"><a href="../re ## 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 63.33000 6.183e-20 89.38 95.56 -## alpha 85190.00 0.03367 4.868e-01 0.00 Inf -## beta 891000.00 0.03367 4.868e-01 0.00 Inf +## parent_0 92.47 64.45000 4.757e-20 89.31 95.63 +## alpha 76830.00 0.02852 4.888e-01 0.00 Inf +## beta 803500.00 0.02852 4.888e-01 0.00 Inf ## ## Chi2 error levels in percent: ## err.min n.optim df @@ -264,17 +260,17 @@ FOCUS_2006_L1_mkin <-<span class="st"> </span><span class="kw"><a href="../re <h1 class="hasAnchor"> <a href="#laboratory-data-l2" class="anchor"></a>Laboratory Data L2</h1> <p>The following code defines example dataset L2 from the FOCUS kinetics report, p. 287:</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">FOCUS_2006_L2 =<span class="st"> </span><span class="kw">data.frame</span>( +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">FOCUS_<span class="dv">2006</span>_L2 =<span class="st"> </span><span class="kw">data.frame</span>( <span class="dt">t =</span> <span class="kw">rep</span>(<span class="kw">c</span>(<span class="dv">0</span>, <span class="dv">1</span>, <span class="dv">3</span>, <span class="dv">7</span>, <span class="dv">14</span>, <span class="dv">28</span>), <span class="dt">each =</span> <span class="dv">2</span>), <span class="dt">parent =</span> <span class="kw">c</span>(<span class="fl">96.1</span>, <span class="fl">91.8</span>, <span class="fl">41.4</span>, <span class="fl">38.7</span>, <span class="fl">19.3</span>, <span class="fl">22.3</span>, <span class="fl">4.6</span>, <span class="fl">4.6</span>, <span class="fl">2.6</span>, <span class="fl">1.2</span>, <span class="fl">0.3</span>, <span class="fl">0.6</span>)) -FOCUS_2006_L2_mkin <-<span class="st"> </span><span class="kw"><a href="../reference/mkin_wide_to_long.html">mkin_wide_to_long</a></span>(FOCUS_2006_L2)</code></pre></div> +FOCUS_<span class="dv">2006</span>_L2_mkin <-<span class="st"> </span><span class="kw"><a href="../reference/mkin_wide_to_long.html">mkin_wide_to_long</a></span>(FOCUS_<span class="dv">2006</span>_L2)</code></pre></div> <div id="sfo-fit-for-l2" class="section level2"> <h2 class="hasAnchor"> <a href="#sfo-fit-for-l2" class="anchor"></a>SFO fit for L2</h2> <p>Again, the SFO model is fitted and the result is plotted. The residual plot can be obtained simply by adding the argument <code>show_residuals</code> to the plot command.</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.L2.SFO <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(<span class="st">"SFO"</span>, FOCUS_2006_L2_mkin, <span class="dt">quiet=</span><span class="ot">TRUE</span>) +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.L2.SFO <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(<span class="st">"SFO"</span>, FOCUS_<span class="dv">2006</span>_L2_mkin, <span class="dt">quiet=</span><span class="ot">TRUE</span>) <span class="kw">plot</span>(m.L2.SFO, <span class="dt">show_residuals =</span> <span class="ot">TRUE</span>, <span class="dt">show_errmin =</span> <span class="ot">TRUE</span>, <span class="dt">main =</span> <span class="st">"FOCUS L2 - SFO"</span>)</code></pre></div> <p><img src="FOCUS_L_files/figure-html/unnamed-chunk-8-1.png" width="672"></p> @@ -286,22 +282,22 @@ FOCUS_2006_L2_mkin <-<span class="st"> </span><span class="kw"><a href="../re <h2 class="hasAnchor"> <a href="#fomc-fit-for-l2" class="anchor"></a>FOMC fit for L2</h2> <p>For comparison, the FOMC model is fitted as well, and the <span class="math inline">\(\chi^2\)</span> error level is checked.</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.L2.FOMC <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(<span class="st">"FOMC"</span>, FOCUS_2006_L2_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.L2.FOMC <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(<span class="st">"FOMC"</span>, FOCUS_<span class="dv">2006</span>_L2_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) <span class="kw">plot</span>(m.L2.FOMC, <span class="dt">show_residuals =</span> <span class="ot">TRUE</span>, <span class="dt">main =</span> <span class="st">"FOCUS L2 - FOMC"</span>)</code></pre></div> <p><img src="FOCUS_L_files/figure-html/unnamed-chunk-9-1.png" width="672"></p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(m.L2.FOMC, <span class="dt">data =</span> <span class="ot">FALSE</span>)</code></pre></div> -<pre><code>## mkin version: 0.9.47.1 +<pre><code>## mkin version: 0.9.46.3 ## R version: 3.4.3 -## Date of fit: Tue Jan 16 06:11:08 2018 -## Date of summary: Tue Jan 16 06:11:08 2018 +## Date of fit: Thu Mar 1 14:32:00 2018 +## Date of summary: Thu Mar 1 14:32:00 2018 ## ## Equations: ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 81 model solutions performed in 0.168 s +## Fitted with method Port using 81 model solutions performed in 0.158 s ## ## Weighting: none ## @@ -357,15 +353,15 @@ FOCUS_2006_L2_mkin <-<span class="st"> </span><span class="kw"><a href="../re <h2 class="hasAnchor"> <a href="#dfop-fit-for-l2" class="anchor"></a>DFOP fit for L2</h2> <p>Fitting the four parameter DFOP model further reduces the <span class="math inline">\(\chi^2\)</span> error level.</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.L2.DFOP <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(<span class="st">"DFOP"</span>, FOCUS_2006_L2_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.L2.DFOP <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(<span class="st">"DFOP"</span>, FOCUS_<span class="dv">2006</span>_L2_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) <span class="kw">plot</span>(m.L2.DFOP, <span class="dt">show_residuals =</span> <span class="ot">TRUE</span>, <span class="dt">show_errmin =</span> <span class="ot">TRUE</span>, <span class="dt">main =</span> <span class="st">"FOCUS L2 - DFOP"</span>)</code></pre></div> <p><img src="FOCUS_L_files/figure-html/unnamed-chunk-10-1.png" width="672"></p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(m.L2.DFOP, <span class="dt">data =</span> <span class="ot">FALSE</span>)</code></pre></div> -<pre><code>## mkin version: 0.9.47.1 +<pre><code>## mkin version: 0.9.46.3 ## R version: 3.4.3 -## Date of fit: Tue Jan 16 06:11:09 2018 -## Date of summary: Tue Jan 16 06:11:09 2018 +## Date of fit: Thu Mar 1 14:32:01 2018 +## Date of summary: Thu Mar 1 14:32:01 2018 ## ## Equations: ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * @@ -374,7 +370,7 @@ FOCUS_2006_L2_mkin <-<span class="st"> </span><span class="kw"><a href="../re ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 336 model solutions performed in 0.774 s +## Fitted with method Port using 336 model solutions performed in 0.708 s ## ## Weighting: none ## @@ -433,17 +429,17 @@ FOCUS_2006_L2_mkin <-<span class="st"> </span><span class="kw"><a href="../re <h1 class="hasAnchor"> <a href="#laboratory-data-l3" class="anchor"></a>Laboratory Data L3</h1> <p>The following code defines example dataset L3 from the FOCUS kinetics report, p. 290.</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">FOCUS_2006_L3 =<span class="st"> </span><span class="kw">data.frame</span>( +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">FOCUS_<span class="dv">2006</span>_L3 =<span class="st"> </span><span class="kw">data.frame</span>( <span class="dt">t =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="dv">3</span>, <span class="dv">7</span>, <span class="dv">14</span>, <span class="dv">30</span>, <span class="dv">60</span>, <span class="dv">91</span>, <span class="dv">120</span>), <span class="dt">parent =</span> <span class="kw">c</span>(<span class="fl">97.8</span>, <span class="dv">60</span>, <span class="dv">51</span>, <span class="dv">43</span>, <span class="dv">35</span>, <span class="dv">22</span>, <span class="dv">15</span>, <span class="dv">12</span>)) -FOCUS_2006_L3_mkin <-<span class="st"> </span><span class="kw"><a href="../reference/mkin_wide_to_long.html">mkin_wide_to_long</a></span>(FOCUS_2006_L3)</code></pre></div> +FOCUS_<span class="dv">2006</span>_L3_mkin <-<span class="st"> </span><span class="kw"><a href="../reference/mkin_wide_to_long.html">mkin_wide_to_long</a></span>(FOCUS_<span class="dv">2006</span>_L3)</code></pre></div> <div id="fit-multiple-models" class="section level2"> <h2 class="hasAnchor"> <a href="#fit-multiple-models" class="anchor"></a>Fit multiple models</h2> <p>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 <code>mmkin</code>. The datasets have to be passed in a list, in this case a named list holding only the L3 dataset prepared above.</p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Only use one core here, not to offend the CRAN checks</span> mm.L3 <-<span class="st"> </span><span class="kw"><a href="../reference/mmkin.html">mmkin</a></span>(<span class="kw">c</span>(<span class="st">"SFO"</span>, <span class="st">"FOMC"</span>, <span class="st">"DFOP"</span>), <span class="dt">cores =</span> <span class="dv">1</span>, - <span class="kw">list</span>(<span class="st">"FOCUS L3"</span> =<span class="st"> </span>FOCUS_2006_L3_mkin), <span class="dt">quiet =</span> <span class="ot">TRUE</span>) + <span class="kw">list</span>(<span class="st">"FOCUS L3"</span> =<span class="st"> </span>FOCUS_<span class="dv">2006</span>_L3_mkin), <span class="dt">quiet =</span> <span class="ot">TRUE</span>) <span class="kw">plot</span>(mm.L3)</code></pre></div> <p><img src="FOCUS_L_files/figure-html/unnamed-chunk-12-1.png" width="672"></p> <p>The <span class="math inline">\(\chi^2\)</span> 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 <span class="math inline">\(\chi^2\)</span> test passes of 7%. Fitting the four parameter DFOP model further reduces the <span class="math inline">\(\chi^2\)</span> error level considerably.</p> @@ -454,10 +450,10 @@ mm.L3 <-<span class="st"> </span><span class="kw"><a href="../reference/mmkin <p>The objects returned by mmkin are arranged like a matrix, with models as a row index and datasets as a column index.</p> <p>We can extract the summary and plot for <em>e.g.</em> the DFOP fit, using square brackets for indexing which will result in the use of the summary and plot functions working on mkinfit objects.</p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(mm.L3[[<span class="st">"DFOP"</span>, <span class="dv">1</span>]])</code></pre></div> -<pre><code>## mkin version: 0.9.47.1 +<pre><code>## mkin version: 0.9.46.3 ## R version: 3.4.3 -## Date of fit: Tue Jan 16 06:11:10 2018 -## Date of summary: Tue Jan 16 06:11:10 2018 +## Date of fit: Thu Mar 1 14:32:02 2018 +## Date of summary: Thu Mar 1 14:32:02 2018 ## ## Equations: ## d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * @@ -542,30 +538,30 @@ mm.L3 <-<span class="st"> </span><span class="kw"><a href="../reference/mmkin <h1 class="hasAnchor"> <a href="#laboratory-data-l4" class="anchor"></a>Laboratory Data L4</h1> <p>The following code defines example dataset L4 from the FOCUS kinetics report, p. 293:</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">FOCUS_2006_L4 =<span class="st"> </span><span class="kw">data.frame</span>( +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">FOCUS_<span class="dv">2006</span>_L4 =<span class="st"> </span><span class="kw">data.frame</span>( <span class="dt">t =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="dv">3</span>, <span class="dv">7</span>, <span class="dv">14</span>, <span class="dv">30</span>, <span class="dv">60</span>, <span class="dv">91</span>, <span class="dv">120</span>), <span class="dt">parent =</span> <span class="kw">c</span>(<span class="fl">96.6</span>, <span class="fl">96.3</span>, <span class="fl">94.3</span>, <span class="fl">88.8</span>, <span class="fl">74.9</span>, <span class="fl">59.9</span>, <span class="fl">53.5</span>, <span class="fl">49.0</span>)) -FOCUS_2006_L4_mkin <-<span class="st"> </span><span class="kw"><a href="../reference/mkin_wide_to_long.html">mkin_wide_to_long</a></span>(FOCUS_2006_L4)</code></pre></div> +FOCUS_<span class="dv">2006</span>_L4_mkin <-<span class="st"> </span><span class="kw"><a href="../reference/mkin_wide_to_long.html">mkin_wide_to_long</a></span>(FOCUS_<span class="dv">2006</span>_L4)</code></pre></div> <p>Fits of the SFO and FOMC models, plots and summaries are produced below:</p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># Only use one core here, not to offend the CRAN checks</span> mm.L4 <-<span class="st"> </span><span class="kw"><a href="../reference/mmkin.html">mmkin</a></span>(<span class="kw">c</span>(<span class="st">"SFO"</span>, <span class="st">"FOMC"</span>), <span class="dt">cores =</span> <span class="dv">1</span>, - <span class="kw">list</span>(<span class="st">"FOCUS L4"</span> =<span class="st"> </span>FOCUS_2006_L4_mkin), + <span class="kw">list</span>(<span class="st">"FOCUS L4"</span> =<span class="st"> </span>FOCUS_<span class="dv">2006</span>_L4_mkin), <span class="dt">quiet =</span> <span class="ot">TRUE</span>) <span class="kw">plot</span>(mm.L4)</code></pre></div> <p><img src="FOCUS_L_files/figure-html/unnamed-chunk-15-1.png" width="672"></p> <p>The <span class="math inline">\(\chi^2\)</span> error level of 3.3% as well as the plot suggest that the SFO model fits very well. The error level at which the <span class="math inline">\(\chi^2\)</span> test passes is slightly lower for the FOMC model. However, the difference appears negligible.</p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(mm.L4[[<span class="st">"SFO"</span>, <span class="dv">1</span>]], <span class="dt">data =</span> <span class="ot">FALSE</span>)</code></pre></div> -<pre><code>## mkin version: 0.9.47.1 +<pre><code>## mkin version: 0.9.46.3 ## R version: 3.4.3 -## Date of fit: Tue Jan 16 06:11:10 2018 -## Date of summary: Tue Jan 16 06:11:10 2018 +## Date of fit: Thu Mar 1 14:32:03 2018 +## Date of summary: Thu Mar 1 14:32:03 2018 ## ## Equations: ## d_parent/dt = - k_parent_sink * parent ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 46 model solutions performed in 0.094 s +## Fitted with method Port using 46 model solutions performed in 0.089 s ## ## Weighting: none ## @@ -615,17 +611,17 @@ mm.L4 <-<span class="st"> </span><span class="kw"><a href="../reference/mmkin ## DT50 DT90 ## parent 106 352</code></pre> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(mm.L4[[<span class="st">"FOMC"</span>, <span class="dv">1</span>]], <span class="dt">data =</span> <span class="ot">FALSE</span>)</code></pre></div> -<pre><code>## mkin version: 0.9.47.1 +<pre><code>## mkin version: 0.9.46.3 ## R version: 3.4.3 -## Date of fit: Tue Jan 16 06:11:10 2018 -## Date of summary: Tue Jan 16 06:11:10 2018 +## Date of fit: Thu Mar 1 14:32:03 2018 +## Date of summary: Thu Mar 1 14:32:03 2018 ## ## Equations: ## d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent ## ## Model predictions using solution type analytical ## -## Fitted with method Port using 66 model solutions performed in 0.139 s +## Fitted with method Port using 66 model solutions performed in 0.134 s ## ## Weighting: none ## @@ -690,7 +686,8 @@ mm.L4 <-<span class="st"> </span><span class="kw"><a href="../reference/mmkin <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> <div id="tocnav"> - <h2>Contents</h2> + <h2 class="hasAnchor"> +<a href="#tocnav" class="anchor"></a>Contents</h2> <ul class="nav nav-pills nav-stacked"> <li><a href="#laboratory-data-l1">Laboratory Data L1</a></li> <li> @@ -720,7 +717,7 @@ mm.L4 <-<span class="st"> </span><span class="kw"><a href="../reference/mmkin </div> <div class="pkgdown"> - <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> + <p>Site built with <a href="http://pkgdown.r-lib.org/">pkgdown</a>.</p> </div> </footer> diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-10-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-10-1.png Binary files differindex f5f45ac6..c9da66ac 100644 --- a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-10-1.png +++ b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-10-1.png diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-12-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-12-1.png Binary files differindex 22f3a530..aa728f0f 100644 --- a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-12-1.png +++ b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-12-1.png diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-13-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-13-1.png Binary files differindex 9eb0378f..4eb7f3b1 100644 --- a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-13-1.png +++ b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-13-1.png diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-15-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-15-1.png Binary files differindex 93966e70..56654730 100644 --- a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-15-1.png +++ b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-15-1.png diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-4-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-4-1.png Binary files differindex 1a9c8457..b143282b 100644 --- a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-4-1.png +++ b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-4-1.png diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-5-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-5-1.png Binary files differindex 12b4beea..a4753a7e 100644 --- a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-5-1.png +++ b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-5-1.png diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-6-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-6-1.png Binary files differindex 55e96a9e..50528c8a 100644 --- a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-6-1.png +++ b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-6-1.png diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-8-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-8-1.png Binary files differindex 7b8e7f95..95a5bc5c 100644 --- a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-8-1.png +++ b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-8-1.png diff --git a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-9-1.png b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-9-1.png Binary files differindex 49c48168..745477a3 100644 --- a/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-9-1.png +++ b/docs/articles/FOCUS_L_files/figure-html/unnamed-chunk-9-1.png diff --git a/docs/articles/FOCUS_Z.R b/docs/articles/FOCUS_Z.R deleted file mode 100644 index 4d2dffca..00000000 --- a/docs/articles/FOCUS_Z.R +++ /dev/null @@ -1,115 +0,0 @@ -## ---- include = FALSE---------------------------------------------------- -require(knitr) -options(digits = 5) -opts_chunk$set(engine='R', tidy = FALSE) - -## ---- echo = TRUE, fig = TRUE, fig.width = 8, fig.height = 7------------- -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) - -## ----FOCUS_2006_Z_fits_1, echo=TRUE, fig.height=6------------------------ -Z.2a <- mkinmod(Z0 = mkinsub("SFO", "Z1"), - Z1 = mkinsub("SFO")) -m.Z.2a <- mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.2a) -summary(m.Z.2a, data = FALSE)$bpar - -## ----FOCUS_2006_Z_fits_2, echo=TRUE, fig.height=6------------------------ -Z.2a.ff <- mkinmod(Z0 = mkinsub("SFO", "Z1"), - Z1 = mkinsub("SFO"), - use_of_ff = "max") - -m.Z.2a.ff <- mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.2a.ff) -summary(m.Z.2a.ff, data = FALSE)$bpar - -## ----FOCUS_2006_Z_fits_3, echo=TRUE, fig.height=6------------------------ -Z.3 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE), - Z1 = mkinsub("SFO"), use_of_ff = "max") -m.Z.3 <- mkinfit(Z.3, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.3) -summary(m.Z.3, data = FALSE)$bpar - -## ----FOCUS_2006_Z_fits_5, echo=TRUE, fig.height=7------------------------ -Z.5 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO"), use_of_ff = "max") -m.Z.5 <- mkinfit(Z.5, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.5) - -## ----FOCUS_2006_Z_fits_6, echo=TRUE, fig.height=8------------------------ -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") -m.Z.FOCUS <- mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin, - parms.ini = m.Z.5$bparms.ode, - quiet = TRUE) -plot_sep(m.Z.FOCUS) -summary(m.Z.FOCUS, data = FALSE)$bpar -endpoints(m.Z.FOCUS) - -## ----FOCUS_2006_Z_fits_7, echo=TRUE, fig.height=8------------------------ -Z.mkin.1 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO", "Z3"), - Z3 = mkinsub("SFORB")) -m.Z.mkin.1 <- mkinfit(Z.mkin.1, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.mkin.1) -summary(m.Z.mkin.1, data = FALSE)$cov.unscaled - -## ----FOCUS_2006_Z_fits_9, echo=TRUE, fig.height=8------------------------ -Z.mkin.3 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO")) -m.Z.mkin.3 <- mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.mkin.3) - -## ----FOCUS_2006_Z_fits_10, echo=TRUE, fig.height=8----------------------- -Z.mkin.4 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO", "Z3"), - Z3 = mkinsub("SFO")) -m.Z.mkin.4 <- mkinfit(Z.mkin.4, FOCUS_2006_Z_mkin, - parms.ini = m.Z.mkin.3$bparms.ode, - quiet = TRUE) -plot_sep(m.Z.mkin.4) - -## ----FOCUS_2006_Z_fits_11, echo=TRUE, fig.height=8----------------------- -Z.mkin.5 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO", "Z3"), - Z3 = mkinsub("SFORB")) -m.Z.mkin.5 <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin, - parms.ini = m.Z.mkin.4$bparms.ode[1:4], - quiet = TRUE) -plot_sep(m.Z.mkin.5) - -## ----FOCUS_2006_Z_fits_11a, echo=TRUE------------------------------------ -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) -plot_sep(m.Z.mkin.5a) - -## ----FOCUS_2006_Z_fits_11b, echo=TRUE------------------------------------ -mkinparplot(m.Z.mkin.5a) - -## ----FOCUS_2006_Z_fits_11b_endpoints, echo=TRUE-------------------------- -endpoints(m.Z.mkin.5a) - diff --git a/docs/articles/FOCUS_Z.Rnw b/docs/articles/FOCUS_Z.Rnw deleted file mode 100644 index 5abda0e1..00000000 --- a/docs/articles/FOCUS_Z.Rnw +++ /dev/null @@ -1,274 +0,0 @@ -%\VignetteIndexEntry{Example evaluation of FOCUS dataset Z} -%\VignetteEngine{knitr::knitr} -\documentclass[12pt,a4paper]{article} -\usepackage{a4wide} -\input{header} -\hypersetup{ - pdftitle = {Example evaluation of FOCUS dataset Z}, - pdfsubject = {Manuscript}, - pdfauthor = {Johannes Ranke}, - colorlinks = {true}, - linkcolor = {blue}, - citecolor = {blue}, - urlcolor = {red}, - hyperindex = {true}, - linktocpage = {true}, -} - -\begin{document} - -<<include=FALSE>>= -require(knitr) -opts_chunk$set(engine='R', tidy = FALSE, cache = TRUE) -options(width=70) -@ - -\title{Example evaluation of FOCUS dataset Z} -\author{\textbf{Johannes Ranke} \\[0.5cm] -%EndAName -Wissenschaftlicher Berater\\ -Kronacher Str. 8, 79639 Grenzach-Wyhlen, Germany\\[0.5cm] -and\\[0.5cm] -University of Bremen\\ -} -\maketitle - -\thispagestyle{empty} \setcounter{page}{0} - -\clearpage - -\tableofcontents - -\textbf{Key words}: Kinetics, FOCUS, nonlinear optimisation - -\section{The data} - -The following code defines the example dataset from Appendix 7 to the FOCUS kinetics -report \citep{FOCUSkinetics2011}, p.350. - -<<FOCUS_2006_Z_data, echo=TRUE, eval=TRUE>>= -require(mkin) -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) -@ - -\section{Parent compound 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). - -<<FOCUS_2006_Z_fits_1, echo=TRUE, fig.height=6>>= -Z.2a <- mkinmod(Z0 = mkinsub("SFO", "Z1"), - Z1 = mkinsub("SFO")) -m.Z.2a <- mkinfit(Z.2a, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.2a) -summary(m.Z.2a, data = FALSE)$bpar -@ - -As obvious from the parameter summary (the \texttt{bpar} component of the -summary), the kinetic rate constant from parent compound Z to sink -is negligible. Accordingly, the exact magnitude of the fitted parameter -\texttt{log k\_Z0\_sink} is ill-defined and the covariance matrix is not -returned (not shown, would be visible in the complete summary). -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: - -<<FOCUS_2006_Z_fits_2, echo=TRUE, fig.height=6>>= -Z.2a.ff <- mkinmod(Z0 = mkinsub("SFO", "Z1"), - Z1 = mkinsub("SFO"), - use_of_ff = "max") - -m.Z.2a.ff <- mkinfit(Z.2a.ff, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.2a.ff) -summary(m.Z.2a.ff, data = FALSE)$bpar -@ - -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. Again, the covariance matrix is not returned as the model is -overparameterised. - -The simplified model is obtained by setting the list component \texttt{sink} to -\texttt{FALSE}.\footnote{If the model formulation without formation fractions -is used, the same effect can be obtained by fixing the parameter \texttt{k\_Z\_sink} -to a value of zero.} - -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. - -<<FOCUS_2006_Z_fits_3, echo=TRUE, fig.height=6>>= -Z.3 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE), - Z1 = mkinsub("SFO"), use_of_ff = "max") -m.Z.3 <- mkinfit(Z.3, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.3) -summary(m.Z.3, data = FALSE)$bpar -@ - -As there is only one transformation product for Z0 and no pathway -to sink, the formation fraction is internally fixed to unity. - -\section{Including 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. - -<<FOCUS_2006_Z_fits_5, echo=TRUE, fig.height=7>>= -Z.5 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO"), use_of_ff = "max") -m.Z.5 <- mkinfit(Z.5, FOCUS_2006_Z_mkin, quiet = TRUE) -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. - -<<FOCUS_2006_Z_fits_6, echo=TRUE, fig.height=8>>= -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") -m.Z.FOCUS <- mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin, - parms.ini = m.Z.5$bparms.ode, - quiet = TRUE) -plot_sep(m.Z.FOCUS) -summary(m.Z.FOCUS, data = FALSE)$bpar -endpoints(m.Z.FOCUS) -@ - -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. - -\section{Using the SFORB model for parent and metabolites} - -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. - -<<FOCUS_2006_Z_fits_7, echo=TRUE, fig.height=8>>= -Z.mkin.1 <- mkinmod(Z0 = mkinsub("SFO", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO", "Z3"), - Z3 = mkinsub("SFORB")) -m.Z.mkin.1 <- mkinfit(Z.mkin.1, FOCUS_2006_Z_mkin, quiet = TRUE) -plot_sep(m.Z.mkin.1) -summary(m.Z.mkin.1, data = FALSE)$cov.unscaled -@ - -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. - -<<FOCUS_2006_Z_fits_9, echo=TRUE, fig.height=8>>= -Z.mkin.3 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO")) -m.Z.mkin.3 <- mkinfit(Z.mkin.3, FOCUS_2006_Z_mkin, quiet = TRUE) -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. - -<<FOCUS_2006_Z_fits_10, echo=TRUE, fig.height=8>>= -Z.mkin.4 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO", "Z3"), - Z3 = mkinsub("SFO")) -m.Z.mkin.4 <- mkinfit(Z.mkin.4, FOCUS_2006_Z_mkin, - parms.ini = m.Z.mkin.3$bparms.ode, - quiet = TRUE) -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. - -<<FOCUS_2006_Z_fits_11, echo=TRUE, fig.height=8>>= -Z.mkin.5 <- mkinmod(Z0 = mkinsub("SFORB", "Z1", sink = FALSE), - Z1 = mkinsub("SFO", "Z2", sink = FALSE), - Z2 = mkinsub("SFO", "Z3"), - Z3 = mkinsub("SFORB")) -m.Z.mkin.5 <- mkinfit(Z.mkin.5, FOCUS_2006_Z_mkin, - parms.ini = m.Z.mkin.4$bparms.ode[1:4], - quiet = TRUE) -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 -\texttt{k\_Z3\_bound\_free} is excessively small, it seems reasonable to fix it to -zero. - -<<FOCUS_2006_Z_fits_11a, echo=TRUE>>= -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) -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 -\texttt{Z.mkin.5a} 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. - -<<FOCUS_2006_Z_fits_11b, echo=TRUE>>= -mkinparplot(m.Z.mkin.5a) -@ - -The endpoints obtained with this model are - -<<FOCUS_2006_Z_fits_11b_endpoints, echo=TRUE>>= -endpoints(m.Z.mkin.5a) -@ - -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. - -\bibliographystyle{plainnat} -\bibliography{references} - -\end{document} -% vim: set foldmethod=syntax: diff --git a/docs/articles/FOCUS_Z.html b/docs/articles/FOCUS_Z.html index a5cfc616..52a1db77 100644 --- a/docs/articles/FOCUS_Z.html +++ b/docs/articles/FOCUS_Z.html @@ -8,8 +8,11 @@ <title>Example evaluation of FOCUS dataset Z • mkin</title> <!-- jquery --><script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script><!-- Font Awesome icons --><link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> -<!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> -<script src="../jquery.sticky-kit.min.js"></script><script src="../pkgdown.js"></script><!-- mathjax --><script src="https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!--[if lt IE 9]> +<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js" integrity="sha384-cV+rhyOuRHc9Ub/91rihWcGmMmCXDeksTtCihMupQHSsi8GIIRDG0ThDc3HGQFJ3" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script><script src="../pkgdown.js"></script><meta property="og:title" content="Example evaluation of FOCUS dataset Z"> +<meta property="og:description" content=""> +<meta name="twitter:card" content="summary"> +<!-- mathjax --><script src="https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> @@ -77,7 +80,7 @@ <h1>Example evaluation of FOCUS dataset Z</h1> <h4 class="author">Johannes Ranke</h4> - <h4 class="date">2018-01-16</h4> + <h4 class="date">2018-03-01</h4> </div> @@ -90,64 +93,64 @@ <p>The following code defines the example dataset from Appendix 7 to the FOCUS kinetics report <span class="citation">(FOCUS Work Group on Degradation Kinetics 2014, 354)</span>.</p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>(mkin, <span class="dt">quietly =</span> <span class="ot">TRUE</span>) LOD =<span class="st"> </span><span class="fl">0.5</span> -FOCUS_2006_Z =<span class="st"> </span><span class="kw">data.frame</span>( +FOCUS_<span class="dv">2006</span>_Z =<span class="st"> </span><span class="kw">data.frame</span>( <span class="dt">t =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="fl">0.04</span>, <span class="fl">0.125</span>, <span class="fl">0.29</span>, <span class="fl">0.54</span>, <span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">3</span>, <span class="dv">4</span>, <span class="dv">7</span>, <span class="dv">10</span>, <span class="dv">14</span>, <span class="dv">21</span>, <span class="dv">42</span>, <span class="dv">61</span>, <span class="dv">96</span>, <span class="dv">124</span>), <span class="dt">Z0 =</span> <span class="kw">c</span>(<span class="dv">100</span>, <span class="fl">81.7</span>, <span class="fl">70.4</span>, <span class="fl">51.1</span>, <span class="fl">41.2</span>, <span class="fl">6.6</span>, <span class="fl">4.6</span>, <span class="fl">3.9</span>, <span class="fl">4.6</span>, <span class="fl">4.3</span>, <span class="fl">6.8</span>, <span class="fl">2.9</span>, <span class="fl">3.5</span>, <span class="fl">5.3</span>, <span class="fl">4.4</span>, <span class="fl">1.2</span>, <span class="fl">0.7</span>), <span class="dt">Z1 =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="fl">18.3</span>, <span class="fl">29.6</span>, <span class="fl">46.3</span>, <span class="fl">55.1</span>, <span class="fl">65.7</span>, <span class="fl">39.1</span>, <span class="dv">36</span>, <span class="fl">15.3</span>, <span class="fl">5.6</span>, <span class="fl">1.1</span>, - <span class="fl">1.6</span>, <span class="fl">0.6</span>, <span class="fl">0.5</span> *<span class="st"> </span>LOD, <span class="ot">NA</span>, <span class="ot">NA</span>, <span class="ot">NA</span>), - <span class="dt">Z2 =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="ot">NA</span>, <span class="fl">0.5</span> *<span class="st"> </span>LOD, <span class="fl">2.6</span>, <span class="fl">3.8</span>, <span class="fl">15.3</span>, <span class="fl">37.2</span>, <span class="fl">31.7</span>, <span class="fl">35.6</span>, <span class="fl">14.5</span>, - <span class="fl">0.8</span>, <span class="fl">2.1</span>, <span class="fl">1.9</span>, <span class="fl">0.5</span> *<span class="st"> </span>LOD, <span class="ot">NA</span>, <span class="ot">NA</span>, <span class="ot">NA</span>), - <span class="dt">Z3 =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="ot">NA</span>, <span class="ot">NA</span>, <span class="ot">NA</span>, <span class="ot">NA</span>, <span class="fl">0.5</span> *<span class="st"> </span>LOD, <span class="fl">9.2</span>, <span class="fl">13.1</span>, <span class="fl">22.3</span>, <span class="fl">28.4</span>, <span class="fl">32.5</span>, + <span class="fl">1.6</span>, <span class="fl">0.6</span>, <span class="fl">0.5</span> <span class="op">*</span><span class="st"> </span>LOD, <span class="ot">NA</span>, <span class="ot">NA</span>, <span class="ot">NA</span>), + <span class="dt">Z2 =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="ot">NA</span>, <span class="fl">0.5</span> <span class="op">*</span><span class="st"> </span>LOD, <span class="fl">2.6</span>, <span class="fl">3.8</span>, <span class="fl">15.3</span>, <span class="fl">37.2</span>, <span class="fl">31.7</span>, <span class="fl">35.6</span>, <span class="fl">14.5</span>, + <span class="fl">0.8</span>, <span class="fl">2.1</span>, <span class="fl">1.9</span>, <span class="fl">0.5</span> <span class="op">*</span><span class="st"> </span>LOD, <span class="ot">NA</span>, <span class="ot">NA</span>, <span class="ot">NA</span>), + <span class="dt">Z3 =</span> <span class="kw">c</span>(<span class="dv">0</span>, <span class="ot">NA</span>, <span class="ot">NA</span>, <span class="ot">NA</span>, <span class="ot">NA</span>, <span class="fl">0.5</span> <span class="op">*</span><span class="st"> </span>LOD, <span class="fl">9.2</span>, <span class="fl">13.1</span>, <span class="fl">22.3</span>, <span class="fl">28.4</span>, <span class="fl">32.5</span>, <span class="fl">25.2</span>, <span class="fl">17.2</span>, <span class="fl">4.8</span>, <span class="fl">4.5</span>, <span class="fl">2.8</span>, <span class="fl">4.4</span>)) -FOCUS_2006_Z_mkin <-<span class="st"> </span><span class="kw"><a href="../reference/mkin_wide_to_long.html">mkin_wide_to_long</a></span>(FOCUS_2006_Z)</code></pre></div> +FOCUS_<span class="dv">2006</span>_Z_mkin <-<span class="st"> </span><span class="kw"><a href="../reference/mkin_wide_to_long.html">mkin_wide_to_long</a></span>(FOCUS_<span class="dv">2006</span>_Z)</code></pre></div> </div> <div id="parent-and-one-metabolite" class="section level1"> <h1 class="hasAnchor"> <a href="#parent-and-one-metabolite" class="anchor"></a>Parent and one metabolite</h1> <p>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).</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">Z.2a <-<span class="st"> </span><span class="kw"><a href="../reference/mkinmod.html">mkinmod</a></span>(<span class="dt">Z0 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"Z1"</span>), +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">Z<span class="fl">.2</span>a <-<span class="st"> </span><span class="kw"><a href="../reference/mkinmod.html">mkinmod</a></span>(<span class="dt">Z0 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"Z1"</span>), <span class="dt">Z1 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))</code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z.2a <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z.2a, FOCUS_2006_Z_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) -<span class="kw"><a href="../reference/plot.mkinfit.html">plot_sep</a></span>(m.Z.2a)</code></pre></div> +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z<span class="fl">.2</span>a <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z<span class="fl">.2</span>a, FOCUS_<span class="dv">2006</span>_Z_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) +<span class="kw"><a href="../reference/plot.mkinfit.html">plot_sep</a></span>(m.Z<span class="fl">.2</span>a)</code></pre></div> <p><img src="FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png" width="672"></p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(m.Z.2a, <span class="dt">data =</span> <span class="ot">FALSE</span>)$bpar</code></pre></div> -<pre><code>## Estimate se_notrans t value Pr(>t) Lower Upper -## Z0_0 9.7015e+01 3.553135 2.7304e+01 1.6792e-21 91.4014 102.62838 -## k_Z0_sink 6.2135e-10 0.226894 2.7385e-09 5.0000e-01 0.0000 Inf -## k_Z0_Z1 2.2360e+00 0.165073 1.3546e+01 7.3939e-14 1.8374 2.72107 -## k_Z1_sink 4.8212e-01 0.065854 7.3212e+00 3.5520e-08 0.4006 0.58024</code></pre> +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(m.Z<span class="fl">.2</span>a, <span class="dt">data =</span> <span class="ot">FALSE</span>)<span class="op">$</span>bpar</code></pre></div> +<pre><code>## Estimate se_notrans t value Pr(>t) Lower Upper +## Z0_0 9.7015e+01 3.553140 2.7304e+01 1.6793e-21 NA NA +## k_Z0_sink 1.2790e-11 0.226895 5.6368e-11 5.0000e-01 NA NA +## k_Z0_Z1 2.2360e+00 0.165073 1.3546e+01 7.3938e-14 NA NA +## k_Z1_sink 4.8212e-01 0.065854 7.3212e+00 3.5520e-08 NA NA</code></pre> <p>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.</p> <p>A similar result can be obtained when formation fractions are used in the model formulation:</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">Z.2a.ff <-<span class="st"> </span><span class="kw"><a href="../reference/mkinmod.html">mkinmod</a></span>(<span class="dt">Z0 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"Z1"</span>), +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">Z<span class="fl">.2</span>a.ff <-<span class="st"> </span><span class="kw"><a href="../reference/mkinmod.html">mkinmod</a></span>(<span class="dt">Z0 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"Z1"</span>), <span class="dt">Z1 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>), <span class="dt">use_of_ff =</span> <span class="st">"max"</span>)</code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z.2a.ff <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z.2a.ff, FOCUS_2006_Z_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) -<span class="kw"><a href="../reference/plot.mkinfit.html">plot_sep</a></span>(m.Z.2a.ff)</code></pre></div> +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z<span class="fl">.2</span>a.ff <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z<span class="fl">.2</span>a.ff, FOCUS_<span class="dv">2006</span>_Z_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) +<span class="kw"><a href="../reference/plot.mkinfit.html">plot_sep</a></span>(m.Z<span class="fl">.2</span>a.ff)</code></pre></div> <p><img src="FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png" width="672"></p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(m.Z.2a.ff, <span class="dt">data =</span> <span class="ot">FALSE</span>)$bpar</code></pre></div> +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(m.Z<span class="fl">.2</span>a.ff, <span class="dt">data =</span> <span class="ot">FALSE</span>)<span class="op">$</span>bpar</code></pre></div> <pre><code>## Estimate se_notrans t value Pr(>t) Lower Upper -## Z0_0 97.01488 3.553146 27.3039 1.6793e-21 NA NA -## k_Z0 2.23601 0.216847 10.3114 3.6617e-11 NA NA +## Z0_0 97.01488 3.553145 27.3039 1.6793e-21 NA NA +## k_Z0 2.23601 0.216849 10.3114 3.6623e-11 NA NA ## k_Z1 0.48212 0.065854 7.3211 3.5520e-08 NA NA -## f_Z0_to_Z1 1.00000 0.101473 9.8548 9.7071e-11 NA NA</code></pre> +## f_Z0_to_Z1 1.00000 0.101473 9.8548 9.7068e-11 NA NA</code></pre> <p>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.</p> <p>A simplified model is obtained by removing the pathway to the sink. </p> <p>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.</p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">Z<span class="fl">.3</span> <-<span class="st"> </span><span class="kw"><a href="../reference/mkinmod.html">mkinmod</a></span>(<span class="dt">Z0 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"Z1"</span>, <span class="dt">sink =</span> <span class="ot">FALSE</span>), <span class="dt">Z1 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>), <span class="dt">use_of_ff =</span> <span class="st">"max"</span>)</code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z<span class="fl">.3</span> <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z<span class="fl">.3</span>, FOCUS_2006_Z_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z<span class="fl">.3</span> <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z<span class="fl">.3</span>, FOCUS_<span class="dv">2006</span>_Z_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) <span class="kw"><a href="../reference/plot.mkinfit.html">plot_sep</a></span>(m.Z<span class="fl">.3</span>)</code></pre></div> <p><img src="FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png" width="672"></p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(m.Z<span class="fl">.3</span>, <span class="dt">data =</span> <span class="ot">FALSE</span>)$bpar</code></pre></div> +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(m.Z<span class="fl">.3</span>, <span class="dt">data =</span> <span class="ot">FALSE</span>)<span class="op">$</span>bpar</code></pre></div> <pre><code>## Estimate se_notrans t value Pr(>t) Lower Upper -## Z0_0 97.01488 2.681771 36.176 2.3636e-25 91.52152 102.508 -## k_Z0 2.23601 0.146862 15.225 2.2470e-15 1.95453 2.558 +## Z0_0 97.01488 2.681772 36.176 2.3636e-25 91.52152 102.508 +## k_Z0 2.23601 0.146861 15.225 2.2464e-15 1.95453 2.558 ## k_Z1 0.48212 0.042687 11.294 3.0686e-12 0.40216 0.578</code></pre> <p>As there is only one transformation product for Z0 and no pathway to sink, the formation fraction is internally fixed to unity.</p> </div> @@ -159,7 +162,7 @@ FOCUS_2006_Z_mkin <-<span class="st"> </span><span class="kw"><a href="../ref <span class="dt">Z1 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"Z2"</span>, <span class="dt">sink =</span> <span class="ot">FALSE</span>), <span class="dt">Z2 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>), <span class="dt">use_of_ff =</span> <span class="st">"max"</span>)</code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z<span class="fl">.5</span> <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z<span class="fl">.5</span>, FOCUS_2006_Z_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z<span class="fl">.5</span> <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z<span class="fl">.5</span>, FOCUS_<span class="dv">2006</span>_Z_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) <span class="kw"><a href="../reference/plot.mkinfit.html">plot_sep</a></span>(m.Z<span class="fl">.5</span>)</code></pre></div> <p><img src="FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png" width="672"></p> <p>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.</p> @@ -169,25 +172,25 @@ FOCUS_2006_Z_mkin <-<span class="st"> </span><span class="kw"><a href="../ref <span class="dt">Z3 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>), <span class="dt">use_of_ff =</span> <span class="st">"max"</span>)</code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z.FOCUS <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z.FOCUS, FOCUS_2006_Z_mkin, - <span class="dt">parms.ini =</span> m.Z<span class="fl">.5</span>$bparms.ode, +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z.FOCUS <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z.FOCUS, FOCUS_<span class="dv">2006</span>_Z_mkin, + <span class="dt">parms.ini =</span> m.Z<span class="fl">.5</span><span class="op">$</span>bparms.ode, <span class="dt">quiet =</span> <span class="ot">TRUE</span>)</code></pre></div> <pre><code>## Warning in mkinfit(Z.FOCUS, FOCUS_2006_Z_mkin, parms.ini = m.Z.5$bparms.ode, : Optimisation by method Port did not converge. ## Convergence code is 1</code></pre> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw"><a href="../reference/plot.mkinfit.html">plot_sep</a></span>(m.Z.FOCUS)</code></pre></div> <p><img src="FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png" width="672"></p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(m.Z.FOCUS, <span class="dt">data =</span> <span class="ot">FALSE</span>)$bpar</code></pre></div> -<pre><code>## Estimate se_notrans t value Pr(>t) Lower Upper -## Z0_0 96.84024 2.058814 47.0369 5.5723e-44 92.706852 100.973637 -## k_Z0 2.21540 0.118128 18.7543 7.7369e-25 1.990504 2.465708 -## k_Z1 0.47836 0.029294 16.3298 3.3443e-22 0.423035 0.540918 -## k_Z2 0.45166 0.044186 10.2218 3.0364e-14 0.371065 0.549767 -## k_Z3 0.05869 0.014290 4.1072 7.2560e-05 0.035983 0.095725 -## f_Z2_to_Z3 0.47147 0.057027 8.2676 2.7790e-11 0.360295 0.585556</code></pre> +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(m.Z.FOCUS, <span class="dt">data =</span> <span class="ot">FALSE</span>)<span class="op">$</span>bpar</code></pre></div> +<pre><code>## Estimate se_notrans t value Pr(>t) Lower Upper +## Z0_0 96.837112 2.058861 47.0343 5.5877e-44 92.703779 100.970445 +## k_Z0 2.215368 0.118098 18.7587 7.6563e-25 1.990525 2.465609 +## k_Z1 0.478302 0.029289 16.3302 3.3408e-22 0.422977 0.540864 +## k_Z2 0.451617 0.044214 10.2144 3.1133e-14 0.371034 0.549702 +## k_Z3 0.058693 0.014296 4.1056 7.2924e-05 0.035994 0.095705 +## f_Z2_to_Z3 0.471516 0.057057 8.2639 2.8156e-11 0.360381 0.585548</code></pre> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw"><a href="../reference/endpoints.html">endpoints</a></span>(m.Z.FOCUS)</code></pre></div> <pre><code>## $ff ## Z2_Z3 Z2_sink -## 0.47147 0.52853 +## 0.47152 0.52848 ## ## $SFORB ## logical(0) @@ -195,9 +198,9 @@ FOCUS_2006_Z_mkin <-<span class="st"> </span><span class="kw"><a href="../ref ## $distimes ## DT50 DT90 ## Z0 0.31288 1.0394 -## Z1 1.44901 4.8135 -## Z2 1.53466 5.0980 -## Z3 11.81037 39.2332</code></pre> +## Z1 1.44918 4.8141 +## Z2 1.53481 5.0985 +## Z3 11.80973 39.2311</code></pre> <p>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.</p> </div> <div id="using-the-sforb-model" class="section level1"> @@ -210,17 +213,17 @@ FOCUS_2006_Z_mkin <-<span class="st"> </span><span class="kw"><a href="../ref <span class="dt">Z2 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"Z3"</span>), <span class="dt">Z3 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFORB"</span>))</code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z.mkin<span class="fl">.1</span> <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z.mkin<span class="fl">.1</span>, FOCUS_2006_Z_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z.mkin<span class="fl">.1</span> <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z.mkin<span class="fl">.1</span>, FOCUS_<span class="dv">2006</span>_Z_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) <span class="kw"><a href="../reference/plot.mkinfit.html">plot_sep</a></span>(m.Z.mkin<span class="fl">.1</span>)</code></pre></div> <p><img src="FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png" width="672"></p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(m.Z.mkin<span class="fl">.1</span>, <span class="dt">data =</span> <span class="ot">FALSE</span>)$cov.unscaled</code></pre></div> +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">summary</span>(m.Z.mkin<span class="fl">.1</span>, <span class="dt">data =</span> <span class="ot">FALSE</span>)<span class="op">$</span>cov.unscaled</code></pre></div> <pre><code>## NULL</code></pre> <p>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.</p> <div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">Z.mkin<span class="fl">.3</span> <-<span class="st"> </span><span class="kw"><a href="../reference/mkinmod.html">mkinmod</a></span>(<span class="dt">Z0 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFORB"</span>, <span class="st">"Z1"</span>, <span class="dt">sink =</span> <span class="ot">FALSE</span>), <span class="dt">Z1 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"Z2"</span>, <span class="dt">sink =</span> <span class="ot">FALSE</span>), <span class="dt">Z2 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))</code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z.mkin<span class="fl">.3</span> <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z.mkin<span class="fl">.3</span>, FOCUS_2006_Z_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z.mkin<span class="fl">.3</span> <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z.mkin<span class="fl">.3</span>, FOCUS_<span class="dv">2006</span>_Z_mkin, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) <span class="kw"><a href="../reference/plot.mkinfit.html">plot_sep</a></span>(m.Z.mkin<span class="fl">.3</span>)</code></pre></div> <p><img src="FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png" width="672"></p> <p>This results in a much better representation of the behaviour of the parent compound Z0.</p> @@ -230,8 +233,8 @@ FOCUS_2006_Z_mkin <-<span class="st"> </span><span class="kw"><a href="../ref <span class="dt">Z2 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"Z3"</span>), <span class="dt">Z3 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))</code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z.mkin<span class="fl">.4</span> <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z.mkin<span class="fl">.4</span>, FOCUS_2006_Z_mkin, - <span class="dt">parms.ini =</span> m.Z.mkin<span class="fl">.3</span>$bparms.ode, +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z.mkin<span class="fl">.4</span> <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z.mkin<span class="fl">.4</span>, FOCUS_<span class="dv">2006</span>_Z_mkin, + <span class="dt">parms.ini =</span> m.Z.mkin<span class="fl">.3</span><span class="op">$</span>bparms.ode, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) <span class="kw"><a href="../reference/plot.mkinfit.html">plot_sep</a></span>(m.Z.mkin<span class="fl">.4</span>)</code></pre></div> <p><img src="FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png" width="672"></p> @@ -241,36 +244,36 @@ FOCUS_2006_Z_mkin <-<span class="st"> </span><span class="kw"><a href="../ref <span class="dt">Z2 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>, <span class="st">"Z3"</span>), <span class="dt">Z3 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFORB"</span>))</code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z.mkin<span class="fl">.5</span> <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z.mkin<span class="fl">.5</span>, FOCUS_2006_Z_mkin, - <span class="dt">parms.ini =</span> m.Z.mkin<span class="fl">.4</span>$bparms.ode[<span class="dv">1</span>:<span class="dv">4</span>], +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z.mkin<span class="fl">.5</span> <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z.mkin<span class="fl">.5</span>, FOCUS_<span class="dv">2006</span>_Z_mkin, + <span class="dt">parms.ini =</span> m.Z.mkin<span class="fl">.4</span><span class="op">$</span>bparms.ode[<span class="dv">1</span><span class="op">:</span><span class="dv">4</span>], <span class="dt">quiet =</span> <span class="ot">TRUE</span>) <span class="kw"><a href="../reference/plot.mkinfit.html">plot_sep</a></span>(m.Z.mkin<span class="fl">.5</span>)</code></pre></div> <p><img src="FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png" width="672"></p> <p>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.</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z.mkin.5a <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z.mkin<span class="fl">.5</span>, FOCUS_2006_Z_mkin, - <span class="dt">parms.ini =</span> <span class="kw">c</span>(m.Z.mkin<span class="fl">.5</span>$bparms.ode[<span class="dv">1</span>:<span class="dv">7</span>], +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">m.Z.mkin<span class="fl">.5</span>a <-<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(Z.mkin<span class="fl">.5</span>, FOCUS_<span class="dv">2006</span>_Z_mkin, + <span class="dt">parms.ini =</span> <span class="kw">c</span>(m.Z.mkin<span class="fl">.5</span><span class="op">$</span>bparms.ode[<span class="dv">1</span><span class="op">:</span><span class="dv">7</span>], <span class="dt">k_Z3_bound_free =</span> <span class="dv">0</span>), <span class="dt">fixed_parms =</span> <span class="st">"k_Z3_bound_free"</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>) -<span class="kw"><a href="../reference/plot.mkinfit.html">plot_sep</a></span>(m.Z.mkin.5a)</code></pre></div> +<span class="kw"><a href="../reference/plot.mkinfit.html">plot_sep</a></span>(m.Z.mkin<span class="fl">.5</span>a)</code></pre></div> <p><img src="FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png" width="672"></p> <p>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.</p> <p>A graphical representation of the confidence intervals can finally be obtained.</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw"><a href="../reference/mkinparplot.html">mkinparplot</a></span>(m.Z.mkin.5a)</code></pre></div> +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw"><a href="../reference/mkinparplot.html">mkinparplot</a></span>(m.Z.mkin<span class="fl">.5</span>a)</code></pre></div> <p><img src="FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png" width="672"></p> <p>The endpoints obtained with this model are</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw"><a href="../reference/endpoints.html">endpoints</a></span>(m.Z.mkin.5a)</code></pre></div> +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw"><a href="../reference/endpoints.html">endpoints</a></span>(m.Z.mkin<span class="fl">.5</span>a)</code></pre></div> <pre><code>## $ff ## Z0_free_Z1 Z1_Z2 Z2_sink Z2_Z3_free Z3_free_sink ## 1.00000 1.00000 0.46344 0.53656 1.00000 ## ## $SFORB ## Z0_b1 Z0_b2 Z3_b1 Z3_b2 -## 2.4471373 0.0075126 0.0800076 0.0000000 +## 2.4471382 0.0075127 0.0800075 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.265 NA NA +## Z0 0.3043 1.1848 0.28325 92.264 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.6635 Inf</code></pre> @@ -291,7 +294,8 @@ FOCUS_2006_Z_mkin <-<span class="st"> </span><span class="kw"><a href="../ref <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> <div id="tocnav"> - <h2>Contents</h2> + <h2 class="hasAnchor"> +<a href="#tocnav" class="anchor"></a>Contents</h2> <ul class="nav nav-pills nav-stacked"> <li><a href="#the-data">The data</a></li> <li><a href="#parent-and-one-metabolite">Parent and one metabolite</a></li> @@ -310,7 +314,7 @@ FOCUS_2006_Z_mkin <-<span class="st"> </span><span class="kw"><a href="../ref </div> <div class="pkgdown"> - <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> + <p>Site built with <a href="http://pkgdown.r-lib.org/">pkgdown</a>.</p> </div> </footer> diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png Binary files differindex cb32b3c6..b66289d9 100644 --- a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png +++ b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_1-1.png diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png Binary files differindex 7ce8a39c..af26f416 100644 --- a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png +++ b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_10-1.png diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png Binary files differindex a7528057..d4e7a647 100644 --- a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png +++ b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11-1.png diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png Binary files differindex 3fe80d42..8c6d81ef 100644 --- a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png +++ b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11a-1.png diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png Binary files differindex ff0dbbbd..fffb4892 100644 --- a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png +++ b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_11b-1.png diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png Binary files differindex dfe447ed..0ac5b6ce 100644 --- a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png +++ b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_2-1.png diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png Binary files differindex 8f7102aa..87226454 100644 --- a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png +++ b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_3-1.png diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png Binary files differindex 74a82e2b..58241d1d 100644 --- a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png +++ b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_5-1.png diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png Binary files differindex 7042e390..381e7df5 100644 --- a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png +++ b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_6-1.png diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png Binary files differindex 29824228..19e73f1c 100644 --- a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png +++ b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_7-1.png diff --git a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png Binary files differindex 79f1b87e..891d8d92 100644 --- a/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png +++ b/docs/articles/FOCUS_Z_files/figure-html/FOCUS_2006_Z_fits_9-1.png diff --git a/docs/articles/compiled_models.R b/docs/articles/compiled_models.R deleted file mode 100644 index c5b06c11..00000000 --- a/docs/articles/compiled_models.R +++ /dev/null @@ -1,55 +0,0 @@ -## ---- include = FALSE---------------------------------------------------- -library(knitr) -opts_chunk$set(tidy = FALSE, cache = FALSE) - -## ----check_gcc----------------------------------------------------------- -Sys.which("gcc") - -## ----create_SFO_SFO------------------------------------------------------ -library("mkin", quietly = TRUE) -SFO_SFO <- mkinmod( - parent = mkinsub("SFO", "m1"), - m1 = mkinsub("SFO")) - -## ----benchmark_SFO_SFO, fig.height = 3----------------------------------- -if (require(rbenchmark)) { - b.1 <- benchmark( - "deSolve, not compiled" = mkinfit(SFO_SFO, FOCUS_2006_D, - solution_type = "deSolve", - use_compiled = FALSE, quiet = TRUE), - "Eigenvalue based" = mkinfit(SFO_SFO, FOCUS_2006_D, - solution_type = "eigen", quiet = TRUE), - "deSolve, compiled" = mkinfit(SFO_SFO, FOCUS_2006_D, - solution_type = "deSolve", quiet = TRUE), - replications = 3) - print(b.1) - factor_SFO_SFO <- round(b.1["1", "relative"]) -} else { - factor_SFO_SFO <- NA - print("R package benchmark is not available") -} - -## ----benchmark_FOMC_SFO, fig.height = 3---------------------------------- -if (require(rbenchmark)) { - FOMC_SFO <- mkinmod( - parent = mkinsub("FOMC", "m1"), - m1 = mkinsub( "SFO")) - - b.2 <- benchmark( - "deSolve, not compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D, - use_compiled = FALSE, quiet = TRUE), - "deSolve, compiled" = mkinfit(FOMC_SFO, FOCUS_2006_D, quiet = TRUE), - replications = 3) - print(b.2) - factor_FOMC_SFO <- round(b.2["1", "relative"]) -} else { - factor_FOMC_SFO <- NA - print("R package benchmark is not available") -} - -## ----sessionInfo, echo = FALSE------------------------------------------- -cat(capture.output(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/docs/articles/compiled_models.html b/docs/articles/compiled_models.html index d5d29a1a..9f0b5708 100644 --- a/docs/articles/compiled_models.html +++ b/docs/articles/compiled_models.html @@ -8,8 +8,11 @@ <title>Performance benefit by using compiled model definitions in mkin • mkin</title> <!-- jquery --><script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script><!-- Font Awesome icons --><link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> -<!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> -<script src="../jquery.sticky-kit.min.js"></script><script src="../pkgdown.js"></script><!-- mathjax --><script src="https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!--[if lt IE 9]> +<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js" integrity="sha384-cV+rhyOuRHc9Ub/91rihWcGmMmCXDeksTtCihMupQHSsi8GIIRDG0ThDc3HGQFJ3" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script><script src="../pkgdown.js"></script><meta property="og:title" content="Performance benefit by using compiled model definitions in mkin"> +<meta property="og:description" content=""> +<meta name="twitter:card" content="summary"> +<!-- mathjax --><script src="https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> @@ -77,7 +80,7 @@ <h1>Performance benefit by using compiled model definitions in mkin</h1> <h4 class="author">Johannes Ranke</h4> - <h4 class="date">2018-01-16</h4> + <h4 class="date">2018-03-01</h4> </div> @@ -97,73 +100,66 @@ SFO_SFO <-<span class="st"> </span><span class="kw"><a href="../reference/mki <span class="dt">m1 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"SFO"</span>))</code></pre></div> <pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> <p>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.</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">if (<span class="kw">require</span>(rbenchmark)) { +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="cf">if</span> (<span class="kw">require</span>(rbenchmark)) { b<span class="fl">.1</span> <-<span class="st"> </span><span class="kw">benchmark</span>( - <span class="st">"deSolve, not compiled"</span> =<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_2006_D, + <span class="st">"deSolve, not compiled"</span> =<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_<span class="dv">2006</span>_D, <span class="dt">solution_type =</span> <span class="st">"deSolve"</span>, <span class="dt">use_compiled =</span> <span class="ot">FALSE</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>), - <span class="st">"Eigenvalue based"</span> =<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_2006_D, + <span class="st">"Eigenvalue based"</span> =<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_<span class="dv">2006</span>_D, <span class="dt">solution_type =</span> <span class="st">"eigen"</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>), - <span class="st">"deSolve, compiled"</span> =<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_2006_D, + <span class="st">"deSolve, compiled"</span> =<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(SFO_SFO, FOCUS_<span class="dv">2006</span>_D, <span class="dt">solution_type =</span> <span class="st">"deSolve"</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>), <span class="dt">replications =</span> <span class="dv">3</span>) <span class="kw">print</span>(b<span class="fl">.1</span>) factor_SFO_SFO <-<span class="st"> </span><span class="kw">round</span>(b<span class="fl">.1</span>[<span class="st">"1"</span>, <span class="st">"relative"</span>]) -} else { +} <span class="cf">else</span> { factor_SFO_SFO <-<span class="st"> </span><span class="ot">NA</span> <span class="kw">print</span>(<span class="st">"R package benchmark is not available"</span>) }</code></pre></div> <pre><code>## Lade nötiges Paket: rbenchmark</code></pre> -<pre><code>## test replications elapsed relative user.self sys.self -## 3 deSolve, compiled 3 1.940 1.000 1.940 0 -## 1 deSolve, not compiled 3 13.865 7.147 13.864 0 -## 2 Eigenvalue based 3 2.427 1.251 2.428 0 -## user.child sys.child -## 3 0 0 -## 1 0 0 -## 2 0 0</code></pre> -<p>We see that using the compiled model is by a factor of around 7 faster than using the R version with the default ode solver, and it is even faster than the Eigenvalue based solution implemented in R which does not need iterative solution of the ODEs.</p> +<pre><code>## Warning in library(package, lib.loc = lib.loc, character.only = TRUE, +## logical.return = TRUE, : es gibt kein Paket namens 'rbenchmark'</code></pre> +<pre><code>## [1] "R package benchmark is not available"</code></pre> +<p>We see that using the compiled model is by a factor of around NA faster than using the R version with the default ode solver, and it is even faster than the Eigenvalue based solution implemented in R which does not need iterative solution of the ODEs.</p> </div> <div id="model-that-can-not-be-solved-with-eigenvalues" class="section level2"> <h2 class="hasAnchor"> <a href="#model-that-can-not-be-solved-with-eigenvalues" class="anchor"></a>Model that can not be solved with Eigenvalues</h2> <p>This evaluation is also taken from the example section of mkinfit.</p> -<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">if (<span class="kw">require</span>(rbenchmark)) { +<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="cf">if</span> (<span class="kw">require</span>(rbenchmark)) { FOMC_SFO <-<span class="st"> </span><span class="kw"><a href="../reference/mkinmod.html">mkinmod</a></span>( <span class="dt">parent =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>(<span class="st">"FOMC"</span>, <span class="st">"m1"</span>), <span class="dt">m1 =</span> <span class="kw"><a href="../reference/mkinsub.html">mkinsub</a></span>( <span class="st">"SFO"</span>)) b<span class="fl">.2</span> <-<span class="st"> </span><span class="kw">benchmark</span>( - <span class="st">"deSolve, not compiled"</span> =<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(FOMC_SFO, FOCUS_2006_D, + <span class="st">"deSolve, not compiled"</span> =<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(FOMC_SFO, FOCUS_<span class="dv">2006</span>_D, <span class="dt">use_compiled =</span> <span class="ot">FALSE</span>, <span class="dt">quiet =</span> <span class="ot">TRUE</span>), - <span class="st">"deSolve, compiled"</span> =<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(FOMC_SFO, FOCUS_2006_D, <span class="dt">quiet =</span> <span class="ot">TRUE</span>), + <span class="st">"deSolve, compiled"</span> =<span class="st"> </span><span class="kw"><a href="../reference/mkinfit.html">mkinfit</a></span>(FOMC_SFO, FOCUS_<span class="dv">2006</span>_D, <span class="dt">quiet =</span> <span class="ot">TRUE</span>), <span class="dt">replications =</span> <span class="dv">3</span>) <span class="kw">print</span>(b<span class="fl">.2</span>) factor_FOMC_SFO <-<span class="st"> </span><span class="kw">round</span>(b<span class="fl">.2</span>[<span class="st">"1"</span>, <span class="st">"relative"</span>]) -} else { +} <span class="cf">else</span> { factor_FOMC_SFO <-<span class="st"> </span><span class="ot">NA</span> <span class="kw">print</span>(<span class="st">"R package benchmark is not available"</span>) }</code></pre></div> -<pre><code>## Successfully compiled differential equation model from auto-generated C code.</code></pre> -<pre><code>## test replications elapsed relative user.self sys.self -## 2 deSolve, compiled 3 3.432 1.000 3.428 0 -## 1 deSolve, not compiled 3 28.844 8.404 28.840 0 -## user.child sys.child -## 2 0 0 -## 1 0 0</code></pre> -<p>Here we get a performance benefit of a factor of 8 using the version of the differential equation model compiled from C code!</p> -<p>This vignette was built with mkin 0.9.47.1 on</p> +<pre><code>## Lade nötiges Paket: rbenchmark</code></pre> +<pre><code>## Warning in library(package, lib.loc = lib.loc, character.only = TRUE, +## logical.return = TRUE, : es gibt kein Paket namens 'rbenchmark'</code></pre> +<pre><code>## [1] "R package benchmark is not available"</code></pre> +<p>Here we get a performance benefit of a factor of NA using the version of the differential equation model compiled from C code!</p> +<p>This vignette was built with mkin 0.9.46.3 on</p> <pre><code>## R version 3.4.3 (2017-11-30) ## Platform: x86_64-pc-linux-gnu (64-bit) ## Running under: Debian GNU/Linux 9 (stretch)</code></pre> -<pre><code>## CPU model: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz</code></pre> +<pre><code>## CPU model: AMD Ryzen 7 1700 Eight-Core Processor</code></pre> </div> </div> </div> <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> <div id="tocnav"> - <h2>Contents</h2> + <h2 class="hasAnchor"> +<a href="#tocnav" class="anchor"></a>Contents</h2> <ul class="nav nav-pills nav-stacked"> <li><a href="#model-that-can-also-be-solved-with-eigenvalues">Model that can also be solved with Eigenvalues</a></li> <li><a href="#model-that-can-not-be-solved-with-eigenvalues">Model that can not be solved with Eigenvalues</a></li> @@ -179,7 +175,7 @@ SFO_SFO <-<span class="st"> </span><span class="kw"><a href="../reference/mki </div> <div class="pkgdown"> - <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> + <p>Site built with <a href="http://pkgdown.r-lib.org/">pkgdown</a>.</p> </div> </footer> diff --git a/docs/articles/compiled_models_files/figure-html/benchmark_FOMC_SFO-1.png b/docs/articles/compiled_models_files/figure-html/benchmark_FOMC_SFO-1.png Binary files differdeleted file mode 100644 index dae2c9d4..00000000 --- a/docs/articles/compiled_models_files/figure-html/benchmark_FOMC_SFO-1.png +++ /dev/null diff --git a/docs/articles/compiled_models_files/figure-html/benchmark_SFO_SFO-1.png b/docs/articles/compiled_models_files/figure-html/benchmark_SFO_SFO-1.png Binary files differdeleted file mode 100644 index 696236dc..00000000 --- a/docs/articles/compiled_models_files/figure-html/benchmark_SFO_SFO-1.png +++ /dev/null diff --git a/docs/articles/header.tex b/docs/articles/header.tex deleted file mode 100644 index b8644ae2..00000000 --- a/docs/articles/header.tex +++ /dev/null @@ -1,22 +0,0 @@ -\usepackage{booktabs} -\usepackage{amsfonts} -\usepackage{latexsym} -\usepackage{amsmath} -\usepackage{amssymb} -\usepackage{graphicx} -\usepackage{parskip} -\usepackage[round]{natbib} -\usepackage{amstext} -\usepackage{hyperref} - -\newcommand{\Rpackage}[1]{{\normalfont\fontseries{b}\selectfont #1}} -\newcommand{\Robject}[1]{\texttt{#1}} -\newcommand{\Rclass}[1]{\textit{#1}} -\newcommand{\Rcmd}[1]{\texttt{#1}} - -\newcommand{\RR}{\textsf{R}} - -\RequirePackage[T1]{fontenc} -\RequirePackage{graphicx,ae,fancyvrb} -\IfFileExists{upquote.sty}{\RequirePackage{upquote}}{} -\usepackage{relsize} diff --git a/docs/articles/index.html b/docs/articles/index.html index c1dc0b64..2b16580a 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -18,12 +18,16 @@ <!-- Font Awesome icons --> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> +<!-- clipboard.js --> +<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js" integrity="sha384-cV+rhyOuRHc9Ub/91rihWcGmMmCXDeksTtCihMupQHSsi8GIIRDG0ThDc3HGQFJ3" crossorigin="anonymous"></script> <!-- pkgdown --> <link href="../pkgdown.css" rel="stylesheet"> <script src="../jquery.sticky-kit.min.js"></script> <script src="../pkgdown.js"></script> - + + +<meta property="og:title" content="Articles" /> <!-- mathjax --> <script src='https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> @@ -123,7 +127,7 @@ </div> <div class="pkgdown"> - <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> + <p>Site built with <a href="http://pkgdown.r-lib.org/">pkgdown</a>.</p> </div> </footer> diff --git a/docs/articles/mkin.R b/docs/articles/mkin.R deleted file mode 100644 index 19e80322..00000000 --- a/docs/articles/mkin.R +++ /dev/null @@ -1,34 +0,0 @@ -## ---- include = FALSE---------------------------------------------------- -require(knitr) -opts_chunk$set(engine='R', tidy=FALSE) - -## ---- echo = TRUE, cache = TRUE, fig = TRUE, fig.width = 8, fig.height = 7---- -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")) - diff --git a/docs/articles/mkin.html b/docs/articles/mkin.html index b70918ab..a91da0a4 100644 --- a/docs/articles/mkin.html +++ b/docs/articles/mkin.html @@ -8,8 +8,11 @@ <title>Introduction to mkin • mkin</title> <!-- jquery --><script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script><!-- Font Awesome icons --><link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> -<!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> -<script src="../jquery.sticky-kit.min.js"></script><script src="../pkgdown.js"></script><!-- mathjax --><script src="https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!--[if lt IE 9]> +<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js" integrity="sha384-cV+rhyOuRHc9Ub/91rihWcGmMmCXDeksTtCihMupQHSsi8GIIRDG0ThDc3HGQFJ3" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script><script src="../pkgdown.js"></script><meta property="og:title" content="Introduction to mkin"> +<meta property="og:description" content=""> +<meta name="twitter:card" content="summary"> +<!-- mathjax --><script src="https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> @@ -77,7 +80,7 @@ <h1>Introduction to mkin</h1> <h4 class="author">Johannes Ranke</h4> - <h4 class="date">2018-01-16</h4> + <h4 class="date">2018-03-01</h4> </div> @@ -100,15 +103,15 @@ m_SFO_SFO_SFO <-<span class="st"> </span><span class="kw"><a href="../referen sampling_times =<span class="st"> </span><span class="kw">c</span>(<span class="dv">0</span>, <span class="dv">1</span>, <span class="dv">3</span>, <span class="dv">7</span>, <span class="dv">14</span>, <span class="dv">28</span>, <span class="dv">60</span>, <span class="dv">90</span>, <span class="dv">120</span>) d_SFO_SFO_SFO <-<span class="st"> </span><span class="kw"><a href="../reference/mkinpredict.html">mkinpredict</a></span>(m_SFO_SFO_SFO, <span class="kw">c</span>(<span class="dt">k_parent =</span> <span class="fl">0.03</span>, - <span class="dt">f_parent_to_M1 =</span> <span class="fl">0.5</span>, <span class="dt">k_M1 =</span> <span class="kw">log</span>(<span class="dv">2</span>)/<span class="dv">100</span>, - <span class="dt">f_M1_to_M2 =</span> <span class="fl">0.9</span>, <span class="dt">k_M2 =</span> <span class="kw">log</span>(<span class="dv">2</span>)/<span class="dv">50</span>), + <span class="dt">f_parent_to_M1 =</span> <span class="fl">0.5</span>, <span class="dt">k_M1 =</span> <span class="kw">log</span>(<span class="dv">2</span>)<span class="op">/</span><span class="dv">100</span>, + <span class="dt">f_M1_to_M2 =</span> <span class="fl">0.9</span>, <span class="dt">k_M2 =</span> <span class="kw">log</span>(<span class="dv">2</span>)<span class="op">/</span><span class="dv">50</span>), <span class="kw">c</span>(<span class="dt">parent =</span> <span class="dv">100</span>, <span class="dt">M1 =</span> <span class="dv">0</span>, <span class="dt">M2 =</span> <span class="dv">0</span>), sampling_times) <span class="co"># Generate a dataset by adding normally distributed errors with</span> <span class="co"># standard deviation 3, for two replicates at each sampling time</span> d_SFO_SFO_SFO_err <-<span class="st"> </span><span class="kw"><a href="../reference/add_err.html">add_err</a></span>(d_SFO_SFO_SFO, <span class="dt">reps =</span> <span class="dv">2</span>, - <span class="dt">sdfunc =</span> function(x) <span class="dv">3</span>, + <span class="dt">sdfunc =</span> <span class="cf">function</span>(x) <span class="dv">3</span>, <span class="dt">n =</span> <span class="dv">1</span>, <span class="dt">seed =</span> <span class="dv">123456789</span> ) <span class="co"># Fit the model to the dataset</span> @@ -208,7 +211,8 @@ f_SFO_SFO_SFO <-<span class="st"> </span><span class="kw"><a href="../referen <div class="col-md-3 hidden-xs hidden-sm" id="sidebar"> <div id="tocnav"> - <h2>Contents</h2> + <h2 class="hasAnchor"> +<a href="#tocnav" class="anchor"></a>Contents</h2> <ul class="nav nav-pills nav-stacked"> <li><a href="#abstract">Abstract</a></li> <li> @@ -236,7 +240,7 @@ f_SFO_SFO_SFO <-<span class="st"> </span><span class="kw"><a href="../referen </div> <div class="pkgdown"> - <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> + <p>Site built with <a href="http://pkgdown.r-lib.org/">pkgdown</a>.</p> </div> </footer> diff --git a/docs/articles/mkin_files/figure-html/unnamed-chunk-2-1.png b/docs/articles/mkin_files/figure-html/unnamed-chunk-2-1.png Binary files differindex fafe8afd..5a3e3b6c 100644 --- a/docs/articles/mkin_files/figure-html/unnamed-chunk-2-1.png +++ b/docs/articles/mkin_files/figure-html/unnamed-chunk-2-1.png diff --git a/docs/articles/twa.R b/docs/articles/twa.R deleted file mode 100644 index 8b137891..00000000 --- a/docs/articles/twa.R +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/articles/twa.html b/docs/articles/twa.html index 086c8593..400b1383 100644 --- a/docs/articles/twa.html +++ b/docs/articles/twa.html @@ -8,8 +8,11 @@ <title>Calculation of time weighted average concentrations with mkin • mkin</title> <!-- jquery --><script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha384-nrOSfDHtoPMzJHjVTdCopGqIqeYETSXhZDFyniQ8ZHcVy08QesyHcnOUpMpqnmWq" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script><!-- Font Awesome icons --><link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous"> -<!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> -<script src="../jquery.sticky-kit.min.js"></script><script src="../pkgdown.js"></script><!-- mathjax --><script src="https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!--[if lt IE 9]> +<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js" integrity="sha384-cV+rhyOuRHc9Ub/91rihWcGmMmCXDeksTtCihMupQHSsi8GIIRDG0ThDc3HGQFJ3" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet"> +<script src="../jquery.sticky-kit.min.js"></script><script src="../pkgdown.js"></script><meta property="og:title" content="Calculation of time weighted average concentrations with mkin"> +<meta property="og:description" content=""> +<meta name="twitter:card" content="summary"> +<!-- mathjax --><script src="https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> @@ -77,7 +80,7 @@ <h1>Calculation of time weighted average concentrations with mkin</h1> <h4 class="author">Johannes Ranke</h4> - <h4 class="date">2018-01-16</h4> + <h4 class="date">2018-03-01</h4> </div> @@ -126,7 +129,7 @@ </div> <div class="pkgdown"> - <p>Site built with <a href="http://hadley.github.io/pkgdown/">pkgdown</a>.</p> + <p>Site built with <a href="http://pkgdown.r-lib.org/">pkgdown</a>.</p> </div> </footer> |