Skip to main content

ScatterFit

Struct ScatterFit 

Source
pub struct ScatterFit {
    pub location: Array1<f64>,
    pub scatter: Array2<f64>,
    pub distances: Array1<f64>,
    pub weights: Array1<f64>,
}
Expand description

A fitted robust location–scatter estimate.

The shared result type of MScatter and Ogk. FAST-MCD carries extra structure (a raw estimate and the retained subset), so it returns its own McdFit, but that type implements RobustScatter too, so all three are interchangeable behind the trait and the Mahalanobis/outlier map is written once against (μ̂, Σ̂). Tyler does not use this type: it returns a bespoke TylerFit implementing no shared trait, because its shape-only distances are not χ²-calibrated, so this type’s Gaussian outlier map would misapply to them.

Fields§

§location: Array1<f64>

Robust location estimate μ̂ (a p-vector).

§scatter: Array2<f64>

Robust scatter (covariance) estimate Σ̂ (p × p, symmetric positive definite).

§distances: Array1<f64>

Robust Mahalanobis distances dᵢ of the rows the fit was computed on.

§weights: Array1<f64>

Final per-observation weights (their meaning is estimator-specific: a hard 0/1 acceptance for a reweighting estimator, a smooth w(dᵢ) for an M-estimator).

Trait Implementations§

Source§

impl Clone for ScatterFit

Source§

fn clone(&self) -> ScatterFit

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ScatterFit

Source§

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

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

impl RobustScatter for ScatterFit

Source§

fn location(&self) -> &Array1<f64>

Robust location estimate μ̂.
Source§

fn scatter(&self) -> &Array2<f64>

Robust scatter estimate Σ̂.
Source§

fn distances(&self) -> &Array1<f64>

Robust Mahalanobis distances of the fitted rows.
Source§

fn distance_cutoff(&self, quantile: f64) -> f64

The distance cutoff √χ²_{p, quantile} (e.g. quantile = 0.975) against which robust Mahalanobis distances are compared to flag outliers.
Source§

fn outliers(&self, quantile: f64) -> Vec<bool>

Flag each fitted observation as an outlier when its robust distance exceeds distance_cutoff(quantile). Under a p-variate Gaussian the squared distances are χ²_p, so quantile = 0.975 flags ≈ 2.5% of clean data.

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> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V