You might also use the maxit option. I was having problems with optim
stopping too early until I found it. From the help file:
maxit: The maximum number of iterations. Defaults to 100 for the
derivative-based methods, and 500 for "Nelder-Mead". For "SANN" maxit
gives the total number of function evaluations. There is no other
stopping criterion. Defaults to 10000.
Also, you can check to see if optim has found a maximum by checking to
see if the gradient at that point is zero. If you don't want to
write a function for the gradient, then you could sample randomly near
the point that optim is telling you is a maximum. so if that point is
p, then pick a bunch of random (but very small) x_i and test for
linear correlation between log.likelihood(p + x_i) and x_i.
-aram
On 4/2/06, Dan Hopkins <dhopkins(a)fas.harvard.edu> wrote:
Hi Sandip and Dan,
These two optim arguments are passed from constrOptim(), and could be
helpful--though perhaps you have already seen them. Both are arguments
passed to the control list (e.g. control=list(abstol=XXX)).
'abstol' The absolute convergence tolerance. Only useful for
non-negative functions, as a tolerance for reaching zero.
'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. Defaults to
'sqrt(.Machine$double.eps)', typically about '1e-8'.
Best,
Dan
----
Ph.D. Student
Department of Government
Harvard University
Tutor, Currier House
dhopkins(a)fas.harvard.edu
http://www.danhopkins.org
On Sun, 2 Apr 2006 ghumphr(a)fas.harvard.edu wrote:
Have you considered simulated annealing?
Quoting Sandip Sukhtankar <sandip.sukhtankar(a)gmail.com>om>:
Does anyone know how to set tolerance in R? The
help files and a web search
have been fairly unhelpful. We have been having trouble with constrOptim
returning local optima unless you feed it initial parameters close to the
answers, and wanted to change the tolerance so that R finds it harder to
return an optimum.
Thanks
Sandip & Dan
_______________________________________________
gov2001-l mailing list
gov2001-l(a)lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l(a)lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l