Hello, My name is Hwanggyu Lim. I am working estimating parameters of non-negative function, which has local maximums. For example, the function has three parameters (e.g., f(a, b, c)) and I need to estimate them. For this, I am using nlminb optimization function and it works fine. Here is my question. I want to specify the absolute difference stopping tolerance (or stopping criterion) to stop the iteration of estimation algorithm. For example, when n-1th estimates and nth estimates have absolute differences less than 0.001 for all three parameters, the iteration must stop. In this case, is there any way that I can do? I know that nlminb function has several control parameters to specify the tolerance. But, I am not sure how I can specify the absolute difference stopping tolerance. (I think that abs.tol argument is not relevant to my question because it only works for functions whose minimum is 0. Could you please provide any idea about my situation if you have? Thanks! Best, Hwanggyu The information in this transmission is confidential and intended only for the recipient listed above. If you are not the intended recipient, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. If you are not the intended recipient, you are hereby notified that any disclosure, copying or distribution of this message, or the taking of any action based upon it, is strictly prohibited. [[alternative HTML version deleted]]
On Thu, 2 Apr 2020 10:26:07 +0000 "Lim, Hwanggyu" <hlim at gmac.com> wrote:> when n-1th estimates and nth estimates have absolute differences > less than 0.001 for all three parameters, the iteration must stop> I am using nlminb optimization functionnlminb function uses the PORT library. According to [1], the closest thing PORT has to what you want is the notion of X-convergence, namely, stopping when max(scale * abs(x - xstar))/max(scale * abs(x + xstar)) is considered to be below control$x.tol (with xstar being supposed local minimiser and scale being all ones by default). Using it as an absolute stopping criterion in x requires knowledge of at least order of magnitude of xstar, though, so it might not be feasible. Note that ?nlminb says in the description that it is there "for historical compatibility." The nloptr package offers an xtol_abs option [2] that results in the behaviour you want. -- Best regards, Ivan [1] David M. Gay, Usage Summary for Selected Optimization Routines. <http://web.archive.org/web/20070508140716/http://netlib.bell-labs.com/cm/cs/cstr/153.pdf> [2] https://nlopt.readthedocs.io/en/latest/NLopt_Reference/#stopping-criteria
This thread points out the important and often overlooked difference between "convergence" of an algorithm and "termination" of a program. I've been pushing this button for over 30 years, and I suspect that it will continue to come up from time to time. Sometimes it is helpful to put termination criteria actually into the user function. Alternatively try a different optimizer. The optimx package wraps several, including a few for bounds constrained optimization. Note that a new version will go up once revdeps have been checked. Dylan Beijers noted a minor glitch if users want to "maximize". If the termination criteria are really critical, some of the methods now merged into optimx (Rvmmin, Rcgmin, Rtnmin) are all in R. I won't pretend that diving in and making changes is easy, though I've tried to move the code more and more to maintainability and transparency. If anyone is interested in pursuing that sort of thing, I'll be willing to advise or help as long as the requests aren't too strident. For information, while all-R programs used to be much slower than those in Fortran or C or C++, users should time their problems rather than just assume a great penalty for running things completely in R. The human time saving is generally more important. Best, John Nash On 2020-04-03 5:24 a.m., Ivan Krylov wrote:> On Thu, 2 Apr 2020 10:26:07 +0000 > "Lim, Hwanggyu" <hlim at gmac.com> wrote: > >> when n-1th estimates and nth estimates have absolute differences >> less than 0.001 for all three parameters, the iteration must stop > >> I am using nlminb optimization function > > nlminb function uses the PORT library. According to [1], the closest > thing PORT has to what you want is the notion of X-convergence, namely, > stopping when max(scale * abs(x - xstar))/max(scale * abs(x + xstar)) is > considered to be below control$x.tol (with xstar being supposed local > minimiser and scale being all ones by default). Using it as an absolute > stopping criterion in x requires knowledge of at least order of > magnitude of xstar, though, so it might not be feasible. > > Note that ?nlminb says in the description that it is there "for > historical compatibility." > > The nloptr package offers an xtol_abs option [2] that results in the > behaviour you want. >
Hello Ivan, Thank you so much for your valuable comments. I will definitely look at the R package of nloptr you introduced. Best, Hwanggyu -----Original Message----- From: Ivan Krylov <krylov.r00t at gmail.com> Sent: Friday, April 3, 2020 5:25 AM To: Lim, Hwanggyu <hlim at gmac.com> Cc: r-help at r-project.org Subject: Re: [R] Question about nlminb function On Thu, 2 Apr 2020 10:26:07 +0000 "Lim, Hwanggyu" <hlim at gmac.com> wrote:> when n-1th estimates and nth estimates have absolute differences less > than 0.001 for all three parameters, the iteration must stop> I am using nlminb optimization functionnlminb function uses the PORT library. According to [1], the closest thing PORT has to what you want is the notion of X-convergence, namely, stopping when max(scale * abs(x - xstar))/max(scale * abs(x + xstar)) is considered to be below control$x.tol (with xstar being supposed local minimiser and scale being all ones by default). Using it as an absolute stopping criterion in x requires knowledge of at least order of magnitude of xstar, though, so it might not be feasible. Note that ?nlminb says in the description that it is there "for historical compatibility." The nloptr package offers an xtol_abs option [2] that results in the behaviour you want. -- Best regards, Ivan [1] David M. Gay, Usage Summary for Selected Optimization Routines. <http://web.archive.org/web/20070508140716/http://netlib.bell-labs.com/cm/cs/cstr/153.pdf> [2] https://nlopt.readthedocs.io/en/latest/NLopt_Reference/#stopping-criteria The information in this transmission is confidential and intended only for the recipient listed above. If you are not the intended recipient, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. If you are not the intended recipient, you are hereby notified that any disclosure, copying or distribution of this message, or the taking of any action based upon it, is strictly prohibited.