On 21-10-2012, at 13:37, Thomas Schu wrote: > Dear Richard, > > It is funny. I have to perform the approach of sediment fingerprinting for > my master thesis. Mr. Hasselman gave me the advice to take a closer look > into the limSolve package a few days ago. > http://cran.r-project.org/web/packages/limSolve/index.html > > I guess, the lsei-function of this package is exactly what you and i are > looking for. I have tried it out today and compared the lsei-results with > the results of the MS-Excel solver. They are the same! > You will find in the manual (Chemtax example), how to define the > constraints, that every unknown is >= 0 and the sum of unknowns is always 1. > http://cran.r-project.org/web/packages/limSolve/limSolve.pdf > > Try to get familiar with the lsei-function and if you still need help, i can > send you my code. > > Bearing the Monte-Carlo simulation in mind, the package could offer some > nice functions too.
Excellent idea. I hadn't actually tried limSolve. Using the data for bmat and target from my previous post, limSolve provides an excellent alternative and is fast(est): You don't need to define any special functions. library(limSolve) lsei(A=bmat,B=target,E=matrix(rep(1,4),ncol=4),F=1,G=matrix(rep(1,4),ncol=4),H=0) Berend ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.