[R] Supply linear constrain to optimizer

Ben Bolker ben at zoo.ufl.edu
Fri Sep 14 14:54:57 CEST 2001


  Good to hear about the log-linear mixture (which should have occurred to
me).  I found that for my particular problem (which does have some optimal
values at zero, on the boundary) that I would get p_i's of such different
orders of magnitude that the optimizer worked pretty poorly ...

On Fri, 14 Sep 2001, Prof Brian Ripley wrote:

> In my reading the most common transformation for mixtures is a log-linear
> model, that is p_i = exp(g_i) / sum_j exp(g_j).  There are one too many
> g_i's and this is solved in exactly the same way as for a log-linear model
> via glm, by omitting one, by a sum constraint ....
>
> This view does exclude any p_i = 0, but that is intentional as components
> could be dropped.
>
> If the boundary cases were of interest it would be nice to have an
> optimizer that allows linear inequality bounds (that is to optimize over a
> simplex).  As we don't have one, setting the objective to a large value
> or NA (in R at least) will cause the optimizer to keep within the region,
> but it may also cause it to work really slowly.
>
> Brian
>
> On Fri, 14 Sep 2001, Ben Bolker wrote:
>
> >
> >   I agree with the suggestion to reparameterize the data, but the problem
> > here is not readjusting the range (the box constraints in optim/L-BFGS-B
> > work just fine).
> >   A transformation I have used for compositional data:
> >
> >   c(1) <-> p(1)
> >   c(2) <-> p(2)/(1-p(1))
> >   ...
> >   c(n) <-> p(n)/(1-sum p(1)..p(n-1))
> >
> >
> > On Fri, 14 Sep 2001, Philippe Grosjean wrote:
> >
> > > Try reparameterize the function. Replace c1 and c2 by functions such they
> > > return values in the range you want. Hints: use ln(c) instead of c for
> > > returning a positive number; to obtain a range like [a, b], you can use a
> > > 4-parameter logistic function,... OK, it's not easy in the present case, but
> > > it is a way to get around your problem.
> > > Best regards,
> > >
> > > Philippe Grosjean
> > >
> > >
> > > ...........]<(({?<...............<?}))><...............................
> > >  ) ) ) ) )	 __               	 __
> > > ( ( ( ( ( 	|__)              	|  _
> > >  ) ) ) ) )	|   hilippe       	|__)rosjean
> > > ( ( ( ( ( 	Marine Biol. Lab., ULB, Belgium
> > >  ) ) ) ) )	                  	 __
> > > ( ( ( ( ( 	|\  /|            	|__)
> > >  ) ) ) ) )	| \/ |ariculture &	|__)iostatistics
> > > ( ( ( ( (
> > >  ) ) ) ) )	e-mail: phgrosje at ulb.ac.be or phgrosjean at sciviews.org
> > > ( ( ( ( ( 	SciViews project coordinator (http://www.sciviews.org)
> > >  ) ) ) ) )      tel: 00-32-2-650.29.70 (lab), 00-32-2-673.31.33 (home)
> > > ( ( ( ( (
> > >  ) ) ) ) )      "I'm 100% confident that p is between 0 and 1"
> > > ( ( ( ( (                                  L. Gonick & W. Smith (1993)
> > >  ) ) ) ) )
> > > ......................................................................
> > >
> > >
> > > >Dear R and S users,
> > >
> > > >I've been working on fitting finite mixture of negative exponential
> > > >distributions using maximum likelihood based on the example given in MASS.
> > > >So far I had much success in fitting two components. The problem started
> > > >when I tried to extend the procedure to fit three components.
> > > >More specifically,
> > >
> > > >likelihood = sum( ln(c1*exp(-x/lambda1)/lambda1 +
> > > >c2*exp(-x/lambda2)/lambda2 + (1-c1-c2)*exp(-x/lambda3)/lambda3) )
> > >
> > > >I've used optimizers such as ms and nlminb (SPLUS 5.0 for UNIX), and
> > > >provided parameters constrains (0 <= c1, c2 <= 1) to nlminb via lower and
> > > >upper. But these constrains provide no protection for (1-c1-c2) being
> > > >between interval [0,1], which resulted in generating NAs in the likelihood
> > > >function during iteration.
> > >
> > > >I've been looking at various documentations, but didn't see anywhere
> > > >mentioning setting linear constrain, in this case, c1 + c2 <= 1.
> > >
> > > >Any suggestion and pointers will be greatly apprepciated.
> > >
> > > >Kevin Xie
> > > >Research Student
> > > >Cavendish School of Computer Science
> > > >University of Westminster
> > > >London, UK
> > >
> > >
> > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> > > 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
> > > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> > >
> >
> > --
> > 318 Carr Hall                                bolker at zoo.ufl.edu
> > Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
> > Box 118525                                   (ph)  352-392-5697
> > Gainesville, FL 32611-8525                   (fax) 352-392-3704
> >
> > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> > 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
> > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> >
>
>

-- 
318 Carr Hall                                bolker at zoo.ufl.edu
Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
Box 118525                                   (ph)  352-392-5697
Gainesville, FL 32611-8525                   (fax) 352-392-3704

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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