Sheena,
Short answer: Both numbers are informative, but the precise answer depends
on what you mean by "iteration." For the PS, it's fine if you give either
number as long as you say what it means.
Long answer: The number under "function" gives the number of times that the
algorithm actually evaluates f(x) before it declares convergence/failure.
The number under "counts" gives the number times of times the algorithm
evaluates the gradient f'(x) before it declares convergence/failure.
Notice that optim BFGS uses a slightly more complicated NR algorithm that
separates the step length (ie. how far you walk) and direction (which
direction you want to walk). Bluntly speaking, in each full "iteration" the
algorithm finds the direction f'(x) (by building a finite-difference
approximation of the gradient) and then conditional on that direction it
looks for an optimal step length via a bi-section like method by repeatedly
calling f(x) looking for the step length that maximizes f(x) in the given
direction. Then it takes the step and the procedure is repeated.
So in that sense the number of "counts" gives the number of full iterations
(ie. including the choice of direction and step length). But the number
under "function" tells you of often f(x) was called overall. (Both numbers
exclude calls needed to compute the Hessian, if requested, and any calls to
compute the finite-difference approximation to the gradient.)
Hope this helps.
Jens
The question was mean to
This is a subtle point and the answer
In principle the number under "function"
A two-element integer vector giving the number of calls to fn and gr
respectively. This excludes those calls needed to compute the Hessian, if
requested, and any calls to fn to compute a finite-difference approximation
to the gradient.
-----Original Message-----
From: gov2001-l-bounces at
lists.fas.harvard.edu [mailto:gov2001-l-
bounces at
lists.fas.harvard.edu] On Behalf Of Sheena E Chestnut
Sent: Thursday, February 28, 2008 12:29 PM
To: gov2001-l at
lists.fas.harvard.edu
Subject: [gov2001-l] iterations in problem 3
Hi all,
Quick question: When we are asked in Problem 3b how many iterations it
takes
for the algorithm to converge, I had interpreted the R help file as
saying that
the number of iterations is the number under "function" in the
"counts"
part of
the output. I've heard rumors that it might actually be the number
under
"gradient" instead. Which is correct, and why?
Best,
Sheena
Quoting Jens Hainmueller <jhainmueller at gmail.com>:
No, Latex is not required. We encourage you to
use it, but you don't
have
to. On the website we have put together a lot of
info about Latex.
Another
hybrid alternative you may want to try is LyX (
http://www.lyx.org/ )
.
Hope this helps.
Jens
From: Joerg Orgeldinger [mailto:orgeldi at yahoo.de]
Sent: Thursday, February 28, 2008 7:57 AM
To: jhainmueller at
gmail.com
Subject: Latex
Dear Jens,
is it required to use LaTEX. I did not use it before, so I have to
learn it
first.
Regards
Joerg
________________________________________
Lesen Sie Ihre E-Mails jetzt einfach von unterwegs mit Yahoo! Go.
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l at
lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l