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 Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Shimrit Abraham > Sent: Tuesday, February 24, 2009 7:00 AM > To: r-help@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 > particular > the numerical gradient of the parameter vector during each iteration. > The documentation of optim() describes that the trace parameter should > allow > 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 > converged > > 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? > > Thanks, > > Shimrit Abraham > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > 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. ______________________________________________ R-help@r-project.org mailing list 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.