robust-rs-core 0.1.0

Core abstractions for robust statistics: loss functions, robust scale and influence-function theory.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
//! The influence function of an M-estimator of location.

use super::variance::expect_psi_prime;
use crate::rho::RhoFunction;

/// Return the influence function `x ↦ ψ(x) / E_Φ[ψ']` as a closure.
pub fn influence_function<'a>(
    rho: &'a dyn RhoFunction,
    quad_points: usize,
) -> impl Fn(f64) -> f64 + 'a {
    let c = expect_psi_prime(rho, quad_points);
    move |x: f64| rho.psi(x) / c
}