diff options
Diffstat (limited to 'docs/dev/reference/saem.html')
-rw-r--r-- | docs/dev/reference/saem.html | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/docs/dev/reference/saem.html b/docs/dev/reference/saem.html index f883eb11..06fcfaa7 100644 --- a/docs/dev/reference/saem.html +++ b/docs/dev/reference/saem.html @@ -41,8 +41,8 @@ <meta property="og:title" content="Fit nonlinear mixed models with SAEM — saem" /> <meta property="og:description" content="This function uses saemix::saemix() as a backend for fitting nonlinear mixed -effects models created from mmkin row objects using the stochastic approximation -to the expectation maximisation algorithm (SAEM)." /> +effects models created from mmkin row objects using the Stochastic Approximation +Expectation Maximisation algorithm (SAEM)." /> <meta name="robots" content="noindex"> @@ -147,8 +147,8 @@ to the expectation maximisation algorithm (SAEM)." /> <div class="ref-description"> <p>This function uses <code><a href='https://rdrr.io/pkg/saemix/man/saemix.html'>saemix::saemix()</a></code> as a backend for fitting nonlinear mixed -effects models created from <a href='mmkin.html'>mmkin</a> row objects using the stochastic approximation -to the expectation maximisation algorithm (SAEM).</p> +effects models created from <a href='mmkin.html'>mmkin</a> row objects using the Stochastic Approximation +Expectation Maximisation algorithm (SAEM).</p> </div> <pre class="usage"><span class='fu'>saem</span><span class='op'>(</span><span class='va'>object</span>, <span class='va'>control</span>, <span class='va'>...</span><span class='op'>)</span> @@ -205,7 +205,8 @@ by the saemix function?</p></td> <h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2> - <p>An <a href='https://rdrr.io/pkg/saemix/man/SaemixObject-class.html'>saemix::SaemixObject</a>.</p> + <p>An S3 object of class 'saem.mmkin', containing the fitted +<a href='https://rdrr.io/pkg/saemix/man/SaemixObject-class.html'>saemix::SaemixObject</a> as a list component named 'so'.</p> <p>An <a href='https://rdrr.io/pkg/saemix/man/SaemixModel-class.html'>saemix::SaemixModel</a> object.</p> <p>An <a href='https://rdrr.io/pkg/saemix/man/SaemixData-class.html'>saemix::SaemixData</a> object.</p> <h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2> @@ -215,6 +216,9 @@ obtained by fitting the same model to a list of datasets using <a href='mkinfit. <p>Starting values for the fixed effects (population mean parameters, argument psi0 of <code><a href='https://rdrr.io/pkg/saemix/man/saemixModel.html'>saemix::saemixModel()</a></code> are the mean values of the parameters found using <a href='mmkin.html'>mmkin</a>.</p> + <h2 class="hasAnchor" id="see-also"><a class="anchor" href="#see-also"></a>See also</h2> + + <div class='dont-index'><p><a href='summary.saem.mmkin.html'>summary.saem.mmkin</a></p></div> <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> <pre class="examples"><div class='input'><span class='co'># \dontrun{</span> @@ -225,27 +229,27 @@ using <a href='mmkin.html'>mmkin</a>.</p> state.ini <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'>100</span><span class='op'>)</span>, fixed_initials <span class='op'>=</span> <span class='st'>"parent"</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span><span class='op'>)</span> <span class='va'>f_saem_p0_fixed</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_parent_p0_fixed</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Sat Nov 7 13:14:50 2020" +#> [1] "Sun Nov 8 02:44:42 2020" #> .... #> Minimisation finished -#> [1] "Sat Nov 7 13:14:52 2020"</div><div class='input'> +#> [1] "Sun Nov 8 02:44:43 2020"</div><div class='input'> <span class='va'>f_mmkin_parent</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'>"FOMC"</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><span class='op'>)</span> <span class='va'>f_saem_sfo</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_parent</span><span class='op'>[</span><span class='st'>"SFO"</span>, <span class='op'>]</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Sat Nov 7 13:14:53 2020" +#> [1] "Sun Nov 8 02:44:45 2020" #> .... #> Minimisation finished -#> [1] "Sat Nov 7 13:14:55 2020"</div><div class='input'><span class='va'>f_saem_fomc</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_parent</span><span class='op'>[</span><span class='st'>"FOMC"</span>, <span class='op'>]</span><span class='op'>)</span> +#> [1] "Sun Nov 8 02:44:46 2020"</div><div class='input'><span class='va'>f_saem_fomc</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_parent</span><span class='op'>[</span><span class='st'>"FOMC"</span>, <span class='op'>]</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Sat Nov 7 13:14:55 2020" +#> [1] "Sun Nov 8 02:44:47 2020" #> .... #> Minimisation finished -#> [1] "Sat Nov 7 13:14:57 2020"</div><div class='input'><span class='va'>f_saem_dfop</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_parent</span><span class='op'>[</span><span class='st'>"DFOP"</span>, <span class='op'>]</span><span class='op'>)</span> +#> [1] "Sun Nov 8 02:44:49 2020"</div><div class='input'><span class='va'>f_saem_dfop</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_parent</span><span class='op'>[</span><span class='st'>"DFOP"</span>, <span class='op'>]</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Sat Nov 7 13:14:57 2020" +#> [1] "Sun Nov 8 02:44:49 2020" #> .... #> Minimisation finished -#> [1] "Sat Nov 7 13:15:00 2020"</div><div class='input'> +#> [1] "Sun Nov 8 02:44:52 2020"</div><div class='input'> <span class='co'># The returned saem.mmkin object contains an SaemixObject, we can use</span> <span class='co'># functions from saemix</span> <span class='kw'><a href='https://rdrr.io/r/base/library.html'>library</a></span><span class='op'>(</span><span class='va'>saemix</span><span class='op'>)</span> @@ -258,10 +262,10 @@ using <a href='mmkin.html'>mmkin</a>.</p> <span class='va'>f_mmkin_parent_tc</span> <span class='op'><-</span> <span class='fu'><a href='https://rdrr.io/r/stats/update.html'>update</a></span><span class='op'>(</span><span class='va'>f_mmkin_parent</span>, error_model <span class='op'>=</span> <span class='st'>"tc"</span><span class='op'>)</span> <span class='va'>f_saem_fomc_tc</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_parent_tc</span><span class='op'>[</span><span class='st'>"FOMC"</span>, <span class='op'>]</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Sat Nov 7 13:15:02 2020" +#> [1] "Sun Nov 8 02:44:54 2020" #> .... #> Minimisation finished -#> [1] "Sat Nov 7 13:15:07 2020"</div><div class='input'><span class='fu'><a href='https://rdrr.io/pkg/saemix/man/compare.saemix.html'>compare.saemix</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span><span class='va'>f_saem_fomc</span><span class='op'>$</span><span class='va'>so</span>, <span class='va'>f_saem_fomc_tc</span><span class='op'>$</span><span class='va'>so</span><span class='op'>)</span><span class='op'>)</span> +#> [1] "Sun Nov 8 02:44:59 2020"</div><div class='input'><span class='fu'><a href='https://rdrr.io/pkg/saemix/man/compare.saemix.html'>compare.saemix</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span><span class='va'>f_saem_fomc</span><span class='op'>$</span><span class='va'>so</span>, <span class='va'>f_saem_fomc_tc</span><span class='op'>$</span><span class='va'>so</span><span class='op'>)</span><span class='op'>)</span> </div><div class='output co'>#> Likelihoods computed by importance sampling </div><div class='output co'>#> AIC BIC #> 1 467.7644 465.0305 #> 2 469.4862 466.3617</div><div class='input'> @@ -271,20 +275,20 @@ using <a href='mmkin.html'>mmkin</a>.</p> <span class='co'># This takes about 4 minutes on my system</span> <span class='va'>f_saem</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Sat Nov 7 13:15:08 2020" +#> [1] "Sun Nov 8 02:45:00 2020" #> .... #> Minimisation finished -#> [1] "Sat Nov 7 13:19:07 2020"</div><div class='input'> +#> [1] "Sun Nov 8 02:49:01 2020"</div><div class='output co'>#> <span class='error'>Error in exp(trans_k): non-numeric argument to mathematical function</span></div><div class='output co'>#> <span class='message'>Timing stopped at: 317.7 169.9 258.9</span></div><div class='input'> <span class='va'>f_mmkin_des</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/list.html'>list</a></span><span class='op'>(</span><span class='st'>"DFOP-SFO"</span> <span class='op'>=</span> <span class='va'>dfop_sfo</span><span class='op'>)</span>, <span class='va'>ds</span>, quiet <span class='op'>=</span> <span class='cn'>TRUE</span>, solution_type <span class='op'>=</span> <span class='st'>"deSolve"</span><span class='op'>)</span> <span class='co'># Using a single core, the following takes about 6 minutes, using 10 cores</span> <span class='co'># it is slower instead of faster</span> <span class='va'>f_saem_des</span> <span class='op'><-</span> <span class='fu'>saem</span><span class='op'>(</span><span class='va'>f_mmkin_des</span>, cores <span class='op'>=</span> <span class='fl'>1</span><span class='op'>)</span> </div><div class='output co'>#> Running main SAEM algorithm -#> [1] "Sat Nov 7 13:19:26 2020" +#> [1] "Sun Nov 8 02:49:20 2020" #> .... #> Minimisation finished -#> [1] "Sat Nov 7 13:27:33 2020"</div><div class='input'><span class='fu'><a href='https://rdrr.io/pkg/saemix/man/compare.saemix.html'>compare.saemix</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span><span class='va'>f_saemix</span><span class='op'>$</span><span class='va'>so</span>, <span class='va'>f_saemix_des</span><span class='op'>$</span><span class='va'>so</span><span class='op'>)</span><span class='op'>)</span> -</div><div class='output co'>#> <span class='error'>Error in compare.saemix(list(f_saemix$so, f_saemix_des$so)): object 'f_saemix' not found</span></div><div class='input'><span class='co'># }</span> +#> [1] "Sun Nov 8 02:57:30 2020"</div><div class='output co'>#> <span class='error'>Error in exp(trans_k): non-numeric argument to mathematical function</span></div><div class='output co'>#> <span class='message'>Timing stopped at: 591.7 205.6 521.4</span></div><div class='input'><span class='fu'><a href='https://rdrr.io/pkg/saemix/man/compare.saemix.html'>compare.saemix</a></span><span class='op'>(</span><span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span><span class='op'>(</span><span class='va'>f_saem</span><span class='op'>$</span><span class='va'>so</span>, <span class='va'>f_saem_des</span><span class='op'>$</span><span class='va'>so</span><span class='op'>)</span><span class='op'>)</span> +</div><div class='output co'>#> <span class='error'>Error in compare.saemix(list(f_saem$so, f_saem_des$so)): object 'f_saem' not found</span></div><div class='input'><span class='co'># }</span> </div></pre> </div> <div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar"> |