Huber function

"Huber density" distribution

"Huber density" distribution

Density, distribution function, quantile function and random generation for the "Huber density" distribution.

dhuber(x, mu = 0, sigma = 1, epsilon = 1.345, log = FALSE) phuber(q, mu = 0, sigma = 1, epsilon = 1.345, lower.tail = TRUE, log.p = FALSE) qhuber(p, mu = 0, sigma = 1, epsilon = 1.345, lower.tail = TRUE, log.p = FALSE) rhuber(n, mu = 0, sigma = 1, epsilon = 1.345)

Arguments

  • x, q: vector of quantiles.

  • mu, sigma, epsilon: location, and scale, and shape parameters. Scale and shape must be positive.

  • log, log.p: logical; if TRUE, probabilities p are given as log(p).

  • lower.tail: logical; if TRUE (default), probabilities are P[Xx]P[X \le x]

    otherwise, P[X>x]P[X > x].

  • p: vector of probabilities.

  • n: number of observations. If length(n) > 1, the length is taken to be the number required.

Details

Huber density is connected to Huber loss and can be defined as:

f(x)=122π(Φ(k)+ϕ(k)/k12)eρk(x)f(x)=1/(2sqrt(2π)(Φ(k)+ϕ(k)/k1/2))exp(ρ(x,k)) f(x) = \frac{1}{2 \sqrt{2\pi} \left( \Phi(k) + \phi(k)/k - \frac{1}{2} \right)} e^{-\rho_k(x)}f(x) = 1/(2 * sqrt(2\pi) * (\Phi(k) + \phi(k)/k - 1/2)) * exp(-\rho(x, k))

where

ρk(x)={12x2xkkx12k2x>kρ(x,k)=[ifabs(x)<=k:](x2)/2[else:]kabs(x)(k2)/2 \rho_k(x) =\left\{\begin{array}{ll}\frac{1}{2} x^2 & |x|\le k \\k|x|- \frac{1}{2} k^2 & |x|>k\end{array}\right.\rho(x, k) = [if abs(x) <= k:] (x^2)/2 [else:] k*abs(x) - (k^2)/2

Examples

x <- rhuber(1e5, 5, 2, 3) hist(x, 100, freq = FALSE) curve(dhuber(x, 5, 2, 3), -20, 20, col = "red", add = TRUE, n = 5000) hist(phuber(x, 5, 2, 3)) plot(ecdf(x)) curve(phuber(x, 5, 2, 3), -20, 20, col = "red", lwd = 2, add = TRUE)

References

Huber, P.J. (1964). Robust Estimation of a Location Parameter. Annals of Statistics, 53(1), 73-101.

Huber, P.J. (1981). Robust Statistics. Wiley.

Schumann, D. (2009). Robust Variable Selection. ProQuest.

  • Maintainer: Tymoteusz Wolodzko
  • License: GPL-2
  • Last published: 2023-11-30