diff options
Diffstat (limited to 'docs/dev/reference/nlme.html')
-rw-r--r-- | docs/dev/reference/nlme.html | 112 |
1 files changed, 59 insertions, 53 deletions
diff --git a/docs/dev/reference/nlme.html b/docs/dev/reference/nlme.html index af5a151a..e21074e7 100644 --- a/docs/dev/reference/nlme.html +++ b/docs/dev/reference/nlme.html @@ -75,7 +75,7 @@ datasets. They are used internally by the nlme.mmkin() method." /> </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> @@ -123,7 +123,7 @@ datasets. They are used internally by the nlme.mmkin() method." /> </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> @@ -142,7 +142,7 @@ datasets. They are used internally by the nlme.mmkin() method." /> <div class="col-md-9 contents"> <div class="page-header"> <h1>Helper functions to create nlme models from mmkin row objects</h1> - <small class="dont-index">Source: <a href='http://github.com/jranke/mkin/blob/master/R/nlme.R'><code>R/nlme.R</code></a></small> + <small class="dont-index">Source: <a href='https://github.com/jranke/mkin/blob/master/R/nlme.R'><code>R/nlme.R</code></a></small> <div class="hidden name"><code>nlme.Rd</code></div> </div> @@ -153,11 +153,11 @@ objects that have been obtained by fitting the same model to a list of datasets. They are used internally by the <code><a href='nlme.mmkin.html'>nlme.mmkin()</a></code> method.</p> </div> - <pre class="usage"><span class='fu'>nlme_function</span>(<span class='no'>object</span>) + <pre class="usage"><span class='fu'>nlme_function</span><span class='op'>(</span><span class='va'>object</span><span class='op'>)</span> -<span class='fu'>mean_degparms</span>(<span class='no'>object</span>, <span class='kw'>random</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>) +<span class='fu'>mean_degparms</span><span class='op'>(</span><span class='va'>object</span>, random <span class='op'>=</span> <span class='cn'>FALSE</span><span class='op'>)</span> -<span class='fu'>nlme_data</span>(<span class='no'>object</span>)</pre> +<span class='fu'>nlme_data</span><span class='op'>(</span><span class='va'>object</span><span class='op'>)</span></pre> <h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2> <table class="ref-arguments"> @@ -185,71 +185,77 @@ nlme for the case of a single grouping variable ds.</p> <div class='dont-index'><p><code><a href='nlme.mmkin.html'>nlme.mmkin</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='no'>sampling_times</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>0</span>, <span class='fl'>1</span>, <span class='fl'>3</span>, <span class='fl'>7</span>, <span class='fl'>14</span>, <span class='fl'>28</span>, <span class='fl'>60</span>, <span class='fl'>90</span>, <span class='fl'>120</span>) -<span class='no'>m_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='no'>d_SFO_1</span> <span class='kw'><-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span>(<span class='no'>m_SFO</span>, - <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>k_parent</span> <span class='kw'>=</span> <span class='fl'>0.1</span>), - <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>98</span>), <span class='no'>sampling_times</span>) -<span class='no'>d_SFO_1_long</span> <span class='kw'><-</span> <span class='fu'><a href='mkin_wide_to_long.html'>mkin_wide_to_long</a></span>(<span class='no'>d_SFO_1</span>, <span class='kw'>time</span> <span class='kw'>=</span> <span class='st'>"time"</span>) -<span class='no'>d_SFO_2</span> <span class='kw'><-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span>(<span class='no'>m_SFO</span>, - <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>k_parent</span> <span class='kw'>=</span> <span class='fl'>0.05</span>), - <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>102</span>), <span class='no'>sampling_times</span>) -<span class='no'>d_SFO_2_long</span> <span class='kw'><-</span> <span class='fu'><a href='mkin_wide_to_long.html'>mkin_wide_to_long</a></span>(<span class='no'>d_SFO_2</span>, <span class='kw'>time</span> <span class='kw'>=</span> <span class='st'>"time"</span>) -<span class='no'>d_SFO_3</span> <span class='kw'><-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span>(<span class='no'>m_SFO</span>, - <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>k_parent</span> <span class='kw'>=</span> <span class='fl'>0.02</span>), - <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>parent</span> <span class='kw'>=</span> <span class='fl'>103</span>), <span class='no'>sampling_times</span>) -<span class='no'>d_SFO_3_long</span> <span class='kw'><-</span> <span class='fu'><a href='mkin_wide_to_long.html'>mkin_wide_to_long</a></span>(<span class='no'>d_SFO_3</span>, <span class='kw'>time</span> <span class='kw'>=</span> <span class='st'>"time"</span>) - -<span class='no'>d1</span> <span class='kw'><-</span> <span class='fu'><a href='add_err.html'>add_err</a></span>(<span class='no'>d_SFO_1</span>, <span class='kw'>function</span>(<span class='no'>value</span>) <span class='fl'>3</span>, <span class='kw'>n</span> <span class='kw'>=</span> <span class='fl'>1</span>) -<span class='no'>d2</span> <span class='kw'><-</span> <span class='fu'><a href='add_err.html'>add_err</a></span>(<span class='no'>d_SFO_2</span>, <span class='kw'>function</span>(<span class='no'>value</span>) <span class='fl'>2</span>, <span class='kw'>n</span> <span class='kw'>=</span> <span class='fl'>1</span>) -<span class='no'>d3</span> <span class='kw'><-</span> <span class='fu'><a href='add_err.html'>add_err</a></span>(<span class='no'>d_SFO_3</span>, <span class='kw'>function</span>(<span class='no'>value</span>) <span class='fl'>4</span>, <span class='kw'>n</span> <span class='kw'>=</span> <span class='fl'>1</span>) -<span class='no'>ds</span> <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='kw'>d1</span> <span class='kw'>=</span> <span class='no'>d1</span>, <span class='kw'>d2</span> <span class='kw'>=</span> <span class='no'>d2</span>, <span class='kw'>d3</span> <span class='kw'>=</span> <span class='no'>d3</span>) - -<span class='no'>f</span> <span class='kw'><-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span>(<span class='st'>"SFO"</span>, <span class='no'>ds</span>, <span class='kw'>cores</span> <span class='kw'>=</span> <span class='fl'>1</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>) -<span class='no'>mean_dp</span> <span class='kw'><-</span> <span class='fu'>mean_degparms</span>(<span class='no'>f</span>) -<span class='no'>grouped_data</span> <span class='kw'><-</span> <span class='fu'>nlme_data</span>(<span class='no'>f</span>) -<span class='no'>nlme_f</span> <span class='kw'><-</span> <span class='fu'>nlme_function</span>(<span class='no'>f</span>) + <pre class="examples"><div class='input'><span class='va'>sampling_times</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='fl'>0</span>, <span class='fl'>1</span>, <span class='fl'>3</span>, <span class='fl'>7</span>, <span class='fl'>14</span>, <span class='fl'>28</span>, <span class='fl'>60</span>, <span class='fl'>90</span>, <span class='fl'>120</span><span class='op'>)</span> +<span class='va'>m_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='op'>)</span><span class='op'>)</span> +<span class='va'>d_SFO_1</span> <span class='op'><-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span><span class='op'>(</span><span class='va'>m_SFO</span>, + <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>k_parent <span class='op'>=</span> <span class='fl'>0.1</span><span class='op'>)</span>, + <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>parent <span class='op'>=</span> <span class='fl'>98</span><span class='op'>)</span>, <span class='va'>sampling_times</span><span class='op'>)</span> +<span class='va'>d_SFO_1_long</span> <span class='op'><-</span> <span class='fu'><a href='mkin_wide_to_long.html'>mkin_wide_to_long</a></span><span class='op'>(</span><span class='va'>d_SFO_1</span>, time <span class='op'>=</span> <span class='st'>"time"</span><span class='op'>)</span> +<span class='va'>d_SFO_2</span> <span class='op'><-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span><span class='op'>(</span><span class='va'>m_SFO</span>, + <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>k_parent <span class='op'>=</span> <span class='fl'>0.05</span><span class='op'>)</span>, + <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>parent <span class='op'>=</span> <span class='fl'>102</span><span class='op'>)</span>, <span class='va'>sampling_times</span><span class='op'>)</span> +<span class='va'>d_SFO_2_long</span> <span class='op'><-</span> <span class='fu'><a href='mkin_wide_to_long.html'>mkin_wide_to_long</a></span><span class='op'>(</span><span class='va'>d_SFO_2</span>, time <span class='op'>=</span> <span class='st'>"time"</span><span class='op'>)</span> +<span class='va'>d_SFO_3</span> <span class='op'><-</span> <span class='fu'><a href='mkinpredict.html'>mkinpredict</a></span><span class='op'>(</span><span class='va'>m_SFO</span>, + <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>k_parent <span class='op'>=</span> <span class='fl'>0.02</span><span class='op'>)</span>, + <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>parent <span class='op'>=</span> <span class='fl'>103</span><span class='op'>)</span>, <span class='va'>sampling_times</span><span class='op'>)</span> +<span class='va'>d_SFO_3_long</span> <span class='op'><-</span> <span class='fu'><a href='mkin_wide_to_long.html'>mkin_wide_to_long</a></span><span class='op'>(</span><span class='va'>d_SFO_3</span>, time <span class='op'>=</span> <span class='st'>"time"</span><span class='op'>)</span> + +<span class='va'>d1</span> <span class='op'><-</span> <span class='fu'><a href='add_err.html'>add_err</a></span><span class='op'>(</span><span class='va'>d_SFO_1</span>, <span class='kw'>function</span><span class='op'>(</span><span class='va'>value</span><span class='op'>)</span> <span class='fl'>3</span>, n <span class='op'>=</span> <span class='fl'>1</span><span class='op'>)</span> +<span class='va'>d2</span> <span class='op'><-</span> <span class='fu'><a href='add_err.html'>add_err</a></span><span class='op'>(</span><span class='va'>d_SFO_2</span>, <span class='kw'>function</span><span class='op'>(</span><span class='va'>value</span><span class='op'>)</span> <span class='fl'>2</span>, n <span class='op'>=</span> <span class='fl'>1</span><span class='op'>)</span> +<span class='va'>d3</span> <span class='op'><-</span> <span class='fu'><a href='add_err.html'>add_err</a></span><span class='op'>(</span><span class='va'>d_SFO_3</span>, <span class='kw'>function</span><span class='op'>(</span><span class='va'>value</span><span class='op'>)</span> <span class='fl'>4</span>, n <span class='op'>=</span> <span class='fl'>1</span><span class='op'>)</span> +<span class='va'>ds</span> <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span><span class='op'>(</span>d1 <span class='op'>=</span> <span class='va'>d1</span>, d2 <span class='op'>=</span> <span class='va'>d2</span>, d3 <span class='op'>=</span> <span class='va'>d3</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='st'>"SFO"</span>, <span class='va'>ds</span>, cores <span class='op'>=</span> <span class='fl'>1</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span> +<span class='va'>mean_dp</span> <span class='op'><-</span> <span class='fu'>mean_degparms</span><span class='op'>(</span><span class='va'>f</span><span class='op'>)</span> +<span class='va'>grouped_data</span> <span class='op'><-</span> <span class='fu'>nlme_data</span><span class='op'>(</span><span class='va'>f</span><span class='op'>)</span> +<span class='va'>nlme_f</span> <span class='op'><-</span> <span class='fu'>nlme_function</span><span class='op'>(</span><span class='va'>f</span><span class='op'>)</span> <span class='co'># These assignments are necessary for these objects to be</span> <span class='co'># visible to nlme and augPred when evaluation is done by</span> <span class='co'># pkgdown to generated the html docs.</span> -<span class='fu'><a href='https://rdrr.io/r/base/assign.html'>assign</a></span>(<span class='st'>"nlme_f"</span>, <span class='no'>nlme_f</span>, <span class='fu'><a href='https://rdrr.io/r/base/environment.html'>globalenv</a></span>()) -<span class='fu'><a href='https://rdrr.io/r/base/assign.html'>assign</a></span>(<span class='st'>"grouped_data"</span>, <span class='no'>grouped_data</span>, <span class='fu'><a href='https://rdrr.io/r/base/environment.html'>globalenv</a></span>()) - -<span class='fu'><a href='https://rdrr.io/r/base/library.html'>library</a></span>(<span class='no'>nlme</span>) -<span class='no'>m_nlme</span> <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/nlme.html'>nlme</a></span>(<span class='no'>value</span> ~ <span class='fu'>nlme_f</span>(<span class='no'>name</span>, <span class='no'>time</span>, <span class='no'>parent_0</span>, <span class='no'>log_k_parent_sink</span>), - <span class='kw'>data</span> <span class='kw'>=</span> <span class='no'>grouped_data</span>, - <span class='kw'>fixed</span> <span class='kw'>=</span> <span class='no'>parent_0</span> + <span class='no'>log_k_parent_sink</span> ~ <span class='fl'>1</span>, - <span class='kw'>random</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/pdDiag.html'>pdDiag</a></span>(<span class='no'>parent_0</span> + <span class='no'>log_k_parent_sink</span> ~ <span class='fl'>1</span>), - <span class='kw'>start</span> <span class='kw'>=</span> <span class='no'>mean_dp</span>) -<span class='fu'><a href='https://rdrr.io/r/base/summary.html'>summary</a></span>(<span class='no'>m_nlme</span>)</div><div class='output co'>#> Nonlinear mixed-effects model fit by maximum likelihood +<span class='fu'><a href='https://rdrr.io/r/base/assign.html'>assign</a></span><span class='op'>(</span><span class='st'>"nlme_f"</span>, <span class='va'>nlme_f</span>, <span class='fu'><a href='https://rdrr.io/r/base/environment.html'>globalenv</a></span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span> +<span class='fu'><a href='https://rdrr.io/r/base/assign.html'>assign</a></span><span class='op'>(</span><span class='st'>"grouped_data"</span>, <span class='va'>grouped_data</span>, <span class='fu'><a href='https://rdrr.io/r/base/environment.html'>globalenv</a></span><span class='op'>(</span><span class='op'>)</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'>m_nlme</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'>value</span> <span class='op'>~</span> <span class='fu'>nlme_f</span><span class='op'>(</span><span class='va'>name</span>, <span class='va'>time</span>, <span class='va'>parent_0</span>, <span class='va'>log_k_parent_sink</span><span class='op'>)</span>, + data <span class='op'>=</span> <span class='va'>grouped_data</span>, + fixed <span class='op'>=</span> <span class='va'>parent_0</span> <span class='op'>+</span> <span class='va'>log_k_parent_sink</span> <span class='op'>~</span> <span class='fl'>1</span>, + random <span class='op'>=</span> <span class='fu'><a href='https://rdrr.io/pkg/nlme/man/pdDiag.html'>pdDiag</a></span><span class='op'>(</span><span class='va'>parent_0</span> <span class='op'>+</span> <span class='va'>log_k_parent_sink</span> <span class='op'>~</span> <span class='fl'>1</span><span class='op'>)</span>, + start <span class='op'>=</span> <span class='va'>mean_dp</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'>m_nlme</span><span class='op'>)</span> +</div><div class='output co'>#> Nonlinear mixed-effects model fit by maximum likelihood #> Model: value ~ nlme_f(name, time, parent_0, log_k_parent_sink) #> Data: grouped_data #> AIC BIC logLik -#> 252.7798 262.1358 -121.3899 +#> 298.2781 307.7372 -144.1391 #> #> Random effects: #> Formula: list(parent_0 ~ 1, log_k_parent_sink ~ 1) #> Level: ds #> Structure: Diagonal -#> parent_0 log_k_parent_sink Residual -#> StdDev: 0.0006768135 0.6800777 2.489397 +#> parent_0 log_k_parent_sink Residual +#> StdDev: 0.9374733 0.7098105 3.83543 #> #> Fixed effects: parent_0 + log_k_parent_sink ~ 1 -#> Value Std.Error DF t-value p-value -#> parent_0 101.74884 0.6456014 44 157.60321 0 -#> log_k_parent_sink -3.05575 0.4015811 44 -7.60929 0 +#> Value Std.Error DF t-value p-value +#> parent_0 101.76838 1.1445444 45 88.91606 0 +#> log_k_parent_sink -3.05444 0.4195622 45 -7.28008 0 #> Correlation: #> prnt_0 -#> log_k_parent_sink 0.026 +#> log_k_parent_sink 0.034 #> #> Standardized Within-Group Residuals: #> Min Q1 Med Q3 Max -#> -2.1317488 -0.6878121 0.0828385 0.8592270 2.9529864 +#> -2.6169360 -0.2185329 0.0574070 0.5720937 3.0459868 #> -#> Number of Observations: 48 -#> Number of Groups: 3 </div><div class='input'><span class='fu'><a href='https://rdrr.io/r/base/plot.html'>plot</a></span>(<span class='fu'><a href='https://rdrr.io/pkg/nlme/man/augPred.html'>augPred</a></span>(<span class='no'>m_nlme</span>, <span class='kw'>level</span> <span class='kw'>=</span> <span class='fl'>0</span>:<span class='fl'>1</span>), <span class='kw'>layout</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>3</span>, <span class='fl'>1</span>))</div><div class='img'><img src='nlme-1.png' alt='' width='700' height='433' /></div><div class='input'># augPred does not seem to work on fits with more than one state -# variable - +#> Number of Observations: 49 +#> Number of Groups: 3 </div><div class='input'><span class='fu'><a href='https://rdrr.io/r/graphics/plot.default.html'>plot</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/pkg/nlme/man/augPred.html'>augPred</a></span><span class='op'>(</span><span class='va'>m_nlme</span>, level <span class='op'>=</span> <span class='fl'>0</span><span class='op'>:</span><span class='fl'>1</span><span class='op'>)</span>, layout <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'>3</span>, <span class='fl'>1</span><span class='op'>)</span><span class='op'>)</span> +</div><div class='img'><img src='nlme-1.png' alt='' width='700' height='433' /></div><div class='input'><span class='co'># augPred does not work on fits with more than one state</span> +<span class='co'># variable</span> +<span class='co'>#</span> +<span class='co'># The procedure is greatly simplified by the nlme.mmkin function</span> +<span class='va'>f_nlme</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='fu'><a href='https://rdrr.io/r/graphics/plot.default.html'>plot</a></span><span class='op'>(</span><span class='va'>f_nlme</span><span class='op'>)</span> +</div><div class='img'><img src='nlme-2.png' alt='' width='700' height='433' /></div><div class='input'> </div></pre> </div> <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar"> @@ -266,7 +272,7 @@ nlme for the case of a single grouping variable ds.</p> </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> |