Baoqiang Cao
2010-Dec-06 17:06 UTC
[R] use pcls to solve least square fitting with constraints
Hi, 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! Baoqiang
Ben Bolker
2010-Dec-06 20:17 UTC
[R] use pcls to solve least square fitting with constraints
Baoqiang Cao <bqcaomail <at> gmail.com> writes:> 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'This is not a reproducible example, but ... You appear to be missing the S, sp, and off elements of the M list? See the examples in ?pcls ...