9

When I run a quantile regression in R, using the quantreg package, and then I run summary(quantregObject), I get this error message:

Error in base::backsolve(r, x, k = k, upper.tri = upper.tri, transpose = transpose, : singular matrix in 'backsolve'. First zero in diagonal [1]

Any suggestion how could I fix this problem?

lmo
  • 37,904
  • 9
  • 56
  • 69
Alberto
  • 91
  • 1
  • 2
  • [Did you google?](https://www.google.de/search?q=%22Error+in+base%3A%3Abacksolve%22+first+zero&oq=%22Error+in+base%3A%3Abacksolve%22+first+zero) Several similar questions incl. on SO, I didn't see a solution though at first glance. Maybe this should be asked [on an R mailing list](http://www.r-project.org/mail.html). – Mörre Feb 08 '15 at 11:04
  • Most likely an error that tells you some linear equation inside the function cannot be solved. A singular matrix isn't invertible. http://en.wikipedia.org/wiki/Invertible_matrix – kristang Feb 08 '15 at 11:08
  • Yes, I googled it but I did not find any satisfactory answer. Thanks for the suggestion, Someone. – Alberto Feb 08 '15 at 12:49
  • If you expect debugging assistance the minimum requirements include code and data. – IRTFM Feb 08 '15 at 17:05

1 Answers1

11

In short, try:

summary(quantregObject, se = "iid")

which puts a strong assumption on your residuals. Or if you need accuracy use a boot strap to get the standard errors:

summary(quantregObject, se = "boot")

If you call summary on a an object returned by quantreg:rq

summary(quantregObject)

This will call summary.rq.

From ?summary.rq.

You can see that there are 4 options to compute the standard errors (se). Depending on the sample size (N < 1000) the default is se = "rank" or se = "nid". "nid" does something which sounds complicated and may then yield a diagonal matrix which backsolve cannot handle.

tjebo
  • 21,977
  • 7
  • 58
  • 94
user2088669
  • 123
  • 1
  • 6