pub struct SScale<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: RhoFunction> SScale<R>
impl<R: RhoFunction> SScale<R>
Sourcepub fn new(rho: R, delta: f64) -> Result<Self, RobustError>
pub fn new(rho: R, delta: f64) -> Result<Self, 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<Self, RobustError>
pub fn fisher_consistent( rho: R, quad_points: usize, ) -> Result<Self, 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) -> Self
pub fn with_control(self, control: Control) -> Self
Override the default convergence control.