diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2020-11-05 08:31:21 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2020-11-05 08:31:21 +0100 |
commit | 9298a503d8de99dad1f61d6eb8bc228dd4acce6b (patch) | |
tree | 22a8d261835d36e59c371a858598dbe309aa89ec /docs/dev/reference/mkinfit.html | |
parent | f24a86c1f33e06c8114021c5c3956b5f7c400c18 (diff) |
Fix link and update docs
Diffstat (limited to 'docs/dev/reference/mkinfit.html')
-rw-r--r-- | docs/dev/reference/mkinfit.html | 167 |
1 files changed, 94 insertions, 73 deletions
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> |