0

If I run the library for 'quantreg', I get a warning that backsolve is masked from base. Then I try to run a quantile regression and I get an error involving backsolve. How can I solve this?

library(quantreg)

Loading required package: SparseM

Attaching package: ‘SparseM’

The following object is masked from ‘package:base’: backsolve

quantile_mod1<- rq(X ~ Y, tau=0.3,data=mydata)

Warning message: In rq.fit.br(x, y, tau = tau, ...) : Solution may be nonunique

summary(quantile_mod1)

Error in base::backsolve(r, x, k = k, upper.tri = upper.tri, transpose = transpose, : singular matrix in 'backsolve'. First zero in diagonal [41] In addition: Warning message: In summary.rq(quantile_mod1) : 12506 non-positive fis

  • 1
    Welcome to Stack Overflow! The first warning (`backsolve` masking) is harmless. For the remainder of your questions, we really need a [mcve] in order to be able to give you an answer ... e.g. see https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Ben Bolker Mar 09 '22 at 15:12
  • 1
    see also https://stackoverflow.com/questions/28393176/error-in-summary-quantreg-backsolve ; https://www.google.com/search?q=Error+in+base::backsolve+first+zero – Ben Bolker Mar 09 '22 at 15:13
  • @BenBolker I am sorry, but I cant give you the data because of privacy concerns, you can't help me with this information? I gave you all the code I wrote for the quantile regression – Lucasjansens Mar 09 '22 at 15:45
  • I think the quantile regression needs the backsolve from base but it is masked because the library(quantreg) uses the same name, can I somehow unmask the base backsolve? – Lucasjansens Mar 09 '22 at 15:50
  • 2
    Your interpretation of the problem is wrong. The masking of `base::backsolve` is just providing an alternate `backsolve` method for sparse matrices. You're apparently *not* using a sparse matrix because the regular `base::backsolve` is used. This is all fine. Your error, *"singular matrix in 'backsolve'"* means that there is a problem with your data---it's producing a singular matrix. Perhaps due to exact collinearity, perhaps insufficient observations for your model complexity, perhaps something else.... we can't know without knowing more about your data. – Gregor Thomas Mar 09 '22 at 16:07
  • there are a variety of ways of constructing a [mcve] that **don't** involve sharing your private data. You can use various strategies to obscure the details (anonymize/de-identify any factor labels; add a small amount of numeric fuzz to quantitative variables [small enough so that original problem remains]). You can also try to simulate data that resembles your data ... – Ben Bolker Mar 09 '22 at 22:18

0 Answers0