qis.regimes.compute_sample_regime_moments

qis.regimes.compute_sample_regime_moments(sampled_returns_with_regime_id, benchmark, regime_column='regime')[source]

Per-period empirical regime moments of the benchmark on a supplied classification.

The empirical counterpart of compute_gaussian_regime_moments. Unclassified periods are excluded; every classified benchmark return must be finite and every regime occupied. The means and second moments are equal-weighted population moments (ddof=0), not sample variances. The function neither classifies nor resamples, and it uses every period it is given: a rolling caller passes only the periods known at the decision date.

Parameters:
  • sampled_returns_with_regime_id (DataFrame) – periodic simple returns with a regime column of string labels

  • benchmark (str) – name of the benchmark column

  • regime_column (str) – name of the regime column

Returns:

regimes in rows, in bucket order, and the columns probability, the empirical frequency of the classified periods, mean and second_moment

Raises:

ValueError – if the columns, the labels, the classified benchmark returns or the regimes are invalid

Return type:

DataFrame