From 675a733fa2acc08daabb9b8b571c7d658f281f73 Mon Sep 17 00:00:00 2001
From: Johannes Ranke ‘parms’: Add a method for mmkin objects ‘saemix_model’, ‘saemix_data’: Helper functions to fit nonlinear mixed-effects models for mmkin row objects using the saemix package ‘mmkin’ and ‘confint(method = ’profile’): Use all cores detected by parallel::detectCores() per default ‘confint(method = ’profile’): Choose accuracy based on ‘rel_tol’ argument, relative to the bounds obtained by the quadratic approximation
The number of cores to be used for multicore processing. On Windows machines, cores > 1 is currently not supported.
If the method is 'profile', what should be the accuracy +of the lower and upper bounds, relative to the estimate obtained from +the quadratic method?
mmkin( models = c("SFO", "FOMC", "DFOP"), datasets, - cores = round(detectCores()/2), + cores = detectCores(), cluster = NULL, ... )@@ -176,7 +179,8 @@ data for
mkinfit
.
The number of cores to be used for multicore processing. This
is only used when the cluster
argument is NULL
. On Windows
machines, cores > 1 is not supported, you need to use the cluster
-argument to use multiple logical processors.
parallel::detectCores()
are used.
nlme.m
If random is FALSE (default), a named vector containing mean values
of the fitted degradation model parameters. If random is TRUE, a list with
fixed and random effects, in the format required by the start argument of
-nlme for the case of a single grouping variable ds?
+nlme for the case of a single grouping variable ds.
A groupedData
object
See also
diff --git a/docs/reference/parms.html b/docs/reference/parms.html
index 432bbc88..2fe91c26 100644
--- a/docs/reference/parms.html
+++ b/docs/reference/parms.html
@@ -195,7 +195,8 @@ such matrices is returned.
ds <- lapply(experimental_data_for_UBA_2019[6:10],
function(x) subset(x$data[c("name", "time", "value")]))
names(ds) <- paste("Dataset", 6:10)
-fits <- mmkin(c("SFO", "FOMC", "DFOP"), ds, quiet = TRUE)
+# \dontrun{
+fits <- mmkin(c("SFO", "FOMC", "DFOP"), ds, quiet = TRUE, cores = 1)
parms(fits["SFO", ])#> Dataset 6 Dataset 7 Dataset 8 Dataset 9 Dataset 10
#> parent_0 88.52275400 82.666781678 86.8547308 91.7779306 82.14809450
#> k_parent_sink 0.05794659 0.009647805 0.2102974 0.1232258 0.00720421
@@ -259,7 +260,8 @@ such matrices is returned.
#> log_k2 -3.5206791 -5.85402317 -2.5794240 -3.4233253 -5.676532
#> g_ilr -0.1463234 0.07627854 0.4719196 0.4477805 -0.460676
#> sigma 1.3569047 2.22130220 1.3416908 2.8715985 1.942068
-#>
+#> # }
+
- saemix_model(object)
+ saemix_model(object, cores = parallel::detectCores())
saemix_data(object, ...)
@@ -164,6 +164,11 @@ a list of datasets.
object
An mmkin row object containing several fits of the same model to different datasets
The number of cores to be used for multicore processing. +On Windows machines, cores > 1 is currently not supported.
Further parameters passed to saemix::saemixData
An saemix::SaemixModel object.
An saemix::SaemixData object.
+Starting values for the fixed effects (population mean parameters, argument psi0 of
+saemix::saemixModel()
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.
+#> -2LL= 1063.462 +#> AIC = 1081.462 +#> BIC = 1077.947 +#> ----------------------------------------------------ds <- lapply(experimental_data_for_UBA_2019[6:10], function(x) subset(x$data[c("name", "time", "value")])) names(ds) <- paste("Dataset", 6:10) sfo_sfo <- mkinmod(parent = mkinsub("SFO", "A1"), - A1 = mkinsub("SFO"))#>f_mmkin <- mmkin(list("SFO-SFO" = sfo_sfo), ds, quiet = TRUE, cores = 5) -# \dontrun{ -if (require(saemix)) { - m_saemix <- saemix_model(f_mmkin) - d_saemix <- saemix_data(f_mmkin) - saemix_options <- list(seed = 123456, save = FALSE, save.graphs = FALSE) - saemix(m_saemix, d_saemix, saemix_options) -}#>#>-#>#>#>+#>m_saemix <- saemix_model(f_mmkin)#> #> #> The following SaemixModel object was successfully created: #> @@ -224,12 +230,12 @@ a list of datasets. #> 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. #> 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.920449d_saemix <- saemix_data(f_mmkin)#> #> #> The following SaemixData object was successfully created: #> @@ -257,12 +262,14 @@ a list of datasets. #> 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" -#> .#> .#> .#> .#> +#> X variable for graphs: time ()saemix_options <- list(seed = 123456, + save = FALSE, save.graphs = FALSE, displayProgress = FALSE, + nbiter.saemix = c(200, 80)) +f_saemix <- saemix(m_saemix, d_saemix, saemix_options)#> Running main SAEM algorithm +#> [1] "Tue May 26 18:25:16 2020" +#> .. #> Minimisation finished -#> [1] "Mon May 25 12:56:39 2020"#> Nonlinear mixed-effects model fit by the SAEM algorithm +#> [1] "Tue May 26 18:31:09 2020"#> Nonlinear mixed-effects model fit by the SAEM algorithm #> ----------------------------------- #> ---- Data ---- #> ----------------------------------- @@ -322,12 +329,12 @@ a list of datasets. #> 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. #> 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. #> ----------------- 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. #> --------------- 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 -#> ----------------------------------------------------#> 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# } -