Skip to contents

A comprehensive pipeline that handles missing data, optionally applies rank normalization, and computes the correlation matrix for psychological scale data. Designed to prepare data for hypergraph analysis.

Usage

data_preprocess_pipeline(
  data,
  cor_method = c("pearson", "polychoric"),
  handle_na = c("impute", "omit"),
  impute_fun = stats::median,
  transform = c("auto", "rank", "none")
)

Arguments

data

Raw data frame or matrix of psychometric data. Numeric columns are retained.

cor_method

Correlation method: pearson, polychoric

handle_na

"impute" or "omit"

impute_fun

Imputation function

transform

Data transformation: "auto", "rank", or "none". "auto" applies rank normalization for Pearson correlation and no transformation for polychoric correlation. Polychoric correlation requires "auto" or "none".

Value

List with preprocessed data in normalized_data, the correlation matrix, correlation method, actual transformation, and effective sample size. With transform = "none", missing values are handled but data are not rank-normalized.