[R] use pcls to solve least square fitting with constraints
Ben Bolker
bbolker at gmail.com
Mon Dec 6 21:17:47 CET 2010
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 ...
More information about the R-help
mailing list