Optim() returns wrong maximum

Martin.Schlather@uni-bayreuth.de Martin.Schlather@uni-bayreuth.de
Tue, 30 Jul 2002 13:12:46 +0200


Hi Ole,

I have encountered similar problems.
Even more, the parameters are not always 
within the given bounds (for method= "L-BFGS-B")
The values are then only an epsilon outside,
but it can be very disturbing nonetheless.

Cheers,
Martin

PS: the MLE algorithm in my contributed package 
    `RandomFields' is written such that it
    gets around with these two problems of optim


Ole Christensen wrote:
> 
> Dear R-devel
> 
> During the last half a year I have several times encountered the
> following problem with optim() when using method= "L-BFGS-B".
> 
> The function return a value which is clearly not the maximum (seen from
> printing the value each time the function is called). Some output is
> shown below.
> 
> A few things I have observed (as I remember it):
> 
> a. The problem seems to occur when the last function call is for a value
> on the boundary.
> 
> b. The problem also seems to occur more frequently in cases where the
> function providing the gradient is mis-specified.
> 
> I have deliberately not provided code such that you can reproduce the
> behaviour. The reason being that these functions are complicated  and
> involves a lot of input (data, fixed parameters, etc).
> 
> Someone might spot the problem based on the information I have given
> (possibly a bug in optim() ?).
> In case not, I would like to ask if anyone has observed similar problems
> ?.
> This may help me to construct a more simple example, which I could then
> submit with reproducible code.
> 
> ### facts  #########
> 
> > lik.t.cen.log <- optim(par = sqrt(lik.log$par)+0.1, fn=likeli.time.log, gr=gradient.time.log, method= "L-BFGS-B", control = list(fnscale=-1), lower = rep(0.0001,11), temp.list=temp.censor)
> [1] -1785.949
> [1] -2310.573
> [1] -1778.394
> [1] -1765.151
> [1] -1757.967
> [1] -1752.537
> [1] -1750.824
> [1] -1748.693
> [1] -1748.076
> [1] -1742.308
> [1] -1705.763
> [1] -1742.279
> [1] -1733.924
> [1] -1722.277
> [1] -1713.366
> [1] -1705.763
> [1] -1747.436
> [1] -1733.532
> [1] -1721.908
> [1] -1713.091
> [1] -1707.203
> [1] -1704.112
> [1] -1702.010
> [1] -1700.100
> [1] -1697.855
> [1] -1713.081
> [1] -1697.219
> [1] -1696.692
> [1] -1696.681
> [1] -1697.401
> [1] -1696.057
> [1] -1698.833
> [1] -1695.841
> [1] -1696.371
> [1] -1695.786
> [1] -1695.781
> [1] -1695.78
> [1] -1695.780
> [1] -1695.779
> [1] -1695.776
> [1] -1695.768
> [1] -1696.822
> [1] -1695.762
> [1] -1695.719
> [1] -1695.689
> [1] -1695.658
> [1] -1695.632
> [1] -1695.643
> [1] -1695.628
> [1] -1697.267
> >
> 
> > lik.t.cen.log
> $par
>  [1] 0.007369536 0.032623958 1.025064715 0.315420992 0.288083186
> 0.008728551
>  [7] 1.016895527 0.978822785 0.552299864 1.016390800 0.000100000
> 
> $value
> [1] -1697.267
> 
> $counts
> function gradient
>       50       50
> 
> $convergence
> [1] 0
> 
> $message
> [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"
> 
> ###########
> 
> Here ``likeli.time.log'' and ``gradient.time.log'' are functions,
> ``temp.censor'' is a list with input variables for the two functions
> (data, fixed parameters, etc.), and the parameter space is of dimension
> 11.
> 
> Note that value returned is clearly not the maximum, but optim() reports
> convergence.
> 
> > version
>          _
> platform i686-pc-linux-gnu
> arch     i686
> os       linux-gnu
> system   i686, linux-gnu
> status
> major    1
> minor    5.1
> year     2002
> month    06
> day      17
> language R
> 
> Cheers Ole
> 
> --
> Ole F. Christensen
> Department of Mathematics and Statistics
> Fylde College, Lancaster University
> Lancaster, LA1 4YF, England
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel 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-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
Martin Schlather                 email: Martin.Schlather@uni-bayreuth.de
Abteilung Bodenphysik            phone: +49 (0)921 55 2193          
Univ. Bayreuth                   Fax  : +49 (0)921 55 2246
D -- 95440 Bayreuth, Germany     http://www.geo.uni-bayreuth.de/~martin/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._