[R] Tracing gradient during optimization
Greg.Snow at imail.org
Tue Feb 24 18:09:51 CET 2009
It looks like you found a solution, but if you find yourself in this situation again using optim, then one approach is to modify your function that you are optimizing (or write a wrapper for it) to produce the tracing information for you.
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
greg.snow at imail.org
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Shimrit Abraham
> Sent: Tuesday, February 24, 2009 7:00 AM
> To: r-help at r-project.org
> Subject: [R] Tracing gradient during optimization
> Hi everyone,
> I am currently using the function optim() to maximize/minimize
> functions and
> I would like to see more output of the optimization procedure, in
> the numerical gradient of the parameter vector during each iteration.
> The documentation of optim() describes that the trace parameter should
> one to trace the progress of the optimization.
> I use the following command:
> optim(par = vPar,
> fn = calcLogLik,
> method = "BFGS",
> control = list(trace = TRUE, fnscale = -1, maxit = 2000));
> which gives very little information:
> initial value 3.056998
> final value 2.978351
> Specifying trace >1, for instance trace = 20, does not result in more
> information. Is there a way to view more details of the progress
> perhaps by
> using another optimizer?
> Shimrit Abraham
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help