diff options
Diffstat (limited to 'docs/dev/articles/web_only/multistart.html')
-rw-r--r-- | docs/dev/articles/web_only/multistart.html | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/docs/dev/articles/web_only/multistart.html b/docs/dev/articles/web_only/multistart.html index b5635df2..2de5059c 100644 --- a/docs/dev/articles/web_only/multistart.html +++ b/docs/dev/articles/web_only/multistart.html @@ -34,7 +34,7 @@ </button> <span class="navbar-brand"> <a class="navbar-link" href="../../index.html">mkin</a> - <span class="version label label-info" data-toggle="tooltip" data-placement="bottom" title="In-development version">1.2.3</span> + <span class="version label label-info" data-toggle="tooltip" data-placement="bottom" title="In-development version">1.2.4</span> </span> </div> @@ -127,13 +127,15 @@ - </header><script src="multistart_files/accessible-code-block-0.0.1/empty-anchor.js"></script><div class="row"> + </header><div class="row"> <div class="col-md-9 contents"> <div class="page-header toc-ignore"> <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="author">Johannes +Ranke</h4> - <h4 data-toc-skip class="date">Last change 17 April 2023 (rebuilt 2023-04-17)</h4> + <h4 data-toc-skip class="date">Last change 20 April 2023 +(rebuilt 2023-04-20)</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> @@ -142,7 +144,8 @@ -<p>The dimethenamid data from 2018 from seven soils is used as example data in this vignette.</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> @@ -154,26 +157,34 @@ <span><span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="va">dmta_ds</span><span class="op">)</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/lapply.html" class="external-link">sapply</a></span><span class="op">(</span><span class="va">dimethenamid_2018</span><span class="op">$</span><span class="va">ds</span>, <span class="kw">function</span><span class="op">(</span><span class="va">ds</span><span class="op">)</span> <span class="va">ds</span><span class="op">$</span><span class="va">title</span><span class="op">)</span></span> <span><span class="va">dmta_ds</span><span class="op">[[</span><span class="st">"Elliot"</span><span class="op">]</span><span class="op">]</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/cbind.html" class="external-link">rbind</a></span><span class="op">(</span><span class="va">dmta_ds</span><span class="op">[[</span><span class="st">"Elliot 1"</span><span class="op">]</span><span class="op">]</span>, <span class="va">dmta_ds</span><span class="op">[[</span><span class="st">"Elliot 2"</span><span class="op">]</span><span class="op">]</span><span class="op">)</span></span> <span><span class="va">dmta_ds</span><span class="op">[[</span><span class="st">"Elliot 1"</span><span class="op">]</span><span class="op">]</span> <span class="op"><-</span> <span class="va">dmta_ds</span><span class="op">[[</span><span class="st">"Elliot 2"</span><span class="op">]</span><span class="op">]</span> <span class="op"><-</span> <span class="cn">NULL</span></span></code></pre></div> -<p>First, we check the DFOP model with the two-component error model and random effects for all degradation parameters.</p> +<p>First, we check the DFOP model with the two-component error model and +random effects for all degradation parameters.</p> <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="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> +<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">8</span><span class="op">)</span></span> +<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/parplot.html">parplot</a></span><span class="op">(</span><span class="va">f_saem_full_multi</span>, lpos <span class="op">=</span> <span class="st">"topleft"</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> +<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> +<code class="sourceCode R"><span><span class="va">f_saem_reduced</span> <span class="op"><-</span> <span class="fu">stats</span><span class="fu">::</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> -<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">8</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/parplot.html">parplot</a></span><span class="op">(</span><span class="va">f_saem_reduced_multi</span>, lpos <span class="op">=</span> <span class="st">"topright"</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-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> +<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="cb6"><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-5-1.png" width="700"></p> @@ -184,11 +195,16 @@ <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">## f_saem_reduced 9 663.74 661.87 -322.87 </span></span> -<span><span class="co">## best(f_saem_reduced_multi) 9 663.60 661.72 -322.80 0.1476 0 </span></span> -<span><span class="co">## f_saem_full 10 670.35 668.26 -325.17 0.0000 1 1</span></span> -<span><span class="co">## best(f_saem_full_multi) 10 665.61 663.53 -322.80 4.7372 0</span></span></code></pre> -<p>The reduced model results in lower AIC and BIC values, so it is clearly preferable. Using multiple starting values gives a large improvement in case of the full model, because it is less well-defined, which impedes convergence. For the reduced model, using multiple starting values only results in a small improvement of the model fit.</p> +<span><span class="co">## f_saem_reduced 9 663.73 661.86 -322.86 </span></span> +<span><span class="co">## best(f_saem_reduced_multi) 9 663.69 661.82 -322.85 0.0361 0 </span></span> +<span><span class="co">## f_saem_full 10 669.77 667.69 -324.89 0.0000 1 1</span></span> +<span><span class="co">## best(f_saem_full_multi) 10 665.56 663.48 -322.78 4.2060 0</span></span></code></pre> +<p>The reduced model results in lower AIC and BIC values, so it is +clearly preferable. Using multiple starting values gives a large +improvement in case of the full model, because it is less well-defined, +which impedes convergence. For the reduced model, using multiple +starting values only results in a small improvement of the model +fit.</p> </div> <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar"> |