x <- rhuber(1e5, 5, 2, 3)
xx <- seq(-20, 20, by = 0.1)
hist(x, 100, freq = FALSE)
lines(xx, dhuber(xx, 5, 2, 3), col = "red")
hist(phuber(x, 5, 2, 3))
plot(ecdf(x))
lines(xx, phuber(xx, 5, 2, 3), col = "red", lwd = 2)
Run the code above in your browser using DataLab