uvex_transients.utils.stat_utils.tolerance_limit#

uvex_transients.utils.stat_utils.tolerance_limit(values: ArrayLike, confidence: float, tolerance: float) → tuple[float, int, int][source]#

Compute a distribution-free upper tolerance limit from a sample.

With probability confidence, at most a fraction tolerance of the population lies above the limit.

Parameters:
  • values (array-like) – The sample. An infinite value is one that lies beyond any finite limit (a censored measurement).

  • confidence (float) – Required confidence, in (0, 1).

  • tolerance (float) – Largest allowed fraction of the population beyond the limit, in (0, 1).

Returns:

  • limit (float) – The sample value at rank tolerance_rank. It is infinite if that value is, which means the limit lies beyond what the sample measured.

  • rank (int) – The rank used, counted from the largest value.

  • n_infinite (int) – Number of infinite values in the sample.

Raises:

ValueError – If the sample is smaller than tolerance_min_samples.