Singular design matrix Error

I did these steps and i got that error, please can you help me about this:
S<-data$Stock
B<-data$Bond
taus<-seq(from = .05, to = .95, by = 0.05)
QR.coef <- coef(rq(S~B,tau=taus))
write.table(QR.coef, file = "QR.csv", sep = ",", col.names = NA, qmethod = "double")
lprq <- function(x, y, h, m=19 , tau=.5)
{
xx <- seq(min(x),max(x),length=m)
fv <- xx
dv <- xx
for(i in 1:length(xx)) {
z <- x - xx[i]
wx <- dnorm(z/h)
r <- rq(y~z, weights=wx, tau=tau, ci=FALSE)
fv[i] <- r$coef[1.]
dv[i] <- r$coef[2.]
}
data.frame(dv = dv)
}

QQR.coef <- as.data.frame(matrix(0, ncol = 19, nrow = 19))
for (i in 1:19){
x<-lprq(B,S,0.05,tau=taus[i])
QQR.coef[,i]<-x
}
Error in rq.fit.br(wx, wy, tau = tau, ...) : Singular design matrix

This happens, generally, when variables are too closely correlated. Construct a matrix by hand before passing to lprq and examine.

Thank you so much. I tried to check if they have high correlation but their correlation is too low.

How large is the matrix? Can you post it?

Its:

dim(data)
[1] 142 2

dim(QR.coef)
[1] 2 19

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.