Skip to content
Prev 277752 / 398506 Next

Non-finite finite-difference value" error in eha's, aftreg

This kind of error seems to surprise R users. It surprises me that it doesn't happen much
more frequently. The "BFGS" method of optim() from the 1990 Pascal version of my book was
called the Variable Metric method as per Fletcher's 1970 paper it was drawn from. It
really works much better with analytic gradients, and the Rvmmin package which is an all-R
version that adds bounds and masks is set up to generate a warning if they are not
available. Even with bounds, the finite different derivative code can step over a cliff
edge with   del <- (f(x+h) - f(x))/h  i.e., bounds may not be checked within the numerical
derivative functions. And "BFGS" is not set up with bounds. "L-BFGS-B" which has them is
actually a rather different method.

If you get such error messages, why not capture the parameter vector and check the
function computation at those parameters and nearby? Yes, a bit tedious, but rarely have I
found it a waste of time. For information, there should be a small function available
shortly on R-forge (project optimizer, likely in the optfntools package) to do an axial
search around a set of parameters and generate some information about the functional
surface. I still have to prepare documentation and examples, but if anxious, contact me
off-list.

JN