relative convergence in 'optim'

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

relative convergence in 'optim'

Mauricio Zambrano-Bigiarini-2
Dear list,

I have a question related to the correct interpretation of the
relative convergence criterion used by 'optim'.


In the help of the function is it written that:

"reltol:Relative convergence tolerance. The algorithm stops if it is
unable to reduce the value by a factor of reltol * (abs(val) + reltol)
at a step."

and I was wondering if the previous criterion is equivalent to:


abs( val [iter] - val[iter-1] ) / val [iter-1] <= reltol * ( abs( val
[iter] ) + reltol )

OR

abs( val [iter] / val [iter-1] ) <= reltol * ( abs( val [iter] ) + reltol )

OR

abs( val [iter] - val [iter-1] ) <= reltol * ( abs( val [iter] ) + reltol )



Thanks in advance for any help,


Mauricio Zambrano-Bigiarini

--
=====================================
Water Resources Unit
Institute for Environment and Sustainability
Joint Research Centre, European Commission
webinfo    : http://floods.jrc.ec.europa.eu/
=====================================
DISCLAIMER:\ "The views expressed are purely those of th...{{dropped:13}}

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: relative convergence in 'optim'

Mauricio Zambrano-Bigiarini-2
2012/11/5 Mauricio Zambrano-Bigiarini <[hidden email]>:

> Dear list,
>
> I have a question related to the correct interpretation of the
> relative convergence criterion used by 'optim'.
>
>
> In the help of the function is it written that:
>
> "reltol:Relative convergence tolerance. The algorithm stops if it is
> unable to reduce the value by a factor of reltol * (abs(val) + reltol)
> at a step."
>
> and I was wondering if the previous criterion is equivalent to:
>
>
> abs( val [iter] - val[iter-1] ) / val [iter-1] <= reltol * ( abs( val
> [iter] ) + reltol )
>
> OR
>
> abs( val [iter] / val [iter-1] ) <= reltol * ( abs( val [iter] ) + reltol )
>
> OR
>
> abs( val [iter] - val [iter-1] ) <= reltol * ( abs( val [iter] ) + reltol )


Just in case it be useful for somebody else.

>From the C code on http://svn.r-project.org/R/trunk/src/appl/optim.c :

...
enough = (f > abstol) &&
fabs(f - *Fmin) > reltol * (fabs(*Fmin) + reltol);
   /* stop if value if small or if relative change is low */
   if (!enough) {
count = n;
*Fmin = f;
   }
...

which I would write in R as:

reltol <- abs( f - f.best ) <= reltol * ( abs(f.best) + reltol )



Cheers,

Mauricio Zambrano-Bigiarini

--
=====================================
Water Resources Unit
Institute for Environment and Sustainability
Joint Research Centre, European Commission
webinfo    : http://floods.jrc.ec.europa.eu/
=====================================
DISCLAIMER:\ "The views expressed are purely those of th...{{dropped:11}}

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.