R/ghuber_sf.R

Defines functions ghuber_sf

Documented in ghuber_sf

ghuber_sf <- function(x, y, p, a, b)
{
    f <- function(t, a, b)
    {
        cf <- capping_function(t = t, a = a, b = b)

        cf * (2 * t - cf)
    }

    err <- x - y

    p * f(t = pmin(err, 0), a = a, b = b) +
        (1 - p) * f(t = pmax(err, 0), a = a, b = b)
}

Try the scoringfunctions package in your browser

Any scripts or data that you put into this service are public.

scoringfunctions documentation built on Aug. 30, 2026, 5:07 p.m.