1\name{tukeyPsi1} 2\alias{robustbase-deprecated} 3\alias{tukeyPsi1} 4\alias{tukeyChi} 5\title{Tukey's Bi-square Score (Psi) and "Chi" (Rho) Functions and Derivatives} 6\description{ 7 These are \bold{deprecated}, replaced by 8 \code{\link{Mchi}(*, psi="tukey")}, \code{\link{Mpsi}(*, psi="tukey")} 9 10 \code{tukeyPsi1()} computes Tukey's bi-square score (psi) function, its first 11 derivative or it's integral/\dQuote{principal function}. This is 12 scaled such that \eqn{\psi'(0) = 1}, i.e., 13 \eqn{\psi(x) \approx x}{psi(x) ~= x} around 0. 14 15 \code{tukeyChi()} computes Tukey's bi-square loss function, 16 \code{chi(x)} and its first two derivatives. Note that in the general 17 context of \eqn{M}-estimators, these loss functions are called 18 \eqn{\rho (rho)}{rho}-functions. 19} 20\usage{ 21tukeyPsi1(x, cc, deriv = 0) 22tukeyChi (x, cc, deriv = 0) 23} 24\arguments{ 25 \item{x}{numeric vector.} 26 \item{cc}{ tuning constant } 27 \item{deriv}{integer in \eqn{\{-1,0,1,2\}} specifying the order of the 28 derivative; the default, \code{deriv = 0} computes the psi-, or 29 chi- ("rho"-)function.} 30} 31\value{ 32 a numeric vector of the same length as \code{x}. 33} 34\note{\code{tukeyPsi1(x, d)} and \code{\link{tukeyChi}(x, d+1)} are just 35 re-scaled versions of each other (for \code{d in -1:1}), i.e., 36 \deqn{\chi^{(\nu)}(x, c) = (6/c^2) \psi^{(\nu-1)}(x,c),} 37 for \eqn{\nu = 0,1,2}. 38 39 We use the name \sQuote{tukeyPsi\bold{1}}, because \code{tukeyPsi} is 40 reserved for a future \dQuote{Psi Function} class object, see 41 \code{\link{psiFunc}}. 42} 43\seealso{ 44 \code{\link{lmrob}} and \code{\link{Mpsi}}; further 45 \code{\link{anova.lmrob}} which needs the \code{deriv = -1}. 46} 47\author{Matias Salibian-Barrera, Martin Maechler and Andreas Ruckstuhl} 48\examples{ 49\dontshow{oop <- options(warn = -1) # against the "deprecated" warnings} 50op <- par(mfrow = c(3,1), oma = c(0,0, 2, 0), 51 mgp = c(1.5, 0.6, 0), mar= .1+c(3,4,3,2)) 52x <- seq(-2.5, 2.5, length = 201) 53cc <- 1.55 # as set by default in lmrob.control() 54plot. <- function(...) { plot(...); abline(h=0,v=0, col="gray", lty=3)} 55plot.(x, tukeyChi(x, cc), type = "l", col = 2) 56plot.(x, tukeyChi(x, cc, deriv = 1), type = "l", col = 2) 57plot.(x, tukeyChi(x, cc, deriv = 2), type = "l", col = 2) 58% \ is escape for Rd 59mtext(sprintf("tukeyChi(x, c = \%g, deriv), deriv = 0,1,2", cc), 60 outer = TRUE, font = par("font.main"), cex = par("cex.main")) 61par(op) 62 63op <- par(mfrow = c(3,1), oma = c(0,0, 2, 0), 64 mgp = c(1.5, 0.6, 0), mar= .1+c(3,4,1,1)) 65x <- seq(-5, 5, length = 201) 66cc <- 4.69 # as set by default in lmrob.control() 67plot. <- function(...) { plot(..., asp = 1); abline(h=0,v=0, col="gray", lty=3)} 68plot.(x, tukeyPsi1(x, cc), type = "l", col = 2) 69abline(0:1, lty = 3, col = "light blue") 70plot.(x, tukeyPsi1(x, cc, deriv = -1), type = "l", col = 2) 71plot.(x, tukeyPsi1(x, cc, deriv = 1), type = "l", col = 2); abline(h=1,lty=3) 72% \ is escape for Rd 73mtext(sprintf("tukeyPsi1(x, c = \%g, deriv), deriv = 0, -1, 1", cc), 74 outer = TRUE, font = par("font.main"), cex = par("cex.main")) 75par(op) 76\dontshow{options(oop)} 77} 78\keyword{robust} 79