https://github.com/cran/quantreg
Tip revision: 889ac4040965a76e5670f2de9f0f91fbfe51b35b authored by Roger Koenker on 20 July 2022, 07:40:02 UTC
version 5.94
version 5.94
Tip revision: 889ac40
lprq.R
lprq <- function(x, y, h, tau = .5, m = 50)
{
## A toy routine to do locally polynomial quantile regression
xx <- seq(min(x),max(x),length=m)
fv <- xx
dv <- xx
for(i in 1:length(xx)) {
z <- x - xx[i]
wx <- dnorm(z/h)
r <- rq(y~z, weights=wx, tau=tau, ci=FALSE)
fv[i] <- r$coef[1.]
dv[i] <- r$coef[2.]
}
list(xx = xx, fv = fv, dv = dv)
}