Skip to content
Snippets Groups Projects
fitModelParallel.Rd 1.33 KiB
Newer Older
Arnaud Duvermy's avatar
Arnaud Duvermy committed
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fitmodel.R
\name{fitModelParallel}
\alias{fitModelParallel}
\title{Fit models in parallel for each group using mclapply and handle logging.
Uses parallel_fit to fit the models.}
\usage{
fitModelParallel(
  formula,
  data,
  group_by,
  n.cores = NULL,
  log_file = paste(tempdir(check = FALSE), "htrfit.log", sep = "/"),
Arnaud Duvermy's avatar
Arnaud Duvermy committed
  ...
)
}
\arguments{
\item{formula}{Formula specifying the model formula}

\item{data}{Data frame containing the data}

\item{group_by}{Column name in data representing the grouping variable}

\item{n.cores}{The number of CPU cores to use for parallel processing.
If set to NULL (default), the number of available CPU cores will be automatically detected.}

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

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

\item{...}{Additional arguments to be passed to the glmmTMB::glmmTMB function}
}
\value{
List of fitted model objects or NULL for any errors
}
\description{
Fit models in parallel for each group using mclapply and handle logging.
Uses parallel_fit to fit the models.
}
\examples{
fitModelParallel(formula = Sepal.Length ~ Sepal.Width + Petal.Length, 
                 data = iris, group_by = "Species", n.cores = 1) 
}