If you do a search on the quantreg documentation for "piecewise", the first hit on the pdf has code on the same page. Running that rqss fit call unaltered with your data produced a straight line (because the data only has a domain of 0-0.5) but lowering lambda lets the piecewise character get captured. Try:

fit <- rqss(y ~ qss(x, lambda = .05),tau = .9)
plot(fit)

On Jun 19, 2009, at 9:52 AM, Michael Hecht wrote:

Hello,

i have the following data:

x = c (0,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1,0.11,0.12,0.13,0.14,0.15,0.16,0.17,0.18,0.19,0.2,0.21,0.22,0.23,0.25,0.26,0.27,0.46,0.47,0.48,0.49 ) y = c (0.48,0.46,0.41,0.36,0.32,0.35,0.48,0.47,0.55,0.56,0.54,0.67,0.61,0.60,0.54,0.51,0.45,0.42,0.44,0.46,0.41,0.43,0.43,0.48,0.48,0.47,0.39,0.37,0.32,0.29 )

and tried to get piecewise linear regression. Doing a simple spline smoothing gives the basic shape of the expected curve:

plot(x,y)
lines(smooth.spline(x, y), lty=2, col = "red")

Now I tried to do rqss. But what I got was only a straight line and nothing appropriate. No parameter change did help. Can anyone tell me what's wrong with this approach?

library(quantreg)
fit <- rqss(y ~ qss(x))
plot(fit)
points(x,y)
lines(smooth.spline(x, y), lty=2, col = "red")

Thank You in advance.
______________________________________________________

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to