qrq <-
function(s, a)
{
#computes linearized quantiles from rq data structure
#v is the rq structure e.g. rq(x,y)
#a is a vector of quantiles required
if(min(a) < 0 | max(a) > 1) stop("alphas out of range [0,1]")
r <- s$sol[1, ]
q <- s$sol[2, ]
q <- c(q[1], q)
J <- length(r)
r <- c(0, (r[1:J - 1] + r[2:J])/2, 1)
u <- rep(0, length(a))
for(k in 1:length(a)) {
i <- sum(r < a[k])
w <- (a[k] - r[i])/(r[i + 1] - r[i])
u[k] <- w * q[i + 1] + (1 - w) * q[i]
}
u
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.