R/methylationLME_steps.R
fitMethylationLMEModels.RdFit one linear mixed-effects model per CpG for each phenotype requested in
the object returned by prepareMethylationLMEData(). Each native fit is
reduced to compact numerical results and discarded before the next batch is
returned.
fitMethylationLMEModels(
preparedData,
nCores = 1L,
libPath = NULL,
lmeLibs = "lme4,lmerTest",
correlationStructure = "none",
correlationVar = NULL,
omnibusTest = FALSE,
omnibusDdf = "Satterthwaite",
summaryDir = NULL,
resumeFromSummary = TRUE,
verbose = FALSE,
logs = FALSE,
log_dir = NULL,
log_file = "log_methylationLME.txt"
)Object returned by prepareMethylationLMEData().
Integer. Maximum number of worker processes to use. Automatic fitting uses the lme4 or nlme crossover and caps workers by available CpGs, CPUs, and detected memory.
Character vector or NULL. Optional library paths forwarded
to worker processes.
Character vector or comma-separated string of package names to
check on worker processes. The default is 'lme4,lmerTest'.
Character. Residual correlation structure used
when lmeLibs selects 'nlme'. One of 'none', 'AR1', or 'CAR1'.
Character or NULL. Variable used to order repeated
observations within personVar for AR1 or CAR1 residual correlation
structures. Must be supplied explicitly for AR1 or CAR1.
Logical. If TRUE, calculate one joint fixed-effect test
per CpG for the phenotype-by-interaction term, or the phenotype main effect
when no interaction is requested.
Character. Denominator degrees-of-freedom method used by
lmerTest::contestMD(): 'Satterthwaite' or 'Kenward-Roger'.
Character or NULL. Directory used for one complete
compact summary per phenotype. NULL disables disk persistence.
Logical. If TRUE, reuse a complete summary in
summaryDir when it was generated from the same input file and model
configuration.
Logical. If TRUE, emit progress messages with message().
Logical. If TRUE, write the same messages to a log file.
Character or NULL. Directory used for the log file when
logs = TRUE.
Character. File name used when logs = TRUE.
A list with class 'dnaEPICO_methylationLME_models'
containing compact coefficient matrices, unfiltered target summaries,
formulas, model conditions, omnibus results, hard errors, and phenotype
summary artifacts.
ex <- dnaEPICO:::exampleMethylationLMEStateDnaEpico()
model_results <- fitMethylationLMEModels(
preparedData = ex$preparedData,
nCores = 1,
verbose = FALSE,
logs = FALSE
)
names(model_results$fits)
#> [1] "score"