diff options
Diffstat (limited to 'docs/reference/saemix.html')
-rw-r--r-- | docs/reference/saemix.html | 135 |
1 files changed, 46 insertions, 89 deletions
diff --git a/docs/reference/saemix.html b/docs/reference/saemix.html index 1737a21c..d3eb216c 100644 --- a/docs/reference/saemix.html +++ b/docs/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='no'>object</span>) + <pre class="usage"><span class='fu'>saemix_model</span>(<span class='no'>object</span>, <span class='kw'>cores</span> <span class='kw'>=</span> <span class='kw pkg'>parallel</span><span class='kw ns'>::</span><span class='fu'><a href='https://rdrr.io/r/parallel/detectCores.html'>detectCores</a></span>()) <span class='fu'>saemix_data</span>(<span class='no'>object</span>, <span class='no'>...</span>)</pre> @@ -165,6 +165,11 @@ a list of datasets.</p> <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> + </tr> + <tr> <th>...</th> <td><p>Further parameters passed to <a href='https://rdrr.io/pkg/saemix/man/saemixData.html'>saemix::saemixData</a></p></td> </tr> @@ -174,21 +179,22 @@ a list of datasets.</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> + + <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 +mmkin. Starting variances of the random effects (argument omega.init) are the +variances of the deviations of the parameters from these mean values.</p> <h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2> <pre class="examples"><div class='input'><span class='no'>ds</span> <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/lapply.html'>lapply</a></span>(<span class='no'>experimental_data_for_UBA_2019</span>[<span class='fl'>6</span>:<span class='fl'>10</span>], <span class='kw'>function</span>(<span class='no'>x</span>) <span class='fu'><a href='https://rdrr.io/r/base/subset.html'>subset</a></span>(<span class='no'>x</span>$<span class='no'>data</span>[<span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='st'>"name"</span>, <span class='st'>"time"</span>, <span class='st'>"value"</span>)])) <span class='fu'><a href='https://rdrr.io/r/base/names.html'>names</a></span>(<span class='no'>ds</span>) <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/paste.html'>paste</a></span>(<span class='st'>"Dataset"</span>, <span class='fl'>6</span>:<span class='fl'>10</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'>"A1"</span>), - <span class='kw'>A1</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'>f_mmkin</span> <span class='kw'><-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span>(<span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span>(<span class='st'>"SFO-SFO"</span> <span class='kw'>=</span> <span class='no'>sfo_sfo</span>), <span class='no'>ds</span>, <span class='kw'>quiet</span> <span class='kw'>=</span> <span class='fl'>TRUE</span>, <span class='kw'>cores</span> <span class='kw'>=</span> <span class='fl'>5</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'>saemix</span>)) { - <span class='no'>m_saemix</span> <span class='kw'><-</span> <span class='fu'>saemix_model</span>(<span class='no'>f_mmkin</span>) - <span class='no'>d_saemix</span> <span class='kw'><-</span> <span class='fu'>saemix_data</span>(<span class='no'>f_mmkin</span>) - <span class='no'>saemix_options</span> <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span>(<span class='kw'>seed</span> <span class='kw'>=</span> <span class='fl'>123456</span>, <span class='kw'>save</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>save.graphs</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>) - <span class='fu'><a href='https://rdrr.io/pkg/saemix/man/saemix.html'>saemix</a></span>(<span class='no'>m_saemix</span>, <span class='no'>d_saemix</span>, <span class='no'>saemix_options</span>) -}</div><div class='output co'>#> <span class='message'>Loading required package: saemix</span></div><div class='output co'>#> <span class='message'>Package saemix, version 3.1.9000</span> -#> <span class='message'> please direct bugs, questions and feedback to emmanuelle.comets@inserm.fr</span></div><div class='output co'>#> + <span class='kw'>A1</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='co'># \dontrun{</span> +<span class='no'>f_mmkin</span> <span class='kw'><-</span> <span class='fu'><a href='mmkin.html'>mmkin</a></span>(<span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span>(<span class='st'>"SFO-SFO"</span> <span class='kw'>=</span> <span class='no'>sfo_sfo</span>), <span class='no'>ds</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/library.html'>library</a></span>(<span class='no'>saemix</span>)</div><div class='output co'>#> <span class='message'>Package saemix, version 3.1.9000</span> +#> <span class='message'> please direct bugs, questions and feedback to emmanuelle.comets@inserm.fr</span></div><div class='input'><span class='no'>m_saemix</span> <span class='kw'><-</span> <span class='fu'>saemix_model</span>(<span class='no'>f_mmkin</span>)</div><div class='output co'>#> #> #> The following SaemixModel object was successfully created: #> @@ -224,12 +230,12 @@ a list of datasets.</p> #> out_values <- out_wide[out_index] #> } #> return(out_values) -#> }, mc.cores = 15) +#> }, mc.cores = cores) #> res <- unlist(res_list) #> return(res) #> } -#> <bytecode: 0x555559875398> -#> <environment: 0x55555973a248> +#> <bytecode: 0x555559668108> +#> <environment: 0x555559677c08> #> Nb of parameters: 4 #> parameter names: parent_0 log_k_parent log_k_A1 f_parent_ilr_1 #> distribution: @@ -248,8 +254,7 @@ a list of datasets.</p> #> No covariate in the model. #> Initial values #> parent_0 log_k_parent log_k_A1 f_parent_ilr_1 -#> Pop.CondInit 86.53449 -3.207005 -3.060308 -1.920449 -#> +#> Pop.CondInit 86.53449 -3.207005 -3.060308 -1.920449</div><div class='input'><span class='no'>d_saemix</span> <span class='kw'><-</span> <span class='fu'>saemix_data</span>(<span class='no'>f_mmkin</span>)</div><div class='output co'>#> #> #> The following SaemixData object was successfully created: #> @@ -257,12 +262,14 @@ a list of datasets.</p> #> longitudinal data for use with the SAEM algorithm #> Dataset ds_saemix #> Structured data: value ~ time + name | ds -#> X variable for graphs: time () -#> Running main SAEM algorithm -#> [1] "Mon May 25 12:48:51 2020" -#> .</div><div class='img'><img src='saemix-1.png' alt='' width='700' height='433' /></div><div class='output co'>#> .</div><div class='img'><img src='saemix-2.png' alt='' width='700' height='433' /></div><div class='output co'>#> .</div><div class='img'><img src='saemix-3.png' alt='' width='700' height='433' /></div><div class='output co'>#> .</div><div class='img'><img src='saemix-4.png' alt='' width='700' height='433' /></div><div class='output co'>#> +#> X variable for graphs: time () </div><div class='input'><span class='no'>saemix_options</span> <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/r/base/list.html'>list</a></span>(<span class='kw'>seed</span> <span class='kw'>=</span> <span class='fl'>123456</span>, + <span class='kw'>save</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>save.graphs</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, <span class='kw'>displayProgress</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>, + <span class='kw'>nbiter.saemix</span> <span class='kw'>=</span> <span class='fu'><a href='https://rdrr.io/r/base/c.html'>c</a></span>(<span class='fl'>200</span>, <span class='fl'>80</span>)) +<span class='no'>f_saemix</span> <span class='kw'><-</span> <span class='fu'><a href='https://rdrr.io/pkg/saemix/man/saemix.html'>saemix</a></span>(<span class='no'>m_saemix</span>, <span class='no'>d_saemix</span>, <span class='no'>saemix_options</span>)</div><div class='output co'>#> Running main SAEM algorithm +#> [1] "Tue May 26 18:25:16 2020" +#> .. #> Minimisation finished -#> [1] "Mon May 25 12:56:39 2020"</div><div class='output co'>#> Nonlinear mixed-effects model fit by the SAEM algorithm +#> [1] "Tue May 26 18:31:09 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 ---- #> ----------------------------------- @@ -322,12 +329,12 @@ a list of datasets.</p> #> out_values <- out_wide[out_index] #> } #> return(out_values) -#> }, mc.cores = 15) +#> }, mc.cores = cores) #> res <- unlist(res_list) #> return(res) #> } -#> <bytecode: 0x555559875398> -#> <environment: 0x55555973a248> +#> <bytecode: 0x555559668108> +#> <environment: 0x555559677c08> #> Nb of parameters: 4 #> parameter names: parent_0 log_k_parent log_k_A1 f_parent_ilr_1 #> distribution: @@ -353,7 +360,7 @@ a list of datasets.</p> #> Estimation of individual parameters (MAP) #> Estimation of standard errors and linearised log-likelihood #> Estimation of log-likelihood by importance sampling -#> Number of iterations: K1=300, K2=100 +#> Number of iterations: K1=200, K2=80 #> Number of chains: 10 #> Seed: 123456 #> Number of MCMC iterations for IS: 5000 @@ -369,19 +376,19 @@ a list of datasets.</p> #> ----------------- Fixed effects ------------------ #> ---------------------------------------------------- #> Parameter Estimate SE CV(%) -#> [1,] parent_0 86.21 1.51 1.7 +#> [1,] parent_0 86.14 1.61 1.9 #> [2,] log_k_parent -3.21 0.59 18.5 -#> [3,] log_k_A1 -4.64 0.29 6.3 -#> [4,] f_parent_ilr_1 -0.32 0.30 93.2 -#> [5,] a.1 4.69 0.27 5.8 +#> [3,] log_k_A1 -4.66 0.30 6.4 +#> [4,] f_parent_ilr_1 -0.33 0.30 91.7 +#> [5,] a.1 4.68 0.27 5.8 #> ---------------------------------------------------- #> ----------- Variance of random effects ----------- #> ---------------------------------------------------- #> Parameter Estimate SE CV(%) -#> parent_0 omega2.parent_0 6.07 7.08 117 -#> log_k_parent omega2.log_k_parent 1.75 1.11 63 +#> parent_0 omega2.parent_0 7.71 8.14 106 +#> log_k_parent omega2.log_k_parent 1.76 1.12 63 #> log_k_A1 omega2.log_k_A1 0.26 0.26 101 -#> f_parent_ilr_1 omega2.f_parent_ilr_1 0.38 0.27 71 +#> f_parent_ilr_1 omega2.f_parent_ilr_1 0.39 0.28 71 #> ---------------------------------------------------- #> ------ Correlation matrix of random effects ------ #> ---------------------------------------------------- @@ -399,66 +406,16 @@ a list of datasets.</p> #> --------------- Statistical criteria ------------- #> ---------------------------------------------------- #> Likelihood computed by linearisation -#> -2LL= 1064.397 -#> AIC = 1082.397 -#> BIC = 1078.882 +#> -2LL= 1064.364 +#> AIC = 1082.364 +#> BIC = 1078.848 #> #> Likelihood computed by importance sampling -#> -2LL= 1063.161 -#> AIC = 1081.161 -#> BIC = 1077.646 -#> ----------------------------------------------------</div><div class='output co'>#> Nonlinear mixed-effects model fit by the SAEM algorithm -#> ----------------------------------------- -#> ---- Data and Model ---- -#> ----------------------------------------- -#> Data -#> Dataset ds_saemix -#> Longitudinal data: value ~ time + name | ds -#> -#> Model: -#> Mixed model generated from mmkin object -#> 4 parameters: parent_0 log_k_parent log_k_A1 f_parent_ilr_1 -#> error model: constant -#> No covariate -#> -#> Key options -#> Estimation of individual parameters (MAP) -#> Estimation of standard errors and linearised log-likelihood -#> Estimation of log-likelihood by importance sampling -#> Number of iterations: K1=300, K2=100 -#> Number of chains: 10 -#> Seed: 123456 -#> Number of MCMC iterations for IS: 5000 -#> Input/output -#> results not saved -#> no graphs -#> ---------------------------------------------------- -#> ---- Results ---- -#> Fixed effects -#> Parameter Estimate SE CV(%) -#> parent_0 86.214 1.506 1.75 -#> log_k_parent -3.210 0.593 18.47 -#> log_k_A1 -4.643 0.294 6.34 -#> f_parent_ilr_1 -0.322 0.300 93.24 -#> a.1 4.689 0.270 5.76 -#> -#> Variance of random effects -#> Parameter Estimate SE CV(%) -#> omega2.parent_0 6.068 7.078 116.7 -#> omega2.log_k_parent 1.752 1.111 63.4 -#> omega2.log_k_A1 0.256 0.257 100.5 -#> omega2.f_parent_ilr_1 0.385 0.273 70.8 -#> -#> Statistical criteria -#> Likelihood computed by linearisation -#> -2LL= 1064.397 -#> AIC= 1082.397 -#> BIC= 1078.882 -#> Likelihood computed by importance sampling -#> -2LL= 1063.161 -#> AIC= 1081.161 -#> BIC= 1077.646 </div><div class='input'># } -</div><div class='img'><img src='saemix-5.png' alt='' width='700' height='433' /></div></pre> +#> -2LL= 1063.462 +#> AIC = 1081.462 +#> BIC = 1077.947 +#> ----------------------------------------------------</div><div class='input'><span class='fu'><a href='https://rdrr.io/pkg/saemix/man/plot-SaemixObject-method.html'>plot</a></span>(<span class='no'>f_saemix</span>, <span class='kw'>plot.type</span> <span class='kw'>=</span> <span class='st'>"convergence"</span>)</div><div class='output co'>#> Plotting convergence plots</div><div class='img'><img src='saemix-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"> <nav id="toc" data-toggle="toc" class="sticky-top"> |