smartcor: Intelligent Correlation Method Selection for Mixed Variable Types
This study addresses the common misuse of Pearson correlation for mixed variable types—such as binary, ordinal, and nominal—which often introduces bias in traditional correlation analyses. To resolve this, the authors introduce smartcor (for R) and pysmartcor (for Python), the first toolkits to systematically support all ten possible combinations of variable types. These packages employ automatic variable-type detection and a rule-based engine to intelligently select the optimal correlation or association method from a repertoire of fourteen, while also providing interpretable justifications for each choice. Monte Carlo simulations demonstrate substantially improved selection accuracy, and real-world case studies reveal meaningful discrepancies between type-aware analyses and naive Pearson correlations, thereby enhancing the reliability of statistical inference.