% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/inflammatory_age.R
\name{iAge}
\alias{iAge}
\title{Compute a simplified Inflammatory Age Index (iAge) with QA and verbose summaries}
\usage{
iAge(
  data,
  col_map = NULL,
  weights = c(CRP = 0.33, IL6 = 0.33, TNFa = 0.34),
  verbose = TRUE,
  na_action = c("keep", "omit", "error", "ignore", "warn"),
  na_warn_prop = 0.2
)
}
\arguments{
\item{data}{A data.frame or tibble containing the biomarker columns mapped by \code{col_map}.}

\item{col_map}{Named list mapping:
\itemize{
\item CRP  -> column name for C-reactive protein (mg/L)
\item IL6  -> column name for interleukin-6 (pg/mL)
\item TNFa -> column name for tumor necrosis factor-alpha (pg/mL)
}}

\item{weights}{Named numeric vector of weights for each marker (must sum to 1).
Defaults to c(CRP = 0.33, IL6 = 0.33, TNFa = 0.34).}

\item{verbose}{Logical; if TRUE, prints column mapping and computing messages.}

\item{na_action}{One of c("keep","omit","error","ignore","warn") controlling how missing inputs affect iAge:
\itemize{
\item "keep": return NA for rows where any required marker is NA (default; consistent with other functions).
\item "omit": ignore NAs in the weighted sum (treat missing markers as 0).
\item "error": abort if any required marker contains NA.
\item "ignore": alias of "omit".
\item "warn": alias of "omit" but emits missingness warnings (per na_warn_prop).
}}

\item{na_warn_prop}{Proportion in \eqn{[0,1]} above which a high-missingness warning
is emitted when \code{na_action = "warn"}. Default 0.2.}
}
\value{
A tibble with one column:
\itemize{
\item iAge (numeric): the computed inflammatory age index.
}
}
\description{
Implements a linear proxy for immunosenescence based on key inflammatory biomarkers,
conceptually inspired by the inflammatory aging clock (iAge) literature.
This simplified iAge is computed as a weighted sum of C-reactive protein (CRP),
interleukin-6 (IL6), and tumor necrosis factor-alpha (TNFa).
}
\details{
By default, rows with any missing required marker return NA in the index
(consistent with the default behavior of other package functions).
Optional diagnostics can warn on high missingness and implausible negative values.
Verbose mode prints step-by-step progress and a final summary.

Assumed units (no automatic unit conversion):
\itemize{
\item CRP: mg/L
\item IL6: pg/mL
\item TNFa: pg/mL
}

Note:
\itemize{
\item The original iAge model in Sayed et al. (Nature Aging, 2021) is a multi-marker
machine learning model. This function provides a simple, linear proxy using
three canonical inflammatory biomarkers. It is not identical to the original
published iAge but is inspired by its rationale.
\item This proxy is intended for exploratory feature engineering and cohort-level
analyses. It must not be treated as a validated replacement for the published
iAge model or used as a standalone clinical decision metric.
}
}
\examples{
library(tibble)
df <- tibble(
  CRP  = c(1.2, 3.5, NA),  # mg/L
  IL6  = c(2.0, 4.1, 1.5), # pg/mL
  TNFa = c(1.0, 1.8, 0.9)  # pg/mL
)
# Default behavior (rows with any missing marker return NA)
iAge(
  df,
  col_map = list(CRP = "CRP", IL6 = "IL6", TNFa = "TNFa")
)

# Keep NA if any marker missing in a row
iAge(
  df,
  col_map = list(CRP = "CRP", IL6 = "IL6", TNFa = "TNFa"),
  na_action = "keep"
)

# Verbose output
iAge(
  df,
  col_map = list(CRP = "CRP", IL6 = "IL6", TNFa = "TNFa"),
  verbose = TRUE
)

}
\references{
\insertRef{sayed2021iage}{HealthMarkers} (conceptual background; not method-identical to this implementation)
\insertRef{harris1999il6crp}{HealthMarkers}
\insertRef{bruunsgaard2003death}{HealthMarkers}
}
\seealso{
\code{\link[=impute_missing]{impute_missing()}}, \code{\link[=glycemic_markers]{glycemic_markers()}}
}
