pub enum QuantileMethod {
Show 13 variants
Linear,
Lower,
Higher,
Nearest,
Midpoint,
InvertedCdf,
AveragedInvertedCdf,
ClosestObservation,
InterpolatedInvertedCdf,
Hazen,
Weibull,
MedianUnbiased,
NormalUnbiased,
}Expand description
Interpolation method for quantile_with_method and its percentile
/ median friends.
Matches all 13 NumPy quantile methods (#462, #566). The continuous
methods use the Hyndman-Fan 1996 (alpha, beta) parameterization:
virtual_index = n*q + alpha + q*(1 - alpha - beta) - 1 with
linear interpolation between the two bracketing sorted elements.
The discrete methods compute an integer index via method-specific
rules and return the exact sorted element (no interpolation).
Variants§
Linear
NumPy default. Continuous with alpha = beta = 1. Returns
lo_val * (1 - frac) + hi_val * frac.
Lower
Pick the element at floor(q * (n - 1)) — the lower of the two
bracketing sorted elements.
Higher
Pick the element at ceil(q * (n - 1)) — the upper of the two
bracketing sorted elements.
Nearest
Pick the sorted element nearest to q * (n - 1), with ties
(frac = 0.5) broken to the even index (matches NumPy’s
round-half-to-even convention).
Midpoint
Average of the two bracketing sorted elements: (lo + hi) / 2.
InvertedCdf
Discrete method, Hyndman definition 1. Returns
sorted[ceil(n * q) - 1] — a step function with jumps at
k / n. NumPy’s 'inverted_cdf'.
AveragedInvertedCdf
Discrete method, Hyndman definition 2. Same as InvertedCdf
except that when n * q is an integer the result is the
average of the two bracketing sorted elements. NumPy’s
'averaged_inverted_cdf'.
ClosestObservation
Discrete method, Hyndman definition 3. sorted[k] where
k = round_half_to_even(n*q - 0.5). NumPy’s
'closest_observation'.
InterpolatedInvertedCdf
Continuous method, Hyndman definition 4. alpha = 0, beta = 1.
NumPy’s 'interpolated_inverted_cdf'.
Hazen
Continuous method, Hyndman definition 5. alpha = beta = 0.5.
NumPy’s 'hazen'.
Weibull
Continuous method, Hyndman definition 6. alpha = beta = 0.
NumPy’s 'weibull'.
MedianUnbiased
Continuous method, Hyndman definition 8. alpha = beta = 1/3.
NumPy’s 'median_unbiased'.
NormalUnbiased
Continuous method, Hyndman definition 9. alpha = beta = 3/8.
NumPy’s 'normal_unbiased'.
Trait Implementations§
Source§impl Clone for QuantileMethod
impl Clone for QuantileMethod
Source§fn clone(&self) -> QuantileMethod
fn clone(&self) -> QuantileMethod
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for QuantileMethod
impl Debug for QuantileMethod
Source§impl PartialEq for QuantileMethod
impl PartialEq for QuantileMethod
impl Copy for QuantileMethod
impl Eq for QuantileMethod
impl StructuralPartialEq for QuantileMethod
Auto Trait Implementations§
impl Freeze for QuantileMethod
impl RefUnwindSafe for QuantileMethod
impl Send for QuantileMethod
impl Sync for QuantileMethod
impl Unpin for QuantileMethod
impl UnsafeUnpin for QuantileMethod
impl UnwindSafe for QuantileMethod
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more