3
$\begingroup$

I am using quantile regressions in R, using quantreg. I want to use locally linear fitting as per the example on page 13 of the vignette. I have a response variable and am looking at the relationships of various predictors. However, running the regressions with some of the predictors result in a singular design matrix.

The response variable is:

y  <-  c(21, 1, 0, 0, 3, 0, 13, 6, 7, 3, 0, 5, 5, 3, 2, 10, 10, 4, 3, 9,
0, 0, 4, 9, 6, 1, 1, 8, 8, 2, 2, 8, 9, 2, 0, 0, 0, 6, 1, 9, 17, 14, 2,
13, 30, 4, 4, 7, 2, 5, 0, 15, 9, 4, 3, 5, 2, 1, 8, 1)

Two examples of predictor variables are:

x1  <-  c(7, 7, 9, 8, 8, 8, 8, 7, 8, 6, 6, 7, 10, 9, 8, 7, 8, 7, 6, 6, 6, 
7, 9, 9, 8, 7, 7, 7, 7, 5, 6, 7, 9, 9, 8, 8, 9, 8, 7, 7, 7, 8, 8, 7, 9, 
7, 8, 7, 7, 7, 6, 8, 8, 8, 8, 9, 9, 8, 9, 8)

x2  <-  c(241, 304, 263, 301, 257, 445, 332, 329, 330, 269, 324, 338, 
315, 309, 320, 311, 227, 297, 246, 339, 424, 394, 289, 381, 362, 334, 
409, 304, 301, 350, 288, 288, 298, 403, 415, 503, 452, 302, 347, 369, 
492, 441, 443, 369, 449, 311, 289, 274, 361, 449, 502, 371, 373, 312, 
380, 303, 294, 330, 303, 405)

A locally linear quantile regression using fit1 <- lprq(x1, y, h=1,tau=.9) works fine for x1. However, running fit2 <- lprq(x2, y, h=1,tau=.9) results in the following message:

Error in rq.fit.br(wx, wy, tau = tau, ...) : Singular design matrix.

I assumed that this was a result of repeated values, but I can't understand why x1 works (with lots of repeated values) while x2 doesn't work. I tried to get around this by using this advice, but without success.

Any suggestions as to: 1) what the problem is?; and 2) how to resolve this?

Edit: I managed to run the quantile regression successfully after increasing the bandwidth until it no longer gave an error message. However, it would still be useful if someone could help with understanding why the singular design matrix error occurred.

$\endgroup$

0

Your Answer

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

Browse other questions tagged or ask your own question.