% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/methylationGLM_steps.R
\name{fitMethylationGLMModels}
\alias{fitMethylationGLMModels}
\title{Fit CpG-wise Gaussian GLMs for one-timepoint methylation analyses}
\usage{
fitMethylationGLMModels(
  preparedData,
  nCores = 1L,
  libPath = NULL,
  glmLibs = "glm2",
  verbose = FALSE,
  logs = FALSE,
  log_dir = NULL,
  log_file = "log_methylationGLM.txt"
)
}
\arguments{
\item{preparedData}{Object returned by \code{prepareMethylationGLMData()}.}

\item{nCores}{Integer. Maximum number of worker processes to use. Automatic
fitting remains serial below the empirical glm2 crossover and caps workers
by available CpGs and detected physical cores.}

\item{libPath}{Character vector or \code{NULL}. Optional library paths forwarded
to worker processes.}

\item{glmLibs}{Character vector or comma-separated string of package names to
check on worker processes. The default is \code{'glm2'}.}

\item{verbose}{Logical. If \code{TRUE}, emit progress messages with \code{message()}.}

\item{logs}{Logical. If \code{TRUE}, write the same messages to a log file.}

\item{log_dir}{Character or \code{NULL}. Directory used for the log file when
\code{logs = TRUE}.}

\item{log_file}{Character. File name used when \code{logs = TRUE}.}
}
\value{
A list with class \code{'dnaEPICO_methylationGLM_models'} containing
fitted model lists, model formulas, and counts of failed CpG fits.
}
\description{
Fit one Gaussian GLM per CpG for each phenotype requested in the object
returned by \code{prepareMethylationGLMData()}.
}
\examples{
ex <- dnaEPICO:::exampleMethylationGLMStateDnaEpico()
model_results <- fitMethylationGLMModels(
    preparedData = ex$preparedData,
    nCores = 1,
    verbose = FALSE,
    logs = FALSE
)
names(model_results$fits)

}
