From a9c7a1a8322567e9406a59ba0a4f910b89bd05e6 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 15 Oct 2020 14:55:55 +0200 Subject: More gentle example for saemix with combined error model --- docs/dev/reference/saemix.html | 88 ++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 46 deletions(-) (limited to 'docs/dev/reference/saemix.html') diff --git a/docs/dev/reference/saemix.html b/docs/dev/reference/saemix.html index 5b160959..2c4fd2d7 100644 --- a/docs/dev/reference/saemix.html +++ b/docs/dev/reference/saemix.html @@ -237,8 +237,8 @@ variances of the deviations of the parameters from these mean values.

#> res <- unlist(res_list) #> return(res) #> } -#> <bytecode: 0x55555c1e7720> -#> <environment: 0x55555c1eff38> +#> <bytecode: 0x555555c89340> +#> <environment: 0x555555c82680> #> Nb of parameters: 4 #> parameter names: parent_0 log_k_parent log_k_A1 f_parent_ilr_1 #> distribution: @@ -271,10 +271,10 @@ variances of the deviations of the parameters from these mean values.

nbiter.saemix = c(200, 80)) f_saemix <- saemix(m_saemix, d_saemix, saemix_options)
#> Running main SAEM algorithm -#> [1] "Thu Oct 15 11:55:14 2020" +#> [1] "Thu Oct 15 14:51:26 2020" #> .. #> Minimisation finished -#> [1] "Thu Oct 15 11:57:07 2020"
#> Nonlinear mixed-effects model fit by the SAEM algorithm +#> [1] "Thu Oct 15 14:53:18 2020"
#> Nonlinear mixed-effects model fit by the SAEM algorithm #> ----------------------------------- #> ---- Data ---- #> ----------------------------------- @@ -338,8 +338,8 @@ variances of the deviations of the parameters from these mean values.

#> res <- unlist(res_list) #> return(res) #> } -#> <bytecode: 0x55555c1e7720> -#> <environment: 0x55555c1eff38> +#> <bytecode: 0x555555c89340> +#> <environment: 0x555555c82680> #> Nb of parameters: 4 #> parameter names: parent_0 log_k_parent log_k_A1 f_parent_ilr_1 #> distribution: @@ -423,7 +423,7 @@ variances of the deviations of the parameters from these mean values.

#> Plotting convergence plots
# } # Synthetic data with two-component error sampling_times = c(0, 1, 3, 7, 14, 28, 60, 90, 120) -dt50_sfo_in <- c(800, 900, 1000, 1111.11, 1250) +dt50_sfo_in <- c(80, 90, 100, 111.111, 125) k_in <- log(2) / dt50_sfo_in SFO <- mkinmod(parent = mkinsub("SFO")) @@ -439,7 +439,9 @@ variances of the deviations of the parameters from these mean values.

add_err(ds, sdfunc = function(value) sqrt(1^2 + value^2 * 0.07^2), n = 1)[[1]] }) +# \dontrun{ f_mmkin_syn <- mmkin("SFO", ds_sfo_syn, error_model = "tc", quiet = TRUE) +# plot(f_mmkin_syn) m_saemix_tc <- saemix_model(f_mmkin_syn, cores = 1)
#> #> @@ -481,8 +483,8 @@ variances of the deviations of the parameters from these mean values.

#> res <- unlist(res_list) #> return(res) #> } -#> <bytecode: 0x55555c1e7720> -#> <environment: 0x55555be5b848> +#> <bytecode: 0x555555c89340> +#> <environment: 0x55555df58cf8> #> Nb of parameters: 2 #> parameter names: parent_0 log_k_parent #> distribution: @@ -493,11 +495,11 @@ variances of the deviations of the parameters from these mean values.

#> parent_0 log_k_parent #> parent_0 1 0 #> log_k_parent 0 1 -#> Error model: combined , initial values: a.1=2.4206146215511 b.1=0.03831266409084 +#> Error model: combined , initial values: a.1=1.05209877924905 b.1=0.0586479225303944 #> No covariate in the model. #> Initial values #> parent_0 log_k_parent -#> Pop.CondInit 100.2498 -9.33922
d_saemix_tc <- saemix_data(f_mmkin_syn) +#> Pop.CondInit 100.315 -4.962075
d_saemix_tc <- saemix_data(f_mmkin_syn)
#> #> #> The following SaemixData object was successfully created: @@ -508,16 +510,10 @@ variances of the deviations of the parameters from these mean values.

#> Structured data: value ~ time + name | ds #> X variable for graphs: time ()
f_saemix_tc <- saemix(m_saemix_tc, d_saemix_tc, saemix_options)
#> Running main SAEM algorithm -#> [1] "Thu Oct 15 11:57:25 2020" +#> [1] "Thu Oct 15 14:53:35 2020" #> .. #> Minimisation finished -#> [1] "Thu Oct 15 11:58:16 2020" -#> Error in solve.default(Fth) : -#> Lapack routine dgesv: system is exactly singular: U[2,2] = 0 -#> Error computing the Fisher Information Matrix: singular system. -#> Error in solve.default(FO) : -#> Lapack routine dgesv: system is exactly singular: U[2,2] = 0 -#> Error computing the Fisher Information Matrix: singular system.
#> Nonlinear mixed-effects model fit by the SAEM algorithm +#> [1] "Thu Oct 15 14:54:25 2020"
#> Nonlinear mixed-effects model fit by the SAEM algorithm #> ----------------------------------- #> ---- Data ---- #> ----------------------------------- @@ -534,14 +530,14 @@ variances of the deviations of the parameters from these mean values.

#> ds time name value mdv cens occ ytype #> 1 1 0 parent 105.9 0 0 1 1 #> 2 1 0 parent 98.0 0 0 1 1 -#> 3 1 1 parent 97.4 0 0 1 1 -#> 4 1 1 parent 100.5 0 0 1 1 -#> 5 1 3 parent 115.6 0 0 1 1 -#> 6 1 3 parent 105.6 0 0 1 1 -#> 7 1 7 parent 108.6 0 0 1 1 -#> 8 1 7 parent 117.0 0 0 1 1 -#> 9 1 14 parent 107.0 0 0 1 1 -#> 10 1 14 parent 95.8 0 0 1 1 +#> 3 1 1 parent 96.6 0 0 1 1 +#> 4 1 1 parent 99.8 0 0 1 1 +#> 5 1 3 parent 113.0 0 0 1 1 +#> 6 1 3 parent 103.2 0 0 1 1 +#> 7 1 7 parent 102.9 0 0 1 1 +#> 8 1 7 parent 110.8 0 0 1 1 +#> 9 1 14 parent 95.9 0 0 1 1 +#> 10 1 14 parent 85.9 0 0 1 1 #> ----------------------------------- #> ---- Model ---- #> ----------------------------------- @@ -581,8 +577,8 @@ variances of the deviations of the parameters from these mean values.

#> res <- unlist(res_list) #> return(res) #> } -#> <bytecode: 0x55555c1e7720> -#> <environment: 0x55555be5b848> +#> <bytecode: 0x555555c89340> +#> <environment: 0x55555df58cf8> #> Nb of parameters: 2 #> parameter names: parent_0 log_k_parent #> distribution: @@ -593,11 +589,11 @@ variances of the deviations of the parameters from these mean values.

#> parent_0 log_k_parent #> parent_0 1 0 #> log_k_parent 0 1 -#> Error model: combined , initial values: a.1=2.4206146215511 b.1=0.03831266409084 +#> Error model: combined , initial values: a.1=1.05209877924905 b.1=0.0586479225303944 #> No covariate in the model. #> Initial values #> parent_0 log_k_parent -#> Pop.CondInit 100.2498 -9.33922 +#> Pop.CondInit 100.315 -4.962075 #> ----------------------------------- #> ---- Key algorithm options ---- #> ----------------------------------- @@ -619,17 +615,17 @@ variances of the deviations of the parameters from these mean values.

#> ---------------------------------------------------- #> ----------------- Fixed effects ------------------ #> ---------------------------------------------------- -#> Parameter Estimate SE CV(%) -#> parent_0 97.44 <NA> <NA> -#> log_k_parent -56.97 <NA> <NA> -#> a a.1 -7.12 <NA> <NA> -#> b b.1 0.15 <NA> <NA> +#> Parameter Estimate SE CV(%) +#> parent_0 100.232 1.266 1.3 +#> log_k_parent -4.961 0.089 1.8 +#> a a.1 -0.106 1.211 1142.0 +#> b b.1 0.071 0.017 24.2 #> ---------------------------------------------------- #> ----------- Variance of random effects ----------- #> ---------------------------------------------------- -#> Parameter Estimate SE CV(%) -#> parent_0 omega2.parent_0 2.8 NA NA -#> log_k_parent omega2.log_k_parent 750.3 NA NA +#> Parameter Estimate SE CV(%) +#> parent_0 omega2.parent_0 3.334 5.024 151 +#> log_k_parent omega2.log_k_parent 0.036 0.024 68 #> ---------------------------------------------------- #> ------ Correlation matrix of random effects ------ #> ---------------------------------------------------- @@ -640,16 +636,16 @@ variances of the deviations of the parameters from these mean values.

#> --------------- Statistical criteria ------------- #> ---------------------------------------------------- #> Likelihood computed by linearisation -#> -2LL= 623.7744 -#> AIC = 635.7744 -#> BIC = 633.431 +#> -2LL= 575.5586 +#> AIC = 587.5586 +#> BIC = 585.2153 #> #> Likelihood computed by importance sampling -#> -2LL= 621.1909 -#> AIC = 633.1909 -#> BIC = 630.8475 +#> -2LL= 575.7797 +#> AIC = 587.7797 +#> BIC = 585.4364 #> ----------------------------------------------------
plot(f_saemix_tc, plot.type = "convergence") -
#> Plotting convergence plots
+
#> Plotting convergence plots
# }