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?