% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/adiposity_sds_strat.R
\name{adiposity_sds_strat}
\alias{adiposity_sds_strat}
\title{Compute sex-stratified standardized scores (SDS) for adiposity measures}
\usage{
adiposity_sds_strat(
  data,
  col_map,
  ref,
  na_action = c("keep", "omit", "error"),
  allow_partial = FALSE,
  prefix = "",
  verbose = TRUE
)
}
\arguments{
\item{data}{Data frame or tibble with variables and a sex column}

\item{col_map}{Named list mapping:
\itemize{
\item sex: column name with sex values ("M","F","m","f", 1, 2)
\item vars: optional named list mapping reference variable names -> data column names.
If omitted, expects the reference variable names to exist in \code{data}.
}}

\item{ref}{Named list with elements "M" and "F". Each is a named list of numeric
vectors c(mean=, sd=) keyed by variable name, e.g.:
list(
M = list(BMI = c(mean=23, sd=3.5), waist = c(mean=85, sd=10)),
F = list(BMI = c(mean=21, sd=3.0), waist = c(mean=75, sd=9))
)}

\item{na_action}{One of:
\itemize{
\item "keep"  - keep rows with NA (propagates to outputs)
\item "omit"  - drop rows with NA in any required variable
\item "error" - abort if any required variable has NA
}}

\item{allow_partial}{If TRUE, skip variables absent in data (with a warning); if FALSE error}

\item{prefix}{Optional prefix for output columns (default "")}

\item{verbose}{Logical; when TRUE emit progress via package logger; by default logging is controlled by options(healthmarkers.verbose)}
}
\value{
A tibble with one SDS column per retained variable: \code{varname_SDS}, where \code{varname} is the original variable name (optionally prefixed by \code{prefix}).
}
\description{
Computes sex-specific SDS (z-scores) for selected anthropometric variables using
reference means and SDs provided separately for males and females.
}
\examples{
ref <- list(
  M = list(BMI = c(mean=24.5, sd=3.8), waist = c(mean=88, sd=12)),
  F = list(BMI = c(mean=22.1, sd=4.2), waist = c(mean=76, sd=11))
)
df <- data.frame(BMI=c(25.2,21.8,27.1), waist=c(85,72,95), sex=c("M","F","M"))
adiposity_sds_strat(
  df,
  col_map = list(sex = "sex", vars = list(BMI = "BMI", waist = "waist")),
  ref = ref
)
}
\references{
\insertRef{who1995anthro}{HealthMarkers}
}
