https://github.com/cran/quantreg
Raw File
Tip revision: 616fe292ea4c66f8db35d04c9fa045fea56eea02 authored by Roger Koenker on 04 September 2016, 13:02:15 UTC
version 5.29
Tip revision: 616fe29
Polson.R
# Toy rqss example based on Figure 2 of Polson and Scott (2016, JRSSB)
# NB:  Solutions are piecewise linear, unlike those of Polson and Scott
# whose ADMM procedure does only 30 iterations.
dgp <- function(n) {
    x <- 0:n/n
    y <- rnorm(n+1, 5 * sin(2 * pi * x), 0.5 + exp(1.5 * sin(4 * pi * x))) 
    data.frame(x = x, y = y)
}
D <- dgp(1000)
plot(D$x, D$y, cex = .5)
taus <- 1:9/10
for(i in 1:length(taus))
    plot(rqss(y ~ qss(x, lambda = 1/10), tau = taus[i], data = D), 
	 rug = FALSE, add = TRUE)

back to top