[R] Seeking optimal mixture

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Sep 26 15:46:05 CEST 2001

On Wed, 26 Sep 2001, Kari Ruohonen wrote:

> This is maybe not directly an R problem but I have used R to try to solve
> it so I think somebody may be able to help.
> I have a mixture model with three components and a quadratic Scheffe
> polynomial p1x1+p2x2+p3x3+p12x1x2+p13x1x3+p23x2x3 fitted to the response.
> Now I'd like to compute the mixture corresponding the maximum response.
> Model for Y1 has the parameters
> p1=124.02
> p2=60.973
> p3=41.479
> p12=106.824
> p13=140.422
> p23=81.012
> Solving a system of linear equations (solve(A,b)) of the partial derivates
> and putting a constraint of x1+x2+x3=1 with Lagrange's multiplier finds
> the mixture
> x1=0.760208
> x2=0.08256986
> x3=0.15722207
> that produces the maximum response 130.378 within the experimental region.
> Now, my model for another response Y2 has the parameters
> p1=35.8147
> p2=42.1012
> p3=51.7479
> p12=19.9611
> p13=0.2531
> p23=-6.6498
> Solving as above with the partial derivatives gives
> x1=0.3150576
> x2=0.60094504
> x3=0.08399731
> that produces Y2(max)=44.381. But this is not the maximum since e.g.
> x1=0
> x2=0.25
> x3=0.75
> produces 48.089 (but is not necessarily the maximum response).
> I have looked at optim() and wondered if I could use it somehow to solve
> my problem. However, I have not found a way to tell optim() about my sum
> constraint x1+x2+x3=1. All help is appreciated.

You can't.  Optimizing over a simplex is a harder problem.  *However* if I
understand you aright your objective is a quadratic function and so you
can use package quadprog on CRAN, which does handle general enough

BTW to Peter Dalgaard: it really is harder to handle general linear
inequality constraints than box constraints.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list