% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/psych_scores.R
\name{cognitive_score}
\alias{cognitive_score}
\title{Cognitive composite (z-mean or PCA1)}
\usage{
cognitive_score(
  data,
  col_map = list(),
  na_action = c("keep", "omit", "error"),
  missing_prop_max = 0.2,
  method = c("z_mean", "pca1"),
  prefix = "cog",
  verbose = TRUE
)
}
\arguments{
\item{data}{Data frame containing questionnaire item columns.}

\item{col_map}{Named list with \code{tasks} mapping task IDs to column names (>= 2 tasks required).}

\item{na_action}{How to handle rows with missing items: \code{keep}, \code{omit}, or \code{error}.}

\item{missing_prop_max}{Maximum allowed proportion of missing items per row before the score is set to \code{NA}.}

\item{method}{Aggregation method: \code{z_mean} (average of z-scores) or \code{pca1} (first PC).}

\item{prefix}{Prefix for output column names.}

\item{verbose}{Logical; if \code{TRUE}, emits informational messages about column resolution and scoring progress via \code{hm_inform()}.}
}
\value{
A tibble of score columns only: \verb{\{prefix\}_z_mean} or \verb{\{prefix\}_pca1}. Input columns are not included.
}
\description{
Cognitive composite (z-mean or PCA1)
}
\examples{
df <- data.frame(task_a = c(1, 2), task_b = c(2, 3), task_c = c(3, 4))
cm <- list(tasks = list(
  task_a = "task_a",
  task_b = "task_b",
  task_c = "task_c"
))
cognitive_score(df, col_map = cm, method = "z_mean")
}
