diff options
Diffstat (limited to 'docs/dev')
-rw-r--r-- | docs/dev/pkgdown.yml | 2 | ||||
-rw-r--r-- | docs/dev/reference/Rplot001.png | bin | 14324 -> 19062 bytes | |||
-rw-r--r-- | docs/dev/reference/Rplot002.png | bin | 57366 -> 24396 bytes | |||
-rw-r--r-- | docs/dev/reference/Rplot003.png | bin | 55679 -> 6583 bytes | |||
-rw-r--r-- | docs/dev/reference/Rplot004.png | bin | 57102 -> 28700 bytes | |||
-rw-r--r-- | docs/dev/reference/mkinfit.html | 167 | ||||
-rw-r--r-- | docs/dev/reference/nlme.mmkin.html | 6 | ||||
-rw-r--r-- | docs/dev/reference/saemix.html | 35 |
8 files changed, 117 insertions, 93 deletions
diff --git a/docs/dev/pkgdown.yml b/docs/dev/pkgdown.yml index 657aa128..6d59c7cb 100644 --- a/docs/dev/pkgdown.yml +++ b/docs/dev/pkgdown.yml @@ -10,7 +10,7 @@ articles: web_only/NAFTA_examples: NAFTA_examples.html web_only/benchmarks: benchmarks.html web_only/compiled_models: compiled_models.html -last_built: 2020-10-27T14:34Z +last_built: 2020-11-05T07:25Z 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 f001da49..36b20f09 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 8e2eb70d..b568eb1c 100644 --- a/docs/dev/reference/Rplot002.png +++ b/docs/dev/reference/Rplot002.png diff --git a/docs/dev/reference/Rplot003.png b/docs/dev/reference/Rplot003.png Binary files differindex 0b173f9e..53415e5d 100644 --- a/docs/dev/reference/Rplot003.png +++ b/docs/dev/reference/Rplot003.png diff --git a/docs/dev/reference/Rplot004.png b/docs/dev/reference/Rplot004.png Binary files differindex 4874cd19..ea685493 100644 --- a/docs/dev/reference/Rplot004.png +++ b/docs/dev/reference/Rplot004.png diff --git a/docs/dev/reference/mkinfit.html b/docs/dev/reference/mkinfit.html index 90fb26be..39bd12cb 100644 --- a/docs/dev/reference/mkinfit.html +++ b/docs/dev/reference/mkinfit.html @@ -80,7 +80,7 @@ likelihood function." /> </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">0.9.50.3</span> + <span class="version label label-info" data-toggle="tooltip" data-placement="bottom" title="In-development version">0.9.50.4</span> </span> </div> @@ -128,7 +128,7 @@ likelihood function." /> </ul> <ul class="nav navbar-nav navbar-right"> <li> - <a href="http://github.com/jranke/mkin/"> + <a href="https://github.com/jranke/mkin/"> <span class="fab fa fab fa-github fa-lg"></span> </a> @@ -147,7 +147,7 @@ likelihood function." /> <div class="col-md-9 contents"> <div class="page-header"> <h1>Fit a kinetic model to data with one or more state variables</h1> - <small class="dont-index">Source: <a href='http://github.com/jranke/mkin/blob/master/R/mkinfit.R'><code>R/mkinfit.R</code></a></small> + <small class="dont-index">Source: <a href='https://github.com/jranke/mkin/blob/master/R/mkinfit.R'><code>R/mkinfit.R</code></a></small> <div class="hidden name"><code>mkinfit.Rd</code></div> </div> @@ -163,32 +163,33 @@ degradation model parameters, as both of them are arguments of the likelihood function.</p> </div> - <pre class="usage"><span class='fu'>mkinfit</span>( - <span class='no'>mkinmod</span>, - <span class='no'>observed</span>, - <span class='kw'>parms.ini</span> <span class='kw'>=</span> <span class='st'>"auto"</span>, - <span class='kw'>state.ini</span> <span class='kw'>=</span> <span class='st'>"auto"</span>, - <span class='kw'>err.ini</span> <span class='kw'>=</span> <span class='st'>"auto"</span>, - <span class='kw'>fixed_parms</span> <span class='kw'>=</span> <span class='kw'>NULL</span>, - <span class='kw'>fixed_initials</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/names.html'>names</a></span>(<span class='no'>mkinmod</span>$<span class='no'>diffs</span>)[-<span class='fl'>1</span>], - <span class='kw'>from_max_mean</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, - <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"auto"</span>, <span class='st'>"analytical"</span>, <span class='st'>"eigen"</span>, <span class='st'>"deSolve"</span>), - <span class='kw'>method.ode</span> <span class='kw'>=</span> <span class='st'>"lsoda"</span>, - <span class='kw'>use_compiled</span> <span class='kw'>=</span> <span class='st'>"auto"</span>, - <span class='kw'>control</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span>(<span class='kw'>eval.max</span> <span class='kw'>=</span> <span class='fl'>300</span>, <span class='kw'>iter.max</span> <span class='kw'>=</span> <span class='fl'>200</span>), - <span class='kw'>transform_rates</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, - <span class='kw'>transform_fractions</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, - <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, - <span class='kw'>atol</span> <span class='kw'>=</span> <span class='fl'>1e-08</span>, - <span class='kw'>rtol</span> <span class='kw'>=</span> <span class='fl'>1e-10</span>, - <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"const"</span>, <span class='st'>"obs"</span>, <span class='st'>"tc"</span>), - <span class='kw'>error_model_algorithm</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"auto"</span>, <span class='st'>"d_3"</span>, <span class='st'>"direct"</span>, <span class='st'>"twostep"</span>, <span class='st'>"threestep"</span>, - <span class='st'>"fourstep"</span>, <span class='st'>"IRLS"</span>, <span class='st'>"OLS"</span>), - <span class='kw'>reweight.tol</span> <span class='kw'>=</span> <span class='fl'>1e-08</span>, - <span class='kw'>reweight.max.iter</span> <span class='kw'>=</span> <span class='fl'>10</span>, - <span class='kw'>trace_parms</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, - <span class='no'>...</span> -)</pre> + <pre class="usage"><span class='fu'>mkinfit</span><span class='op'>(</span> + <span class='va'>mkinmod</span>, + <span class='va'>observed</span>, + parms.ini <span class='op'>=</span> <span class='st'>"auto"</span>, + state.ini <span class='op'>=</span> <span class='st'>"auto"</span>, + err.ini <span class='op'>=</span> <span class='st'>"auto"</span>, + fixed_parms <span class='op'>=</span> <span class='cn'>NULL</span>, + fixed_initials <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/names.html'>names</a></span><span class='op'>(</span><span class='va'>mkinmod</span><span class='op'>$</span><span class='va'>diffs</span><span class='op'>)</span><span class='op'>[</span><span class='op'>-</span><span class='fl'>1</span><span class='op'>]</span>, + from_max_mean <span class='op'>=</span> <span class='cn'>FALSE</span>, + solution_type <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"auto"</span>, <span class='st'>"analytical"</span>, <span class='st'>"eigen"</span>, <span class='st'>"deSolve"</span><span class='op'>)</span>, + method.ode <span class='op'>=</span> <span class='st'>"lsoda"</span>, + use_compiled <span class='op'>=</span> <span class='st'>"auto"</span>, + control <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span>eval.max <span class='op'>=</span> <span class='fl'>300</span>, iter.max <span class='op'>=</span> <span class='fl'>200</span><span class='op'>)</span>, + transform_rates <span class='op'>=</span> <span class='cn'>TRUE</span>, + transform_fractions <span class='op'>=</span> <span class='cn'>TRUE</span>, + quiet <span class='op'>=</span> <span class='cn'>FALSE</span>, + atol <span class='op'>=</span> <span class='fl'>1e-08</span>, + rtol <span class='op'>=</span> <span class='fl'>1e-10</span>, + error_model <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"const"</span>, <span class='st'>"obs"</span>, <span class='st'>"tc"</span><span class='op'>)</span>, + error_model_algorithm <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"auto"</span>, <span class='st'>"d_3"</span>, <span class='st'>"direct"</span>, <span class='st'>"twostep"</span>, <span class='st'>"threestep"</span>, + <span class='st'>"fourstep"</span>, <span class='st'>"IRLS"</span>, <span class='st'>"OLS"</span><span class='op'>)</span>, + reweight.tol <span class='op'>=</span> <span class='fl'>1e-08</span>, + reweight.max.iter <span class='op'>=</span> <span class='fl'>10</span>, + trace_parms <span class='op'>=</span> <span class='cn'>FALSE</span>, + test_residuals <span class='op'>=</span> <span class='cn'>FALSE</span>, + <span class='va'>...</span> +<span class='op'>)</span></pre> <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2> <table class="ref-arguments"> @@ -383,6 +384,10 @@ the error model parameters in IRLS fits.</p></td> <td><p>Should a trace of the parameter values be listed?</p></td> </tr> <tr> + <th>test_residuals</th> + <td><p>Should the residuals be tested for normal distribution?</p></td> + </tr> + <tr> <th>...</th> <td><p>Further arguments that will be passed on to <code><a href='https://rdrr.io/pkg/deSolve/man/ode.html'>deSolve::ode()</a></code>.</p></td> @@ -417,22 +422,26 @@ Degradation Data. <em>Environments</em> 6(12) 124 <code><a href='https://rdrr.io/r/stats/AIC.html'>AIC</a></code> by virtue of the method <code><a href='logLik.mkinfit.html'>logLik.mkinfit</a></code>.</p> <p>Fitting of several models to several datasets in a single call to <code><a href='mmkin.html'>mmkin</a></code>.</p></div> + <h2 class="hasAnchor" id="author"><a class="anchor" href="#author"></a>Author</h2> + + <p>Johannes Ranke</p> <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> <pre class="examples"><div class='input'> <span class='co'># Use shorthand notation for parent only degradation</span> -<span class='no'>fit</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='st'>"FOMC"</span>, <span class='no'>FOCUS_2006_C</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) -<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span>(<span class='no'>fit</span>)</div><div class='output co'>#> mkin version used for fitting: 0.9.50.3 -#> R version used for fitting: 4.0.2 -#> Date of fit: Thu Oct 8 09:12:15 2020 -#> Date of summary: Thu Oct 8 09:12:15 2020 +<span class='va'>fit</span> <span class='op'><-</span> <span class='fu'>mkinfit</span><span class='op'>(</span><span class='st'>"FOMC"</span>, <span class='va'>FOCUS_2006_C</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span> +<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span><span class='op'>(</span><span class='va'>fit</span><span class='op'>)</span> +</div><div class='output co'>#> mkin version used for fitting: 0.9.50.4 +#> R version used for fitting: 4.0.3 +#> Date of fit: Thu Nov 5 08:25:42 2020 +#> Date of summary: Thu Nov 5 08:25:42 2020 #> #> Equations: #> d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent #> #> Model predictions using solution type analytical #> -#> Fitted using 222 model solutions performed in 0.045 s +#> Fitted using 222 model solutions performed in 0.049 s #> #> Error model: Constant variance #> @@ -504,17 +513,20 @@ Degradation Data. <em>Environments</em> 6(12) 124 #> 119 parent 0.6 1.092 -0.4919</div><div class='input'> <span class='co'># One parent compound, one metabolite, both single first order.</span> <span class='co'># We remove zero values from FOCUS dataset D in order to avoid warnings</span> -<span class='no'>FOCUS_D</span> <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/subset.html'>subset</a></span>(<span class='no'>FOCUS_2006_D</span>, <span class='no'>value</span> <span class='kw'>!=</span> <span class='fl'>0</span>) +<span class='va'>FOCUS_D</span> <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/subset.html'>subset</a></span><span class='op'>(</span><span class='va'>FOCUS_2006_D</span>, <span class='va'>value</span> <span class='op'>!=</span> <span class='fl'>0</span><span class='op'>)</span> <span class='co'># Use mkinsub for convenience in model formulation. Pathway to sink included per default.</span> -<span class='no'>SFO_SFO</span> <span class='kw'><-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span>( - <span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>, <span class='st'>"m1"</span>), - <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>))</div><div class='output co'>#> <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'> +<span class='va'>SFO_SFO</span> <span class='op'><-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span><span class='op'>(</span> + parent <span class='op'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span>, <span class='st'>"m1"</span><span class='op'>)</span>, + m1 <span class='op'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span><span class='op'>)</span><span class='op'>)</span> +</div><div class='output co'>#> <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'> <span class='co'># Fit the model quietly to the FOCUS example dataset D using defaults</span> -<span class='no'>fit</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='output co'>#> <span class='warning'>Warning: Shapiro-Wilk test for standardized residuals: p = 0.0165</span></div><div class='input'><span class='co'># Since mkin 0.9.50.3, we get a warning about non-normality of residuals,</span> +<span class='va'>fit</span> <span class='op'><-</span> <span class='fu'>mkinfit</span><span class='op'>(</span><span class='va'>SFO_SFO</span>, <span class='va'>FOCUS_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span> +<span class='co'># Since mkin 0.9.50.3, we get a warning about non-normality of residuals,</span> <span class='co'># so we try an alternative error model</span> -<span class='no'>fit.tc</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='st'>"tc"</span>) +<span class='va'>fit.tc</span> <span class='op'><-</span> <span class='fu'>mkinfit</span><span class='op'>(</span><span class='va'>SFO_SFO</span>, <span class='va'>FOCUS_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span>, error_model <span class='op'>=</span> <span class='st'>"tc"</span><span class='op'>)</span> <span class='co'># This avoids the warning, and the likelihood ratio test confirms it is preferable</span> -<span class='fu'><a href='https://rdrr.io/pkg/lmtest/man/lrtest.html'>lrtest</a></span>(<span class='no'>fit.tc</span>, <span class='no'>fit</span>)</div><div class='output co'>#> Likelihood ratio test +<span class='fu'><a href='https://rdrr.io/pkg/lmtest/man/lrtest.html'>lrtest</a></span><span class='op'>(</span><span class='va'>fit.tc</span>, <span class='va'>fit</span><span class='op'>)</span> +</div><div class='output co'>#> Likelihood ratio test #> #> Model 1: SFO_SFO with error model tc and fixed parameter(s) m1_0 #> Model 2: SFO_SFO with error model const and fixed parameter(s) m1_0 @@ -523,10 +535,11 @@ Degradation Data. <em>Environments</em> 6(12) 124 #> 2 5 -97.224 -1 64.483 9.737e-16 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1</div><div class='input'><span class='co'># We can also allow for different variances of parent and metabolite as error model</span> -<span class='no'>fit.obs</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='st'>"obs"</span>) +<span class='va'>fit.obs</span> <span class='op'><-</span> <span class='fu'>mkinfit</span><span class='op'>(</span><span class='va'>SFO_SFO</span>, <span class='va'>FOCUS_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span>, error_model <span class='op'>=</span> <span class='st'>"obs"</span><span class='op'>)</span> <span class='co'># This also avoids the warning about non-normality, but the two-component error model</span> <span class='co'># has significantly higher likelihood</span> -<span class='fu'><a href='https://rdrr.io/pkg/lmtest/man/lrtest.html'>lrtest</a></span>(<span class='no'>fit.obs</span>, <span class='no'>fit.tc</span>)</div><div class='output co'>#> Likelihood ratio test +<span class='fu'><a href='https://rdrr.io/pkg/lmtest/man/lrtest.html'>lrtest</a></span><span class='op'>(</span><span class='va'>fit.obs</span>, <span class='va'>fit.tc</span><span class='op'>)</span> +</div><div class='output co'>#> Likelihood ratio test #> #> Model 1: SFO_SFO with error model tc and fixed parameter(s) m1_0 #> Model 2: SFO_SFO with error model obs and fixed parameter(s) m1_0 @@ -534,10 +547,12 @@ Degradation Data. <em>Environments</em> 6(12) 124 #> 1 6 -64.983 #> 2 6 -96.936 0 63.907 < 2.2e-16 *** #> --- -#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1</div><div class='input'><span class='fu'><a href='parms.html'>parms</a></span>(<span class='no'>fit.tc</span>)</div><div class='output co'>#> parent_0 k_parent k_m1 f_parent_to_m1 sigma_low +#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1</div><div class='input'><span class='fu'><a href='parms.html'>parms</a></span><span class='op'>(</span><span class='va'>fit.tc</span><span class='op'>)</span> +</div><div class='output co'>#> parent_0 k_parent k_m1 f_parent_to_m1 sigma_low #> 1.007343e+02 1.005562e-01 5.166712e-03 5.083933e-01 3.049891e-03 #> rsd_high -#> 7.928117e-02 </div><div class='input'><span class='fu'><a href='endpoints.html'>endpoints</a></span>(<span class='no'>fit.tc</span>)</div><div class='output co'>#> $ff +#> 7.928117e-02 </div><div class='input'><span class='fu'><a href='endpoints.html'>endpoints</a></span><span class='op'>(</span><span class='va'>fit.tc</span><span class='op'>)</span> +</div><div class='output co'>#> $ff #> parent_m1 parent_sink #> 0.5083933 0.4916067 #> @@ -551,27 +566,31 @@ Degradation Data. <em>Environments</em> 6(12) 124 <span class='co'># uncompiled deSolve, as it is so slow. More benchmarks are found in the</span> <span class='co'># benchmark vignette</span> <span class='co'># \dontrun{</span> -<span class='kw'>if</span>(<span class='fu'><a href='https://rdrr.io/r/base/library.html'>require</a></span>(<span class='no'>rbenchmark</span>)) { - <span class='fu'><a href='https://rdrr.io/pkg/rbenchmark/man/benchmark.html'>benchmark</a></span>(<span class='kw'>replications</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>order</span> <span class='kw'>=</span> <span class='st'>"relative"</span>, <span class='kw'>columns</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"test"</span>, <span class='st'>"relative"</span>, <span class='st'>"elapsed"</span>), - <span class='kw'>deSolve_compiled</span> <span class='kw'>=</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='st'>"tc"</span>, - <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"deSolve"</span>, <span class='kw'>use_compiled</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>), - <span class='kw'>eigen</span> <span class='kw'>=</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='st'>"tc"</span>, - <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"eigen"</span>), - <span class='kw'>analytical</span> <span class='kw'>=</span> <span class='fu'>mkinfit</span>(<span class='no'>SFO_SFO</span>, <span class='no'>FOCUS_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='st'>"tc"</span>, - <span class='kw'>solution_type</span> <span class='kw'>=</span> <span class='st'>"analytical"</span>)) -}</div><div class='output co'>#> test relative elapsed -#> 3 analytical 1.000 0.750 -#> 1 deSolve_compiled 2.288 1.716 -#> 2 eigen 2.821 2.116</div><div class='input'><span class='co'># }</span> +<span class='kw'>if</span><span class='op'>(</span><span class='kw'><a href='https://rdrr.io/r/base/library.html'>require</a></span><span class='op'>(</span><span class='va'><a href='http://rbenchmark.googlecode.com'>rbenchmark</a></span><span class='op'>)</span><span class='op'>)</span> <span class='op'>{</span> + <span class='fu'><a href='https://rdrr.io/pkg/rbenchmark/man/benchmark.html'>benchmark</a></span><span class='op'>(</span>replications <span class='op'>=</span> <span class='fl'>1</span>, order <span class='op'>=</span> <span class='st'>"relative"</span>, columns <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"test"</span>, <span class='st'>"relative"</span>, <span class='st'>"elapsed"</span><span class='op'>)</span>, + deSolve_compiled <span class='op'>=</span> <span class='fu'>mkinfit</span><span class='op'>(</span><span class='va'>SFO_SFO</span>, <span class='va'>FOCUS_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span>, error_model <span class='op'>=</span> <span class='st'>"tc"</span>, + solution_type <span class='op'>=</span> <span class='st'>"deSolve"</span>, use_compiled <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span>, + eigen <span class='op'>=</span> <span class='fu'>mkinfit</span><span class='op'>(</span><span class='va'>SFO_SFO</span>, <span class='va'>FOCUS_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span>, error_model <span class='op'>=</span> <span class='st'>"tc"</span>, + solution_type <span class='op'>=</span> <span class='st'>"eigen"</span><span class='op'>)</span>, + analytical <span class='op'>=</span> <span class='fu'>mkinfit</span><span class='op'>(</span><span class='va'>SFO_SFO</span>, <span class='va'>FOCUS_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span>, error_model <span class='op'>=</span> <span class='st'>"tc"</span>, + solution_type <span class='op'>=</span> <span class='st'>"analytical"</span><span class='op'>)</span><span class='op'>)</span> +<span class='op'>}</span> +</div><div class='output co'>#> <span class='message'>Loading required package: rbenchmark</span></div><div class='output co'>#> test relative elapsed +#> 3 analytical 1.000 0.746 +#> 1 deSolve_compiled 2.288 1.707 +#> 2 eigen 2.708 2.020</div><div class='input'><span class='co'># }</span> <span class='co'># Use stepwise fitting, using optimised parameters from parent only fit, FOMC-SFO</span> <span class='co'># \dontrun{</span> -<span class='no'>FOMC_SFO</span> <span class='kw'><-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span>( - <span class='kw'>parent</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"FOMC"</span>, <span class='st'>"m1"</span>), - <span class='kw'>m1</span> <span class='kw'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span>(<span class='st'>"SFO"</span>))</div><div class='output co'>#> <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'><span class='no'>fit.FOMC_SFO</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>FOMC_SFO</span>, <span class='no'>FOCUS_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>)</div><div class='output co'>#> <span class='warning'>Warning: Shapiro-Wilk test for standardized residuals: p = 0.0499</span></div><div class='input'><span class='co'># Again, we get a warning and try a more sophisticated error model</span> -<span class='no'>fit.FOMC_SFO.tc</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>FOMC_SFO</span>, <span class='no'>FOCUS_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='st'>"tc"</span>) +<span class='va'>FOMC_SFO</span> <span class='op'><-</span> <span class='fu'><a href='mkinmod.html'>mkinmod</a></span><span class='op'>(</span> + parent <span class='op'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"FOMC"</span>, <span class='st'>"m1"</span><span class='op'>)</span>, + m1 <span class='op'>=</span> <span class='fu'><a href='mkinsub.html'>mkinsub</a></span><span class='op'>(</span><span class='st'>"SFO"</span><span class='op'>)</span><span class='op'>)</span> +</div><div class='output co'>#> <span class='message'>Successfully compiled differential equation model from auto-generated C code.</span></div><div class='input'><span class='va'>fit.FOMC_SFO</span> <span class='op'><-</span> <span class='fu'>mkinfit</span><span class='op'>(</span><span class='va'>FOMC_SFO</span>, <span class='va'>FOCUS_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span> +<span class='co'># Again, we get a warning and try a more sophisticated error model</span> +<span class='va'>fit.FOMC_SFO.tc</span> <span class='op'><-</span> <span class='fu'>mkinfit</span><span class='op'>(</span><span class='va'>FOMC_SFO</span>, <span class='va'>FOCUS_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span>, error_model <span class='op'>=</span> <span class='st'>"tc"</span><span class='op'>)</span> <span class='co'># This model has a higher likelihood, but not significantly so</span> -<span class='fu'><a href='https://rdrr.io/pkg/lmtest/man/lrtest.html'>lrtest</a></span>(<span class='no'>fit.tc</span>, <span class='no'>fit.FOMC_SFO.tc</span>)</div><div class='output co'>#> Likelihood ratio test +<span class='fu'><a href='https://rdrr.io/pkg/lmtest/man/lrtest.html'>lrtest</a></span><span class='op'>(</span><span class='va'>fit.tc</span>, <span class='va'>fit.FOMC_SFO.tc</span><span class='op'>)</span> +</div><div class='output co'>#> Likelihood ratio test #> #> Model 1: FOMC_SFO with error model tc and fixed parameter(s) m1_0 #> Model 2: SFO_SFO with error model tc and fixed parameter(s) m1_0 @@ -579,10 +598,11 @@ Degradation Data. <em>Environments</em> 6(12) 124 #> 1 7 -64.829 #> 2 6 -64.983 -1 0.3075 0.5792</div><div class='input'><span class='co'># Also, the missing standard error for log_beta and the t-tests for alpha</span> <span class='co'># and beta indicate overparameterisation</span> -<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span>(<span class='no'>fit.FOMC_SFO.tc</span>, <span class='kw'>data</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)</div><div class='output co'>#> <span class='warning'>Warning: NaNs produced</span></div><div class='output co'>#> <span class='warning'>Warning: NaNs produced</span></div><div class='output co'>#> <span class='warning'>Warning: diag(.) had 0 or NA entries; non-finite result is doubtful</span></div><div class='output co'>#> mkin version used for fitting: 0.9.50.3 -#> R version used for fitting: 4.0.2 -#> Date of fit: Thu Oct 8 09:12:29 2020 -#> Date of summary: Thu Oct 8 09:12:29 2020 +<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span><span class='op'>(</span><span class='va'>fit.FOMC_SFO.tc</span>, data <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> +</div><div class='output co'>#> <span class='warning'>Warning: NaNs produced</span></div><div class='output co'>#> <span class='warning'>Warning: NaNs produced</span></div><div class='output co'>#> <span class='warning'>Warning: diag(.) had 0 or NA entries; non-finite result is doubtful</span></div><div class='output co'>#> mkin version used for fitting: 0.9.50.4 +#> R version used for fitting: 4.0.3 +#> Date of fit: Thu Nov 5 08:25:56 2020 +#> Date of summary: Thu Nov 5 08:25:56 2020 #> #> Equations: #> d_parent/dt = - (alpha/beta) * 1/((time/beta) + 1) * parent @@ -591,7 +611,7 @@ Degradation Data. <em>Environments</em> 6(12) 124 #> #> Model predictions using solution type deSolve #> -#> Fitted using 3611 model solutions performed in 2.61 s +#> Fitted using 3611 model solutions performed in 2.673 s #> #> Error model: Two-component variance function #> @@ -684,10 +704,11 @@ Degradation Data. <em>Environments</em> 6(12) 124 #> parent 6.812 22.7 6.834 #> m1 136.661 454.0 NA</div><div class='input'> <span class='co'># We can easily use starting parameters from the parent only fit (only for illustration)</span> -<span class='no'>fit.FOMC</span> <span class='kw'>=</span> <span class='fu'>mkinfit</span>(<span class='st'>"FOMC"</span>, <span class='no'>FOCUS_2006_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='st'>"tc"</span>) -<span class='no'>fit.FOMC_SFO</span> <span class='kw'><-</span> <span class='fu'>mkinfit</span>(<span class='no'>FOMC_SFO</span>, <span class='no'>FOCUS_D</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, - <span class='kw'>parms.ini</span> <span class='kw'>=</span> <span class='no'>fit.FOMC</span>$<span class='no'>bparms.ode</span>, <span class='kw'>error_model</span> <span class='kw'>=</span> <span class='st'>"tc"</span>) -<span class='co'># }</span></div></pre> +<span class='va'>fit.FOMC</span> <span class='op'>=</span> <span class='fu'>mkinfit</span><span class='op'>(</span><span class='st'>"FOMC"</span>, <span class='va'>FOCUS_2006_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span>, error_model <span class='op'>=</span> <span class='st'>"tc"</span><span class='op'>)</span> +<span class='va'>fit.FOMC_SFO</span> <span class='op'><-</span> <span class='fu'>mkinfit</span><span class='op'>(</span><span class='va'>FOMC_SFO</span>, <span class='va'>FOCUS_D</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span>, + parms.ini <span class='op'>=</span> <span class='va'>fit.FOMC</span><span class='op'>$</span><span class='va'>bparms.ode</span>, error_model <span class='op'>=</span> <span class='st'>"tc"</span><span class='op'>)</span> +<span class='co'># }</span> +</div></pre> </div> <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar"> <nav id="toc" data-toggle="toc" class="sticky-top"> @@ -703,7 +724,7 @@ Degradation Data. <em>Environments</em> 6(12) 124 </div> <div class="pkgdown"> - <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.5.1.</p> + <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.6.1.</p> </div> </footer> diff --git a/docs/dev/reference/nlme.mmkin.html b/docs/dev/reference/nlme.mmkin.html index 3fa4d97b..c3cc53ff 100644 --- a/docs/dev/reference/nlme.mmkin.html +++ b/docs/dev/reference/nlme.mmkin.html @@ -180,7 +180,7 @@ have been obtained by fitting the same model to a list of datasets.</p> <colgroup><col class="name" /><col class="desc" /></colgroup> <tr> <th>model</th> - <td><p>An <code><a href='mmkin.html'>mmkin</a></code> row object.</p></td> + <td><p>An <a href='mmkin.html'>mmkin</a> row object.</p></td> </tr> <tr> <th>data</th> @@ -262,13 +262,13 @@ methods that will automatically work on 'nlme.mmkin' objects, such as <code><a href='https://rdrr.io/pkg/nlme/man/intervals.html'>nlme::intervals()</a></code>, <code><a href='https://rdrr.io/pkg/nlme/man/anova.lme.html'>nlme::anova.lme()</a></code> and <code><a href='https://rdrr.io/pkg/nlme/man/coef.lme.html'>nlme::coef.lme()</a></code>.</p> <h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2> - <div class='dont-index'><p><code><a href='nlme_function.html'>nlme_function</a></code></p></div> + <div class='dont-index'><p><code><a href='nlme_function.html'>nlme_function()</a></code></p></div> <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> <pre class="examples"><div class='input'><span class='va'>ds</span> <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>lapply</a></span><span class='op'>(</span><span class='va'>experimental_data_for_UBA_2019</span><span class='op'>[</span><span class='fl'>6</span><span class='op'>:</span><span class='fl'>10</span><span class='op'>]</span>, <span class='kw'>function</span><span class='op'>(</span><span class='va'>x</span><span class='op'>)</span> <span class='fu'><a href='https://rdrr.io/r/base/subset.html'>subset</a></span><span class='op'>(</span><span class='va'>x</span><span class='op'>$</span><span class='va'>data</span><span class='op'>[</span><span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"name"</span>, <span class='st'>"time"</span>, <span class='st'>"value"</span><span class='op'>)</span><span class='op'>]</span>, <span class='va'>name</span> <span class='op'>==</span> <span class='st'>"parent"</span><span class='op'>)</span><span class='op'>)</span> <span class='va'>f</span> <span class='op'><-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='st'>"SFO"</span>, <span class='st'>"DFOP"</span><span class='op'>)</span>, <span class='va'>ds</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span>, cores <span class='op'>=</span> <span class='fl'>1</span><span class='op'>)</span> -</div><div class='output co'>#> <span class='warning'>Warning: Shapiro-Wilk test for standardized residuals: p = 0.0195</span></div><div class='output co'>#> <span class='warning'>Warning: Shapiro-Wilk test for standardized residuals: p = 0.00985</span></div><div class='output co'>#> <span class='warning'>Warning: Shapiro-Wilk test for standardized residuals: p = 0.011</span></div><div class='input'><span class='kw'><a href='https://rdrr.io/r/base/library.html'>library</a></span><span class='op'>(</span><span class='va'><a href='https://svn.r-project.org/R-packages/trunk/nlme/'>nlme</a></span><span class='op'>)</span> +<span class='kw'><a href='https://rdrr.io/r/base/library.html'>library</a></span><span class='op'>(</span><span class='va'><a href='https://svn.r-project.org/R-packages/trunk/nlme/'>nlme</a></span><span class='op'>)</span> <span class='va'>f_nlme_sfo</span> <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span><span class='op'>(</span><span class='va'>f</span><span class='op'>[</span><span class='st'>"SFO"</span>, <span class='op'>]</span><span class='op'>)</span> <span class='va'>f_nlme_dfop</span> <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span><span class='op'>(</span><span class='va'>f</span><span class='op'>[</span><span class='st'>"DFOP"</span>, <span class='op'>]</span><span class='op'>)</span> <span class='fu'><a href='https://rdrr.io/r/stats/AIC.html'>AIC</a></span><span class='op'>(</span><span class='va'>f_nlme_sfo</span>, <span class='va'>f_nlme_dfop</span><span class='op'>)</span> diff --git a/docs/dev/reference/saemix.html b/docs/dev/reference/saemix.html index 2c4fd2d7..c8cf9fab 100644 --- a/docs/dev/reference/saemix.html +++ b/docs/dev/reference/saemix.html @@ -153,7 +153,7 @@ list of mkinfit objects that have been obtained by fitting the same model to a list of datasets.</p> </div> - <pre class="usage"><span class='fu'>saemix_model</span><span class='op'>(</span><span class='va'>object</span>, cores <span class='op'>=</span> <span class='fu'>parallel</span><span class='fu'>::</span><span class='fu'><a href='https://rdrr.io/r/parallel/detectCores.html'>detectCores</a></span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span> + <pre class="usage"><span class='fu'>saemix_model</span><span class='op'>(</span><span class='va'>object</span>, cores <span class='op'>=</span> <span class='fl'>1</span><span class='op'>)</span> <span class='fu'>saemix_data</span><span class='op'>(</span><span class='va'>object</span>, <span class='va'>...</span><span class='op'>)</span></pre> @@ -162,12 +162,15 @@ a list of datasets.</p> <colgroup><col class="name" /><col class="desc" /></colgroup> <tr> <th>object</th> - <td><p>An mmkin row object containing several fits of the same model to different datasets</p></td> + <td><p>An mmkin row object containing several fits of the same model +to different datasets</p></td> </tr> <tr> <th>cores</th> - <td><p>The number of cores to be used for multicore processing. -On Windows machines, cores > 1 is currently not supported.</p></td> + <td><p>The number of cores to be used for multicore processing using +<code><a href='https://rdrr.io/r/parallel/mclapply.html'>parallel::mclapply()</a></code>. Using more than 1 core is experimental and may +lead to uncontrolled forking, apparently depending on the BLAS version +used.</p></td> </tr> <tr> <th>...</th> @@ -237,8 +240,8 @@ variances of the deviations of the parameters from these mean values.</p> #> res <- unlist(res_list) #> return(res) #> } -#> <bytecode: 0x555555c89340> -#> <environment: 0x555555c82680> +#> <bytecode: 0x55555d62aeb8> +#> <environment: 0x55555e35c170> #> Nb of parameters: 4 #> parameter names: parent_0 log_k_parent log_k_A1 f_parent_ilr_1 #> distribution: @@ -271,10 +274,10 @@ variances of the deviations of the parameters from these mean values.</p> nbiter.saemix <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span><span class='fl'>200</span>, <span class='fl'>80</span><span class='op'>)</span><span class='op'>)</span> <span class='va'>f_saemix</span> <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/pkg/saemix/man/saemix.html'>saemix</a></span><span class='op'>(</span><span class='va'>m_saemix</span>, <span class='va'>d_saemix</span>, <span class='va'>saemix_options</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Thu Oct 15 14:51:26 2020" +#> [1] "Thu Nov 5 08:26:39 2020" #> .. #> Minimisation finished -#> [1] "Thu Oct 15 14:53:18 2020"</div><div class='img'><img src='saemix-1.png' alt='' width='700' height='433' /></div><div class='output co'>#> Nonlinear mixed-effects model fit by the SAEM algorithm +#> [1] "Thu Nov 5 08:28:33 2020"</div><div class='img'><img src='saemix-1.png' alt='' width='700' height='433' /></div><div class='output co'>#> Nonlinear mixed-effects model fit by the SAEM algorithm #> ----------------------------------- #> ---- Data ---- #> ----------------------------------- @@ -338,8 +341,8 @@ variances of the deviations of the parameters from these mean values.</p> #> res <- unlist(res_list) #> return(res) #> } -#> <bytecode: 0x555555c89340> -#> <environment: 0x555555c82680> +#> <bytecode: 0x55555d62aeb8> +#> <environment: 0x55555e35c170> #> Nb of parameters: 4 #> parameter names: parent_0 log_k_parent log_k_A1 f_parent_ilr_1 #> distribution: @@ -483,8 +486,8 @@ variances of the deviations of the parameters from these mean values.</p> #> res <- unlist(res_list) #> return(res) #> } -#> <bytecode: 0x555555c89340> -#> <environment: 0x55555df58cf8> +#> <bytecode: 0x55555d62aeb8> +#> <environment: 0x55555cd8e028> #> Nb of parameters: 2 #> parameter names: parent_0 log_k_parent #> distribution: @@ -510,10 +513,10 @@ variances of the deviations of the parameters from these mean values.</p> #> Structured data: value ~ time + name | ds #> X variable for graphs: time () </div><div class='input'><span class='va'>f_saemix_tc</span> <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/pkg/saemix/man/saemix.html'>saemix</a></span><span class='op'>(</span><span class='va'>m_saemix_tc</span>, <span class='va'>d_saemix_tc</span>, <span class='va'>saemix_options</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Thu Oct 15 14:53:35 2020" +#> [1] "Thu Nov 5 08:28:50 2020" #> .. #> Minimisation finished -#> [1] "Thu Oct 15 14:54:25 2020"</div><div class='output co'>#> Nonlinear mixed-effects model fit by the SAEM algorithm +#> [1] "Thu Nov 5 08:29:41 2020"</div><div class='output co'>#> Nonlinear mixed-effects model fit by the SAEM algorithm #> ----------------------------------- #> ---- Data ---- #> ----------------------------------- @@ -577,8 +580,8 @@ variances of the deviations of the parameters from these mean values.</p> #> res <- unlist(res_list) #> return(res) #> } -#> <bytecode: 0x555555c89340> -#> <environment: 0x55555df58cf8> +#> <bytecode: 0x55555d62aeb8> +#> <environment: 0x55555cd8e028> #> Nb of parameters: 2 #> parameter names: parent_0 log_k_parent #> distribution: |