skfolio.metrics.exceedance_rate#

skfolio.metrics.exceedance_rate(squared_distances, n_features, confidence_level)[source]#

Exceedance rate for chi-squared calibration statistics.

Computes the fraction of squared distances exceeding the upper confidence_level chi-squared quantile.

The reference threshold assumes Gaussian standardized returns. In practice, the rate is sensitive not only to covariance misspecification but also to heavy tails, regime shifts, and non-Gaussian standardized returns. It is best used as a comparative metric across estimators rather than as an absolute calibration test.

Parameters:
squared_distancesarray-like of shape (n_observations,)

Squared Mahalanobis distances or similar chi-squared statistics.

n_featuresint

Degrees of freedom (number of features/assets).

confidence_levelfloat

Coverage confidence level used to define the upper chi-squared threshold. For example, 0.95 corresponds to an expected exceedance rate of 0.05 under calibration.

Returns:
float

Observed exceedance rate. It should be close to \(1 - \text{confidence\_level}\) when the reference chi-squared approximation is appropriate.

See also

mahalanobis_calibration_ratio

Calibration ratio based on squared Mahalanobis distances.

Notes

Under correct calibration and Gaussian standardized returns, \(d^2 \sim \chi^2(n_{\text{features}})\), so \(P(d^2 > \chi^2_{\text{confidence\_level}}) = 1 - \text{confidence\_level}\).