cross_sectional_ic

czsc.utils.cross_sectional_ic(df, x_col='open', y_col='n1b', method='spearman', **kwargs)[source]

分析 df 中 x_col 和 y_col 列的截面相关性(IC)

:param df:数据,DateFrame格式 :param x_col:X列 :param y_col:Y列,一般采用下期收益,也就是 n1b :param method:{‘pearson’, ‘kendall’, ‘spearman’} or callable

  • pearson : standard correlation coefficient

  • kendall : Kendall Tau correlation coefficient

  • spearman : Spearman rank correlation

  • callable: callable with input two 1d ndarrays and returning a float

Return:df,res:

前者是每日相关系数结果,后者是每日相关系数的统计结果