Skip to content
Prev 321982 / 398500 Next

Singular design matrix in rq

I believe that those repeated values (more than half your x values are 0.0)
are causing bs() problems, because its default knots are at quantiles of the data
at equally spaced probabilities.  The following may be the same problem:
Error in rq.fit.br(x, y, tau = tau, ...) : Singular design matrix
Call:
lm(formula = y ~ bs(x, df = 15))

Coefficients:
     (Intercept)   bs(x, df = 15)1   bs(x, df = 15)2   bs(x, df = 15)3  
         1.59024                NA                NA                NA  
 bs(x, df = 15)4   bs(x, df = 15)5   bs(x, df = 15)6   bs(x, df = 15)7  
              NA                NA                NA          -2.09983  
 bs(x, df = 15)8   bs(x, df = 15)9  bs(x, df = 15)10  bs(x, df = 15)11  
        -1.06874          -1.20798          -0.99340          -0.87365  
bs(x, df = 15)12  bs(x, df = 15)13  bs(x, df = 15)14  bs(x, df = 15)15  
        -0.71927          -0.50564           0.06184                NA
[1] 7.029298e+00 2.773759e+00 1.286165e+00 1.160239e+00 9.992134e-01 8.102012e-01
 [7] 6.334326e-01 4.098332e-01 3.185013e-01 4.476983e-16 1.643202e-16 8.614772e-17
[13] 7.597613e-17 5.575475e-17 1.760443e-17 1.727013e-18    

Try using equally spaced knots or removing repeated quantiles when you call bs().

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com