qis.compute_ewm_corr_df

qis.compute_ewm_corr_df(df, corr_matrix_output=CorrMatrixOutput.FULL, span=None, ewm_lambda=0.94, init_value=None, init_type=InitType.ZERO)[source]

uncentred EWM correlation of every requested pair of columns, one column per pair.

Runs S_t = lambda S_{t-1} + (1 - lambda) x_t x_t' on the rows of df without removing a mean, from the seed init_value, and normalises each matrix to a correlation. With the default zero seed the first row is the sign of x_i x_j, so the path needs a warm-up. For float32/float64 data, scalar smoothing and no explicit seed, TOP_ROW stores only the requested row’s history, while retaining the full current covariance for normalization. Eligible FULL/SUB_TOP calls likewise retain only the returned lower-triangle history.

Parameters:
  • df (DataFrame) – returns, rows are dates and columns are assets

  • corr_matrix_output (CorrMatrixOutput) – which pairs are returned: FULL gives (i, j) with j < i, named "<column i> - <column j>"; see CorrMatrixOutput

  • span (int | ndarray) – if given, overrides ewm_lambda via lambda = 1 - 2 / (span + 1)

  • ewm_lambda (float) – EWM decay, used when span is None

  • init_value (ndarray) – seed matrix, shape (n, n). None uses init_type

  • init_type (InitType) – seed when init_value is None; InitType.ZERO and InitType.X0 both give a zero matrix

Returns:

the correlation paths, indexed like df

Return type:

DataFrame