Re: [S] Problem with the OPTIMIZE function

Prof Brian Ripley (ripley@stats.ox.ac.uk)
Thu, 19 Nov 1998 17:09:30 +0000 (GMT)


>
> Hi!
>
> I have a problem with the 'optimize' function in S-plus
> (Version 3.4 Release 1 for Sun SPARC, SunOS 5.3 : 1996).
> I have two functions that I want to optimize over the
> interval (0,150):
>
> my.fcn<-function(x){
> (exp(-exp(6.09-.08*x)) - exp(-exp(10-.13*x)))
> }
>
> my.fcn2<-function(x){
> (exp(-exp(6.09-.2*x)) * (1-exp(-exp(10-.25*x))))
> }
>
> However it seems, that the algorithm forgets to check some
> of the interval.

This is a known bug (or at least, known to MathSoft and the discoverer).
Don't use maximum=T prior to 4.5 (I think). The call

temp$z <- .Fortran("fmin1d",
out = as.double(c(lower, upper, w, fw, tol, .Machine$double.eps
)),
as.integer(0))$out[1]

needs fw replaced by (fsign * fw) as far as I recall.

-- 
Brian D. Ripley,                  ripley@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

----------------------------------------------------------------------- This message was distributed by s-news@wubios.wustl.edu. To unsubscribe send e-mail to s-news-request@wubios.wustl.edu with the BODY of the message: unsubscribe s-news