From 05df90d8328b804ad1efe92c81e9ace491b386ec Mon Sep 17 00:00:00 2001
From: Johannes Ranke Short demo of the multistart method
Johannes Ranke
- Last change 19 September 2022 (rebuilt 2022-09-19)
+ Last change 19 September 2022 (rebuilt 2022-09-28)
Source: vignettes/web_only/multistart.rmd
multistart.rmd
Confidence intervals for parameters in saem.mmkin objects
Perform a hierarchical model fit with multiple starting values
multistart(object, n = 50, cores = 1, ...)
+ multistart(
+ object,
+ n = 50,
+ cores = if (Sys.info()["sysname"] == "Windows") 1 else parallel::detectCores(),
+ cluster = NULL,
+ ...
+)
# S3 method for saem.mmkin
-multistart(object, n = 50, cores = 1, ...)
+multistart(object, n = 50, cores = 1, cluster = NULL, ...)
# S3 method for multistart
-print(x, ...)
-
-# S3 method for multistart
-parms(object, ...)
+print(x, ...)
How many fits should be run in parallel?
How many fits should be run in parallel (only on posix platforms)?
A cluster as returned by parallel::makeCluster to be used +for parallel execution.
Currently, parallel execution of the fits is only supported using -parallel::mclapply, i.e. not available on Windows.
-In case the online version of this help page contains error messages +
In case the online version of this help page contains error messages in the example code and no plots, this is due to the multistart method not working when called by pkgdown. Please refer to the online vignette @@ -186,10 +192,18 @@ doi: 10.1186/s12859-021-04373-4.
#> Error in UseMethod("parms", object): no applicable method for 'parms' applied to an object of class "try-error" f_saem_reduced <- update(f_saem_full, covariance.model = diag(c(1, 1, 0, 1))) -f_saem_reduced_multi <- multistart(f_saem_reduced, n = 16, cores = 16) -#> Warning: all scheduled cores encountered errors in user code +# On Windows, we need to create a cluster first. When working with +# such a cluster, we need to export the mmkin object to the cluster +# nodes, as it is referred to when updating the saem object on the nodes. +library(parallel) +cl <- makePSOCKcluster(12) +clusterExport(cl, "f_mmkin") +#> Error in get(name, envir = envir): object 'f_mmkin' not found +f_saem_reduced_multi <- multistart(f_saem_reduced, n = 16, cluster = cl) +#> Error in checkForRemoteErrors(val): 12 nodes produced errors; first error: object 'f_mmkin' not found parhist(f_saem_reduced_multi, lpos = "bottomright") -#> Error in UseMethod("parms", object): no applicable method for 'parms' applied to an object of class "try-error" +#> Error in parhist(f_saem_reduced_multi, lpos = "bottomright"): object 'f_saem_reduced_multi' not found +#> Warning: calling par(new=TRUE) with no plot # }Should the error model parameters be returned in addition to the degradation parameters?
For multistart objects, should rows for failed fits +be removed from the returned parameter matrix?