[Rd] iteration count in optim()

Prof. John C Nash nashjc at uottawa.ca
Fri Aug 6 22:54:41 CEST 2010


> Date: Fri, 6 Aug 2010 11:14:37 +0200
> From: Christophe Dutang <dutangc at gmail.com>
> To: r-devel at r-project.org
> Subject: [Rd] on the optim function
> Message-ID: <7E004A07-03E1-4DED-A506-6C564EDB6BD8 at gmail.com>
> Content-Type: text/plain; charset=us-ascii
>
> Dear useRs,
>
> I have just discovered that the R optim function does not return the number of iterations.
>
> I still wonder why line 632-634 of optim C, the iter variable is not returned (for the BFGS method for example) ?
>
> Is there any trick to compute the iteration number with function call number?
>
> Kind regards
>
> Christophe
>
> --
> Christophe Dutang
> Ph.D. student at ISFA, Lyon, France
> website: http://dutangc.free.fr

For BFGS the number of iterations is the number of gradient evaluations i.e., counts[2]

For most of the optimization tools available for R (not just in optim), these counts are a 
nightmare for developers who want some consistent naming and meaning, as Ravi Varadhan and 
I can attest in our efforts to build the optimx() wrapper. It can also be debated for some 
methods what constitutes an "iteration".

Best, JN



More information about the R-devel mailing list