Skip to content
Prev 309934 / 398502 Next

relative convergence in 'optim'

2012/11/5 Mauricio Zambrano-Bigiarini <hzambran.newsgroups at gmail.com>:
Just in case it be useful for somebody else.
...
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}}