2
$\begingroup$

Hello I am having some troubles in R when I try to make a summary of a quantile regression with my data.

When I try this:

df <- read.csv("https://raw.githubusercontent.com/swhatelse/rq_problem/master/data.csv")
fit <- rq(data=df,formula=time_per_pixel~vector_length,tau=.05,method="fn")
summary(fit,se="nid")

I get this error:

: Error in base::backsolve(r, x, k = k, upper.tri = upper.tri, transpose = transpose, : : singular matrix in 'backsolve'. First zero on the diagonale [1] : More over : Warning message: : In summary.rq(fit, se = "nid") : 14688 non-positive fis

If I try other se methods, the coefficients returned by the summary are not correct. For example when I check the coef by directly printing the result of the regression I get this:

Call:
rq(formula = time_per_pixel ~ vector_length, tau = 0.05, data = df, method = "fn")

Coefficients:
(Intercept) vector_length 
5.493212e-11  2.338409e-11

And when I use

summary(fit,se="rank")

I get:

Call: rq(formula = time_per_pixel ~ vector_length, tau = 0.05, data = df, 
method = "fn")

tau: [1] 0.05

Coefficients:
             coefficients lower bd upper bd
(Intercept)   0            0        0       
vector_length 0            0        0       

Same problem with iid and boot methods:

Call: rq(formula = time_per_pixel ~ vector_length, tau = 0.05, data = df, 
    method = "fn")

tau: [1] 0.05

Coefficients:
              Value   Std. Error t value Pr(>|t|)
(Intercept)   0.00000 0.00000    0.04217 0.96637 
vector_length 0.00000 0.00000    0.13871 0.88968 

It seems that it comes from the fact that I have heteroscedastic data but I am not sure because with the sample of data engel given with the quantreg library which is heteroscedastic, I have no problem.

In the quantreg vignette they suggest to go with a logarithmic scale with heteroscedastic data. But when I try to come back in a normal scale my coefficients are not correct. The log converted coeff are:

fit_log <- rq(data=df,formula=I(log(time_per_pixel))~vector_length,tau=.05,method="fn")
exp(fit_log$coefficients)

Degrees of freedom: 23120 total; 23118 residual
 (Intercept) vector_length 
1.274531e-10  1.093925e+00

The correct coeff are:

fit <-rq(data=df,formula=time_per_pixel~vector_length,tau=.05,method="fn")
fit
Call:
rq(formula = time_per_pixel ~ vector_length, tau = 0.05, data = df, 
   method = "fn")

Coefficients:
  (Intercept) vector_length 
 5.493212e-11  2.338409e-11 

So I would like to understand why it does not work with my data and how can I deal with that?

$\endgroup$
2
  • $\begingroup$ If you are interested in better ways to model your data, you should direct questions about statistical model fitting over to Cross Validated. This doesn't seem like a very specific programming question. How exactly do you know that the coefficients from other models are incorrect? Perhaps you could be more precise about what the problem is. $\endgroup$
    – MrFlick
    Commented May 11, 2016 at 14:27
  • $\begingroup$ Ok I added detail about the coefficients I get. I don't think it is really a problem of data modelization, and to me it seems a programming question related to R and I would like to get some help to understand why the summary.rq function does not work properly when I use it on my data. $\endgroup$
    – stevenqm
    Commented May 11, 2016 at 15:36

1 Answer 1

0
$\begingroup$

I know it's too late (like more than 5 yrs and probably it's solved by now) but anyhow the thread can be closed. I just faced the similar issue today and found this as open. May help others in future.

Try the method in the first comment in the following link: https://stackoverflow.com/questions/28393176/error-in-summary-quantreg-backsolve

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.