pub struct SScale<R>where
R: RhoFunction,{ /* private fields */ }Expand description
The M-estimate of scale (“S-scale”): the s > 0 solving
(1/n) Σ ρ(rᵢ/s) = δ.
With a bounded, redescending ρ and δ = ρ.rho_sup()/2 this is the
50%-breakdown scale that S- and MM-regression minimize; with δ = E_Φ[ρ] it
is Fisher-consistent for σ at the Gaussian (for the biweight the S-step
tuning c ≈ 1.547 makes the two coincide). Generic over the loss, but the
loss must have bounded ρ (rho_sup().is_some()): an unbounded ρ
gives zero breakdown (a single rᵢ → ∞ drives s without limit) so
new rejects it with RobustError::UnboundedLoss.
Solved by the standard fixed-point iteration
s ← s·√(mean_i ρ(rᵢ/s) / δ) from a MAD start; g(s) = (1/n)Σρ(rᵢ/s) is
monotone decreasing, so the root is unique.
Implementations§
Source§impl<R> SScale<R>where
R: RhoFunction,
impl<R> SScale<R>where
R: RhoFunction,
Sourcepub fn new(rho: R, delta: f64) -> Result<SScale<R>, RobustError>
pub fn new(rho: R, delta: f64) -> Result<SScale<R>, RobustError>
Create an S-scale for loss rho with consistency target 0 < delta < sup ρ.
Rejects an unbounded loss (rho_sup() == None) with
RobustError::UnboundedLoss, since it cannot define a high-breakdown
scale and a delta outside (0, sup ρ) (for which the scale equation
has no root) with RobustError::InvalidTuning.
Sourcepub fn fisher_consistent(
rho: R,
quad_points: usize,
) -> Result<SScale<R>, RobustError>
pub fn fisher_consistent( rho: R, quad_points: usize, ) -> Result<SScale<R>, RobustError>
Create a Fisher-consistent S-scale by setting δ = E_Φ[ρ], evaluated by
Gauss–Hermite quadrature with quad_points nodes.
Sourcepub fn with_control(self, control: Control) -> SScale<R>
pub fn with_control(self, control: Control) -> SScale<R>
Override the default convergence control.
Trait Implementations§
impl<R> Copy for SScale<R>where
R: Copy + RhoFunction,
Source§impl<R> ScaleEstimator for SScale<R>where
R: RhoFunction,
impl<R> ScaleEstimator for SScale<R>where
R: RhoFunction,
Auto Trait Implementations§
impl<R> Freeze for SScale<R>where
R: Freeze,
impl<R> RefUnwindSafe for SScale<R>where
R: RefUnwindSafe,
impl<R> Send for SScale<R>where
R: Send,
impl<R> Sync for SScale<R>where
R: Sync,
impl<R> Unpin for SScale<R>where
R: Unpin,
impl<R> UnsafeUnpin for SScale<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for SScale<R>where
R: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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