% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/methylationLME_steps.R
\name{prepareMethylationLMEData}
\alias{prepareMethylationLMEData}
\title{Prepare longitudinal phenotype-plus-methylation data for mixed-effects
analyses}
\usage{
prepareMethylationLMEData(
  inputPheno,
  personVar = "person",
  timeVar = "Timepoint",
  phenotypes,
  covariates,
  factorVars,
  scaleVars = NULL,
  prsMap = NULL,
  cpgPrefix = "cg",
  cpgLimit = NA,
  methylationScale = "beta",
  interactionTerm = NULL,
  verbose = FALSE,
  logs = FALSE,
  log_dir = NULL,
  log_file = "log_methylationLME.txt"
)
}
\arguments{
\item{inputPheno}{Character. Path to the merged longitudinal phenotype-plus-
methylation object created by \code{preprocessingPheno()}.}

\item{personVar}{Character. Name of the subject identifier column.}

\item{timeVar}{Character. Name of the time variable.}

\item{phenotypes}{Character vector or comma-separated string of phenotype
variables to model.}

\item{covariates}{Character vector or comma-separated string of covariate
variables to adjust for.}

\item{factorVars}{Character vector or comma-separated string of variables
that
should be converted to factors before modeling.}

\item{scaleVars}{Character vector, comma-separated variable names, or \code{NULL}.
Numeric fixed-effect variables to standardize before model fitting.}

\item{prsMap}{Character vector or comma-separated string of phenotype-to-PRS
mappings in the form \code{'Phenotype:PRS'}.}

\item{cpgPrefix}{Character. Prefix used to identify methylation columns.}

\item{cpgLimit}{Integer or \code{NA}. Maximum number of CpGs to retain. \code{NA}
keeps all matching CpGs.}

\item{methylationScale}{Character. Methylation metric represented by the CpG
columns. One of \code{'Beta'}, \code{'M'}, or \code{'CN'}, case-insensitively.}

\item{interactionTerm}{Character or \code{NULL}. Optional interaction term.}

\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_methylationLME_data'} containing
the prepared analysis data, parsed variable selections, CpG columns,
timepoint summaries, and subject-ID diagnostics.
}
\description{
Load the merged longitudinal phenotype-plus-methylation object, ensure that
a subject
identifier column is available, validate the requested modeling variables,
convert selected variables to factors, and return a single in-memory object
for downstream mixed-effects modeling helpers.
}
\examples{
ex <- dnaEPICO:::exampleMethylationLMEStateDnaEpico()
prepared_data <- prepareMethylationLMEData(
    inputPheno = ex$inputPath,
    personVar = "person",
    timeVar = "Timepoint",
    phenotypes = "score",
    covariates = "sex",
    factorVars = "sex",
    cpgLimit = 2,
    verbose = FALSE,
    logs = FALSE
)
names(prepared_data)

}
