https://github.com/cran/quantreg
Revision 752671797663fdafddc510f4c7404b484b73e92d authored by Roger Koenker on 28 March 2013, 00:00:00 UTC, committed by Gabor Csardi on 28 March 2013, 00:00:00 UTC
1 parent f39e98d
Raw File
Tip revision: 752671797663fdafddc510f4c7404b484b73e92d authored by Roger Koenker on 28 March 2013, 00:00:00 UTC
version 4.97
Tip revision: 7526717
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)
}

back to top