Skip to contents

This function is used internally by updateParallel to fit glmmTMB models in parallel.

Usage

parallel_update(
  formula,
  list_tmb,
  n.cores = NULL,
  log_file = paste(tempdir(check = FALSE), "htrfit.log", sep = "/"),
  cl_type = "PSOCK",
  ...
)

Arguments

formula

Formula for the GLMNB model.

list_tmb

List of glmmTMB objects.

n.cores

Number of cores to use for parallel processing.

log_file

File path for the log output (default : Rtmpdir/htrfit.log).

cl_type

cluster type (defautl "PSOCK"). "FORK" is recommanded for linux.

...

Additional arguments to be passed to the glmmTMB::glmmTMB function.

Value

A list of updated GLMNB models.

Examples

data(iris)
groups <- unique(iris$Species)
group_by <- "Species"
formula <- Sepal.Length ~ Sepal.Width + Petal.Length
fitted_models <- fitModelParallel(formula, iris, group_by, n.cores = 1)
#> Log file location: /tmp/RtmpS86cq0/htrfit.log
#> CPU(s) number : 1
#> Cluster type : PSOCK
new_formula <- Sepal.Length ~ Sepal.Width 
results <- parallel_update(new_formula, fitted_models, n.cores = 1)
#> CPU(s) number : 1
#> Cluster type : PSOCK