qis.compute_ewm_score

qis.compute_ewm_score(data, ewm_lambda=0.94, is_clip=True, clip_quantile=0.16)[source]

Contemporaneous EWM score (x_t - m_t) / max(sigma_t, c) of each column.

m_t is the X0-seeded EWM mean and sigma_t the EWM volatility about zero of compute_ewm_vol(); both include x_t, so the score is bounded by sqrt(λ/(1-λ)). c is the full-sample clip_quantile quantile of the column’s own sigma, a look-ahead floor.

Parameters:
  • data (ndarray) – observations, shape (t,) or (t, n)

  • ewm_lambda (float | ndarray) – EWM decay of the mean and the volatility

  • is_clip (bool) – floor the volatility of each column at its clip_quantile quantile

  • clip_quantile (float) – quantile level of that floor

Returns:

the EWM mean and the score, each shaped like data; the score is NaN where x_t is

Return type:

Tuple[ndarray, ndarray]