Unexpected quantile relationship

3.6k views Asked by At

I want to fit a quantile regression model to my observed data, which clearly show a triangular relationship between the response and predictor variables: enter image description here

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).

2

There are 2 answers

0
LeMarque On

I think you should do something like this:

m1.all <- rq(Y~ X, tau = seq(0.05, 0.95, by = 0.05), data=mydata)

m1.plot <- summary(m1.all)

plot(m1.plot, xlim=c(0.001,10), ylim=c(0.001,10), log="xy")

I checked for a sample data and it worked for me.

enter image description here

0
Wesley cheung On

I just encounter the same problem, and it may be different than your case( and others cases), but i would like to share with others how i solve the problem.
The problem is because there are some value (coefficient, upper/lower range) that are close to infinite.
Those values i believe are usually on the highest or lowest range of quantile, So when i limited the tau range from 5:95 to 10:90, and re-do the regression, the problem is solved.