Sally Luo
2010-Sep-14 19:49 UTC
[R] Can I monitor the iterative/convergence process while using Optim or MaxLik?
Hi R-helpers, Is it possible that I have the estimates from each step/iteration shown on the computer screen in order to monitor the process while I am using Optim or MaxLik? Thanks for your help. Maomao [[alternative HTML version deleted]]
Greg Snow
2010-Sep-14 20:26 UTC
[R] Can I monitor the iterative/convergence process while using Optim or MaxLik?
The simple way to do this is just to rewrite your function to be optimized to print out the current values that it was called with, this way you will see where it is and what it is doing. Look at the cat function for how to print the values, also look at the flush.console function. For example you could take the 1st example on the optim help page and insert the following 2 lines as the 1st 2 lines of the f function: cat(x, '\n') flush.console() and then at each iteration you can see the values tried. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of Sally Luo > Sent: Tuesday, September 14, 2010 1:50 PM > To: r-help at r-project.org > Subject: [R] Can I monitor the iterative/convergence process while > using Optim or MaxLik? > > Hi R-helpers, > > Is it possible that I have the estimates from each step/iteration shown > on > the computer screen in order to monitor the process while I am using > Optim > or MaxLik? > > Thanks for your help. > > Maomao > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.
Arne Henningsen
2010-Sep-14 20:51 UTC
[R] Can I monitor the iterative/convergence process while using Optim or MaxLik?
On 14 September 2010 21:49, Sally Luo <shali623@gmail.com> wrote:> Is it possible that I have the estimates from each step/iteration shown on > the computer screen in order to monitor the process while I am using Optim > or MaxLik? >You can call maxLik() with argument "print.level" set to a value larger than 0. /Arne -- Arne Henningsen http://www.arne-henningsen.name [[alternative HTML version deleted]]