Skip to content
Snippets Groups Projects
updateParallel.Rd 1.25 KiB
Newer Older
Arnaud Duvermy's avatar
Arnaud Duvermy committed
% Generated by roxygen2: do not edit by hand
Arnaud Duvermy's avatar
Arnaud Duvermy committed
% Please edit documentation in R/update_fittedmodel.R
Arnaud Duvermy's avatar
Arnaud Duvermy committed
\name{updateParallel}
\alias{updateParallel}
Arnaud Duvermy's avatar
Arnaud Duvermy committed
\title{Update glmmTMB models in parallel.}
Arnaud Duvermy's avatar
Arnaud Duvermy committed
\usage{
updateParallel(
  formula,
  list_tmb,
  n.cores = NULL,
  log_file = paste(tempdir(check = FALSE), "htrfit.log", sep = "/"),
  ...
)
Arnaud Duvermy's avatar
Arnaud Duvermy committed
}
\arguments{
\item{formula}{Formula for the GLMNB model.}

Arnaud Duvermy's avatar
Arnaud Duvermy committed
\item{list_tmb}{List of glmmTMB objects.}
Arnaud Duvermy's avatar
Arnaud Duvermy committed

\item{n.cores}{Number of cores to use for parallel processing. If NULL, the function will use all available cores.}

\item{cl_type}{cluster type (defautl "PSOCK"). "FORK" is recommanded for linux.}

\item{log_file}{File path for the log output (default: Rtmpdir/htrfit.log).}
Arnaud Duvermy's avatar
Arnaud Duvermy committed

\item{...}{Additional arguments to be passed to the glmmTMB::glmmTMB function.}
}
\value{
A list of updated GLMNB models.
}
\description{
Arnaud Duvermy's avatar
Arnaud Duvermy committed
This function fits glmmTMB models in parallel using multiple cores, allowing for faster computation.
Arnaud Duvermy's avatar
Arnaud Duvermy committed
}
\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)
new_formula <- Sepal.Length ~ Sepal.Width 
results <- updateParallel(new_formula, fitted_models, n.cores = 1)
}