<a id="skfolio-metrics-exceedance-rate"></a>

# skfolio.metrics.exceedance_rate

<a id="skfolio.metrics.exceedance_rate"></a>

### skfolio.metrics.exceedance_rate(squared_distances, n_features, confidence_level)

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_distances** *array-like of shape (n_observations,)*
  : Squared Mahalanobis distances or similar chi-squared statistics.

  **n_features** *int*
  : Degrees of freedom (number of features/assets).

  **confidence_level** *float*
  : 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`](https://skfolio.org/generated/skfolio.metrics.mahalanobis_calibration_ratio.html.md#skfolio.metrics.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}$.

