if (FALSE) {
## Find c for given bdp for the Tukey biweight function
## The constant c associated to a breakdown point of
## 50 percent in regression is
## c=1.547644980928226
psifun(bdp=0.5)
psifun(c=1.547644980928226)
## Find c for given bdp for the Hampel function
psifun(bdp=0.5, fun="hampel")
## Plot Huber rho function.
x <- seq(-3, 3, 0.001)
c <- 1.345;
HUc1 <- psifun(u=x, p=1, fun="HU", const=c)
rhoHU <- HUc1$rho
plot(x, rhoHU, type="l", lty="solid", lwd=2, col="blue",
xlab="u", ylab="rho (u,1.345)", ylim=c(0.16, 4.5))
lines(x, x^2/2, type="l", lty="dotted", lwd=1.5, col="red")
legend(-1, 4.6, legend=c("Huber rho function", "u^2/2"),
lty=c("solid", "dotted"), lwd=c(2,1.5), col=c("blue", "red"))
yc <- 0.13;
text(-c, yc, paste0("-c=", -c), adj=1)
text(c,yc, paste0("c=",c), adj=0)
segments(c, 0, c, c**2/2, col="red")
segments(-c, 0, -c, c**2/2, col="red")
points(c, c**2/2, col="red")
points(-c, c**2/2, col="red")
}
Run the code above in your browser using DataLab