[R] use pcls to solve least square fitting with constraints

Baoqiang Cao bqcaomail at gmail.com
Mon Dec 6 18:06:17 CET 2010


I have a least square fitting problem with linear inequality
constraints. pcls seems capable of solving it so I tried it,
unfortunately, it is stuck with the following error:
> M <- list()
> M$y = Dmat[,1]
> M$X = Cmat
> M$Ain = as.matrix(Amat)
> M$bin = rep(0, dim(Amat)[1])
> M$p=qr.solve(as.matrix(Cmat), Dmat[,1])
> M$w = rep(1, length(M$y))
> M$C = matrix(0,0,0)
> p<-pcls(M)
Error in t(qr.qty(qra, t(M$X))[(j + 1):k, ]) :
  error in evaluating the argument 'x' in selecting a method for function 't'

After some searches, I still couldn't find any solution, any help
and/or advice will be highly appreciated!


More information about the R-help mailing list