I want to fit a quantile regression model to my observed data, which clearly show a triangular relationship between the response and predictor variables:
When I do:
library("quantreg")
m1 <- rq(Y~ X, tau = 0.75, data=mydata)
summary(m1)
Call: rq(formula = Y ~ X, tau = 0.75, data = mydata)
tau: [1] 0.75
Coefficients:
coefficients lower bd upper bd
(Intercept) 3.42758 1.80850 4.74463
X 0.27879 0.07132 0.82591
It founds a positive relationship (in red), when it should be negative looking at the points in the graph, right? Maybe I'm missing something but it looks like a wrongh tau value. I tried with t=0.97 and t=0.90 (in gray), but the same pattern is produced.
Then, when I do:
m1.all <- rq(Y~ X, tau = seq(0.05, 0.95, by = 0.05), data=mydata)
m1.plot <- summary(m1.all)
Warning messages:
1: In rq.fit.br(x, y, tau = tau, ci = TRUE, ...) :
Solution may be nonunique
2: In rq.fit.br(x, y, tau = tau, ci = TRUE, ...) :
Solution may be nonunique
3: In rq.fit.br(x, y, tau = tau, ci = TRUE, ...) :
Solution may be nonunique
4: In rq.fit.br(x, y, tau = tau, ci = TRUE, ...) :
Solution may be nonunique
plot(m1.plot)
Error in plot.window(...) : infinite axis extents [GEPretty(-inf,inf,5)]
I only obtain the plot for the intercept, but not for the coefficients.
What I'm doing wrong?
I provide here mydata. I expect a negative relationship similar to results shown by Cade & Noon 2003 in Fig. 1 (see here).