Skip to content
Snippets Groups Projects
parallel_fit.Rd 1.4 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
Arnaud Duvermy's avatar
Arnaud Duvermy committed
\name{parallel_fit}
\alias{parallel_fit}
Arnaud Duvermy's avatar
Arnaud Duvermy committed
\title{Fit models in parallel for each group using mclapply and handle logging.
Uses parallel_fit to fit the models.}
\usage{
parallel_fit(
  groups,
  group_by,
  formula,
  data,
  n.cores = NULL,
  log_file = paste(tempdir(check = FALSE), "htrfit.log", sep = "/"),
Arnaud Duvermy's avatar
Arnaud Duvermy committed
}
\arguments{
\item{groups}{Vector of unique group values}

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

\item{formula}{Formula specifying the model formula}

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

\item{n.cores}{The number of CPU cores to use for parallel processing.
If set to NULL (default), the number of available CPU (minus 1) cores will be automatically detected.}
Arnaud Duvermy's avatar
Arnaud Duvermy committed

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

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

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{
parallel_fit(group_by = "Species", groups =  iris$Species, 
Arnaud Duvermy's avatar
Arnaud Duvermy committed
               formula = Sepal.Length ~ Sepal.Width + Petal.Length, 
               data = iris, n.cores = 1 )
Arnaud Duvermy's avatar
Arnaud Duvermy committed
}