Skip to main content

QuantileMethod

Enum QuantileMethod 

Source
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

Source§

fn clone(&self) -> QuantileMethod

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for QuantileMethod

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for QuantileMethod

Source§

fn eq(&self, other: &QuantileMethod) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for QuantileMethod

Source§

impl Eq for QuantileMethod

Source§

impl StructuralPartialEq for QuantileMethod

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.