Learn R Programming

robustbase (version 0.9-8)

Mpsi: Psi / Chi / Wgt / Rho Functions for *M-Estimation

Description

Compute Psi / Chi / Wgt / Rho functions for M-estimation, i.e., including MM, etc. MrhoInf(x) computes $\rho(\infty)$, i.e., the normalizing or scaling constant for the transformation from $\rho(\cdot)$ to $\tilde\rho(\cdot)$, where the latter, aka as $\chi()$ fulfills $\tilde\rho(\infty) = 1$ which makes only sense for redescending psi functions, i.e., not for "huber".

Mwgt(x, *) computes $\psi(x)/x$ (fast and numerically accurately).

Usage

Mpsi(x, cc, psi, deriv = 0)
Mchi(x, cc, psi, deriv = 0)
Mwgt(x, cc, psi)
MrhoInf(cc, psi)

Arguments

x
numeric (abscissa values) vector.
cc
numeric tuning constant, for some psi of length $> 1$.
psi
a string specifying the psi / chi / rho / wgt function; either "huber", or one of the same possible specifiers as for psi in lmrob.control, i.e. currently,
deriv
an integer, specifying the order of derivative to consider; particularly, Mpsi(x, *, deriv = -1) is the principal function of $\psi()$, typically denoted $\rho()$ in the literature.

Value

  • a numeric vector of the same length as x, with corresponding function (or derivative) values.

Details

Theoretically, Mchi() would not be needed explicitly as it can be computed from Mpsi() and MrhoInf(), namely, by Mchi(x, *, deriv = d) == Mpsi(x, *, deriv = d-1) / MrhoInf(*) for $d = 0, 1, 2$ (and * containing par, psi, and equality is in the sense of all.equal(x,y, tol) with a small tol.

Similarly, Mwgt would not be needed strictly, as it could be defined via Mpsi), but the explicit definition takes care of 0/0 and typically is of a more simple form.

For experts, there are slightly even faster versions, .Mpsi(), .Mwgt(), etc.

References

See the vignette about $\psi$-Functions Available in Robustbase.

See Also

psiFunc and the psi_func class, both of which provide considerably more on the Rside, but are less optimized for speed.

Examples

Run this code
x <- seq(-5,7, by=1/8)
matplot(x, cbind(Mpsi(x, 4, "biweight"),
                 Mchi(x, 4, "biweight"),
                 Mwgt(x, 4, "biweight")), type = "l")
abline(h=0, v=0, lty=2, col=adjustcolor("gray", 0.6))

hampelPsi
(ccHa <- hampelPsi @ xtras $ tuningP $ k)
psHa <- hampelPsi@psi(x)## using Mpsi():
Mp.Ha <- Mpsi(x, cc = ccHa, psi = "hampel")
stopifnot(all.equal(Mp.Ha, psHa, tol = 1e-15))

Run the code above in your browser using DataLab