diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/dev/articles/web_only/multistart.html | 44 | ||||
-rw-r--r-- | docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-3-1.png | bin | 55167 -> 59606 bytes | |||
-rw-r--r-- | docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-4-1.png | bin | 21474 -> 55167 bytes | |||
-rw-r--r-- | docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-5-1.png | bin | 0 -> 21474 bytes | |||
-rw-r--r-- | docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-6-1.png | bin | 0 -> 54481 bytes | |||
-rw-r--r-- | docs/dev/pkgdown.yml | 2 | ||||
-rw-r--r-- | docs/dev/reference/Rplot001.png | bin | 1011 -> 19755 bytes | |||
-rw-r--r-- | docs/dev/reference/Rplot002.png | bin | 17010 -> 17365 bytes | |||
-rw-r--r-- | docs/dev/reference/multistart-1.png | bin | 59254 -> 59284 bytes | |||
-rw-r--r-- | docs/dev/reference/multistart-2.png | bin | 54149 -> 54871 bytes | |||
-rw-r--r-- | docs/dev/reference/multistart.html | 12 |
11 files changed, 35 insertions, 23 deletions
diff --git a/docs/dev/articles/web_only/multistart.html b/docs/dev/articles/web_only/multistart.html index 4af5def0..275fc520 100644 --- a/docs/dev/articles/web_only/multistart.html +++ b/docs/dev/articles/web_only/multistart.html @@ -109,7 +109,7 @@ <h1 data-toc-skip>Short demo of the multistart method</h1> <h4 data-toc-skip class="author">Johannes Ranke</h4> - <h4 data-toc-skip class="date">Last change 19 September 2022 (rebuilt 2022-10-26)</h4> + <h4 data-toc-skip class="date">Last change 26 September 2022 (rebuilt 2022-10-26)</h4> <small class="dont-index">Source: <a href="https://github.com/jranke/mkin/blob/HEAD/vignettes/web_only/multistart.rmd" class="external-link"><code>vignettes/web_only/multistart.rmd</code></a></small> <div class="hidden name"><code>multistart.rmd</code></div> @@ -118,7 +118,7 @@ -<p>This is a vignette, because the multistart method does not seem to work in pkgdown example code and I wanted to show the plots in the online docs. The dimethenamid data from 2018 from seven soils is used as example data.</p> +<p>The dimethenamid data from 2018 from seven soils is used as example data in this vignette.</p> <div class="sourceCode" id="cb1"><pre class="downlit sourceCode r"> <code class="sourceCode R"><span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">library</a></span><span class="op">(</span><span class="va"><a href="https://pkgdown.jrwb.de/mkin/">mkin</a></span><span class="op">)</span></span> <span><span class="va">dmta_ds</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/lapply.html" class="external-link">lapply</a></span><span class="op">(</span><span class="fl">1</span><span class="op">:</span><span class="fl">7</span>, <span class="kw">function</span><span class="op">(</span><span class="va">i</span><span class="op">)</span> <span class="op">{</span></span> @@ -134,20 +134,40 @@ <div class="sourceCode" id="cb2"><pre class="downlit sourceCode r"> <code class="sourceCode R"><span><span class="va">f_mmkin</span> <span class="op"><-</span> <span class="fu"><a href="../../reference/mmkin.html">mmkin</a></span><span class="op">(</span><span class="st">"DFOP"</span>, <span class="va">dmta_ds</span>, error_model <span class="op">=</span> <span class="st">"tc"</span>, cores <span class="op">=</span> <span class="fl">7</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span> <span><span class="va">f_saem_full</span> <span class="op"><-</span> <span class="fu"><a href="../../reference/saem.html">saem</a></span><span class="op">(</span><span class="va">f_mmkin</span><span class="op">)</span></span> -<span><span class="va">f_saem_full_multi</span> <span class="op"><-</span> <span class="fu"><a href="../../reference/multistart.html">multistart</a></span><span class="op">(</span><span class="va">f_saem_full</span>, n <span class="op">=</span> <span class="fl">16</span>, cores <span class="op">=</span> <span class="fl">16</span><span class="op">)</span></span> +<span><span class="fu"><a href="../../reference/illparms.html">illparms</a></span><span class="op">(</span><span class="va">f_saem_full</span><span class="op">)</span></span></code></pre></div> +<pre><code><span><span class="co">## [1] "sd(log_k2)"</span></span></code></pre> +<p>We see that not all variability parameters are identifiable. The <code>illparms</code> function tells us that the confidence interval for the standard deviation of ‘log_k2’ includes zero. We check this assessment using multiple runs with different starting values.</p> +<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r"> +<code class="sourceCode R"><span><span class="va">f_saem_full_multi</span> <span class="op"><-</span> <span class="fu"><a href="../../reference/multistart.html">multistart</a></span><span class="op">(</span><span class="va">f_saem_full</span>, n <span class="op">=</span> <span class="fl">16</span>, cores <span class="op">=</span> <span class="fl">16</span><span class="op">)</span></span> <span><span class="fu"><a href="../../reference/parhist.html">parhist</a></span><span class="op">(</span><span class="va">f_saem_full_multi</span><span class="op">)</span></span></code></pre></div> -<p><img src="multistart_files/figure-html/unnamed-chunk-2-1.png" width="700"></p> -<p>We see that not all variability parameters are identifiable, most problematic is the variance of k2. So we reduce the parameter distribution model by removing the intersoil variability for this parameter.</p> -<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r"> -<code class="sourceCode R"><span><span class="va">f_saem_reduced</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/stats/update.html" class="external-link">update</a></span><span class="op">(</span><span class="va">f_saem_full</span>, covariance.model <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/diag.html" class="external-link">diag</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">1</span>, <span class="fl">1</span>, <span class="fl">0</span>, <span class="fl">1</span><span class="op">)</span><span class="op">)</span><span class="op">)</span></span> -<span><span class="va">f_saem_reduced_multi</span> <span class="op"><-</span> <span class="fu"><a href="../../reference/multistart.html">multistart</a></span><span class="op">(</span><span class="va">f_saem_reduced</span>, n <span class="op">=</span> <span class="fl">16</span>, cores <span class="op">=</span> <span class="fl">16</span><span class="op">)</span></span> -<span><span class="fu"><a href="../../reference/parhist.html">parhist</a></span><span class="op">(</span><span class="va">f_saem_reduced_multi</span>, lpos <span class="op">=</span> <span class="st">"topright"</span><span class="op">)</span></span></code></pre></div> <p><img src="multistart_files/figure-html/unnamed-chunk-3-1.png" width="700"></p> +<p>This confirms that the variance of k2 is the most problematic parameter, so we reduce the parameter distribution model by removing the intersoil variability for k2.</p> +<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r"> +<code class="sourceCode R"><span><span class="va">f_saem_reduced</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/stats/update.html" class="external-link">update</a></span><span class="op">(</span><span class="va">f_saem_full</span>, no_random_effect <span class="op">=</span> <span class="st">"log_k2"</span><span class="op">)</span></span> +<span><span class="fu"><a href="../../reference/illparms.html">illparms</a></span><span class="op">(</span><span class="va">f_saem_reduced</span><span class="op">)</span></span></code></pre></div> +<pre><code><span><span class="co">## character(0)</span></span></code></pre> +<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r"> +<code class="sourceCode R"><span><span class="va">f_saem_reduced_multi</span> <span class="op"><-</span> <span class="fu"><a href="../../reference/multistart.html">multistart</a></span><span class="op">(</span><span class="va">f_saem_reduced</span>, n <span class="op">=</span> <span class="fl">16</span>, cores <span class="op">=</span> <span class="fl">16</span><span class="op">)</span></span> +<span><span class="fu"><a href="../../reference/parhist.html">parhist</a></span><span class="op">(</span><span class="va">f_saem_reduced_multi</span>, lpos <span class="op">=</span> <span class="st">"topright"</span><span class="op">)</span></span></code></pre></div> +<p><img src="multistart_files/figure-html/unnamed-chunk-4-1.png" width="700"></p> +<p>The results confirm that all remaining parameters can be determined with sufficient certainty.</p> <p>We can also analyse the log-likelihoods obtained in the multiple runs:</p> -<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r"> +<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r"> <code class="sourceCode R"><span><span class="fu"><a href="../../reference/llhist.html">llhist</a></span><span class="op">(</span><span class="va">f_saem_reduced_multi</span><span class="op">)</span></span></code></pre></div> -<p><img src="multistart_files/figure-html/unnamed-chunk-4-1.png" width="700"></p> -<p>The one run with the lower likelihood is probably responsible for the outliers in the boxplots above, and caused by some weird starting value combination. In any case, the converged values from the original fit (red circles) appear perfectly acceptable, supporting the choice of starting values made by mkin.</p> +<p><img src="multistart_files/figure-html/unnamed-chunk-5-1.png" width="700"></p> +<p>The parameter histograms can be further improved by excluding the result with the low likelihood.</p> +<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r"> +<code class="sourceCode R"><span><span class="fu"><a href="../../reference/parhist.html">parhist</a></span><span class="op">(</span><span class="va">f_saem_reduced_multi</span>, lpos <span class="op">=</span> <span class="st">"topright"</span>, llmin <span class="op">=</span> <span class="op">-</span><span class="fl">326</span>, ylim <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">0.5</span>, <span class="fl">2</span><span class="op">)</span><span class="op">)</span></span></code></pre></div> +<p><img src="multistart_files/figure-html/unnamed-chunk-6-1.png" width="700"></p> +<p>We can use the <code>anova</code> method to compare the models, including a likelihood ratio test if the models are nested.</p> +<div class="sourceCode" id="cb10"><pre class="downlit sourceCode r"> +<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/stats/anova.html" class="external-link">anova</a></span><span class="op">(</span><span class="va">f_saem_full</span>, <span class="fu"><a href="../../reference/multistart.html">best</a></span><span class="op">(</span><span class="va">f_saem_reduced_multi</span><span class="op">)</span>, test <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></code></pre></div> +<pre><code><span><span class="co">## Data: 155 observations of 1 variable(s) grouped in 6 datasets</span></span> +<span><span class="co">## </span></span> +<span><span class="co">## npar AIC BIC Lik Chisq Df Pr(>Chisq)</span></span> +<span><span class="co">## best(f_saem_reduced_multi) 9 663.81 661.93 -322.90 </span></span> +<span><span class="co">## f_saem_full 10 668.27 666.19 -324.13 0 1 1</span></span></code></pre> +<p>While AIC and BIC are lower for the reduced model, the likelihood ratio test does not indicate a significant difference between the fits.</p> </div> <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar"> diff --git a/docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-3-1.png b/docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-3-1.png Binary files differindex d32e1214..e3baa59b 100644 --- a/docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-3-1.png +++ b/docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-3-1.png diff --git a/docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-4-1.png b/docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-4-1.png Binary files differindex d72722f0..d32e1214 100644 --- a/docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-4-1.png +++ b/docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-4-1.png diff --git a/docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-5-1.png b/docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-5-1.png Binary files differnew file mode 100644 index 00000000..d72722f0 --- /dev/null +++ b/docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-5-1.png diff --git a/docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-6-1.png b/docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-6-1.png Binary files differnew file mode 100644 index 00000000..f9b5aff2 --- /dev/null +++ b/docs/dev/articles/web_only/multistart_files/figure-html/unnamed-chunk-6-1.png diff --git a/docs/dev/pkgdown.yml b/docs/dev/pkgdown.yml index c0cb9f4c..2bb496a8 100644 --- a/docs/dev/pkgdown.yml +++ b/docs/dev/pkgdown.yml @@ -12,7 +12,7 @@ articles: compiled_models: web_only/compiled_models.html dimethenamid_2018: web_only/dimethenamid_2018.html multistart: web_only/multistart.html -last_built: 2022-10-26T07:25Z +last_built: 2022-10-26T08:33Z urls: reference: https://pkgdown.jrwb.de/mkin/reference article: https://pkgdown.jrwb.de/mkin/articles diff --git a/docs/dev/reference/Rplot001.png b/docs/dev/reference/Rplot001.png Binary files differindex 17a35806..f7b4238e 100644 --- a/docs/dev/reference/Rplot001.png +++ b/docs/dev/reference/Rplot001.png diff --git a/docs/dev/reference/Rplot002.png b/docs/dev/reference/Rplot002.png Binary files differindex f06a860e..018559d0 100644 --- a/docs/dev/reference/Rplot002.png +++ b/docs/dev/reference/Rplot002.png diff --git a/docs/dev/reference/multistart-1.png b/docs/dev/reference/multistart-1.png Binary files differindex ee9c1b5a..25362568 100644 --- a/docs/dev/reference/multistart-1.png +++ b/docs/dev/reference/multistart-1.png diff --git a/docs/dev/reference/multistart-2.png b/docs/dev/reference/multistart-2.png Binary files differindex e54938ab..cf8c097e 100644 --- a/docs/dev/reference/multistart-2.png +++ b/docs/dev/reference/multistart-2.png diff --git a/docs/dev/reference/multistart.html b/docs/dev/reference/multistart.html index 83af8dbb..c874bf50 100644 --- a/docs/dev/reference/multistart.html +++ b/docs/dev/reference/multistart.html @@ -166,14 +166,6 @@ for parallel execution.</p></dd> <p>The index of the object with the highest likelihood</p> </div> - <div id="details"> - <h2>Details</h2> - <p>In case the online version of this help page contains error messages -in the example code and no plots, this is due to the multistart method -not working when called by pkgdown. Please refer to the -<a href="https://pkgdown.jrwb.de/mkin/dev/articles/web_only/multistart.html">online vignette</a> -in this case.</p> - </div> <div id="references"> <h2>References</h2> <p>Duchesne R, Guillemin A, Gandrillon O, Crauste F. Practical @@ -203,7 +195,7 @@ doi: 10.1186/s12859-021-04373-4.</p> <span class="r-in"><span><span class="va">f_mmkin</span> <span class="op"><-</span> <span class="fu"><a href="mmkin.html">mmkin</a></span><span class="op">(</span><span class="st">"DFOP"</span>, <span class="va">dmta_ds</span>, error_model <span class="op">=</span> <span class="st">"tc"</span>, cores <span class="op">=</span> <span class="fl">7</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span></span> <span class="r-in"><span><span class="va">f_saem_full</span> <span class="op"><-</span> <span class="fu"><a href="saem.html">saem</a></span><span class="op">(</span><span class="va">f_mmkin</span><span class="op">)</span></span></span> <span class="r-in"><span><span class="va">f_saem_full_multi</span> <span class="op"><-</span> <span class="fu">multistart</span><span class="op">(</span><span class="va">f_saem_full</span>, n <span class="op">=</span> <span class="fl">16</span>, cores <span class="op">=</span> <span class="fl">16</span><span class="op">)</span></span></span> -<span class="r-in"><span><span class="fu"><a href="parhist.html">parhist</a></span><span class="op">(</span><span class="va">f_saem_full_multi</span>, lpos <span class="op">=</span> <span class="st">"bottomright"</span><span class="op">)</span></span></span> +<span class="r-in"><span><span class="fu"><a href="parhist.html">parhist</a></span><span class="op">(</span><span class="va">f_saem_full_multi</span>, lpos <span class="op">=</span> <span class="st">"bottomleft"</span><span class="op">)</span></span></span> <span class="r-plt img"><img src="multistart-1.png" alt="" width="700" height="433"></span> <span class="r-in"><span><span class="fu"><a href="illparms.html">illparms</a></span><span class="op">(</span><span class="va">f_saem_full</span><span class="op">)</span></span></span> <span class="r-out co"><span class="r-pr">#></span> [1] "sd(log_k2)"</span> @@ -219,7 +211,7 @@ doi: 10.1186/s12859-021-04373-4.</p> <span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/parallel/clusterApply.html" class="external-link">clusterExport</a></span><span class="op">(</span><span class="va">cl</span>, <span class="st">"f_mmkin"</span><span class="op">)</span></span></span> <span class="r-err co"><span class="r-pr">#></span> <span class="error">Error in get(name, envir = envir):</span> object 'f_mmkin' not found</span> <span class="r-in"><span><span class="va">f_saem_reduced_multi</span> <span class="op"><-</span> <span class="fu">multistart</span><span class="op">(</span><span class="va">f_saem_reduced</span>, n <span class="op">=</span> <span class="fl">16</span>, cluster <span class="op">=</span> <span class="va">cl</span><span class="op">)</span></span></span> -<span class="r-in"><span><span class="fu"><a href="parhist.html">parhist</a></span><span class="op">(</span><span class="va">f_saem_reduced_multi</span>, lpos <span class="op">=</span> <span class="st">"bottomright"</span><span class="op">)</span></span></span> +<span class="r-in"><span><span class="fu"><a href="parhist.html">parhist</a></span><span class="op">(</span><span class="va">f_saem_reduced_multi</span>, lpos <span class="op">=</span> <span class="st">"topright"</span><span class="op">)</span></span></span> <span class="r-plt img"><img src="multistart-2.png" alt="" width="700" height="433"></span> <span class="r-in"><span><span class="co"># }</span></span></span> </code></pre></div> |