> There is nothing in that plot to indicate that the result given by
> optim() should be accepted as optimal.  The numerical approximation to
> the derivative is 0.055851 everywhere in your graph

That wasn't how I intended the plot to be interpreted.
By default, the step size (in x) is 1e-5, which seems like a moderate step size.
However, at that level, the numerical approximation is very badly behaved.
And if the step size is decreased, things get worse.

I haven't checked all the technical details of the optim function.
But any reliance on numerical approximations of the derivative, have a
high chance of running into problems using a function like this.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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 via email to