Detect variable types for dynamic correlation method selection
Source:R/14_correlations.R
detect_variable_types.RdClassifies each column as "binary", "ordinal", or "continuous". The
ordinal threshold defaults to <=21 unique values, which covers
(a) the VADER-shaped sentiment scale [-1, 1] quantized at 0.1
(21 distinct levels), (b) the Likert-style 5/7/9/11-point scales
common in survey research, and (c) AI-elicited intensity / confidence
scores on a small integer grid. The earlier threshold of 7
silently classified VADER sentiment as continuous on the
large run, which then dispatched to Pearson (point-biserial for
binary x quantized-sentiment pairs) – methodologically wrong for an
ordinal support. Spearman is correct when either variable is
rank-orderable but not interval-scaled .