calculate_mixed_correlation_matrix#

obsidian.experiment.advanced_design.calculate_mixed_correlation_matrix(df, categorical_vars=None)[source]#

Compute a pairwise correlation matrix that handles mixed variable types:

  • numeric ↔ numeric: Pearson r

  • categorical ↔ categorical: Cramér’s V

  • categorical ↔ numeric: sqrt(eta-squared)

Parameters:
  • df – Input DataFrame.

  • categorical_vars – List of column names to treat as categorical. If None, columns with object or category dtype are used.

Returns:

Square symmetric correlation matrix with 1.0 on the diagonal.

Return type:

pd.DataFrame