[R] another optimization question
John Fox
jfox at mcmaster.ca
Sun Nov 25 04:57:43 CET 2001
Dear R list members,
Since today seems to be the day for optimization questions, I have one that
has been puzzling me:
I've been doing some work on sem, my structural-equation modelling package.
The models that the sem function in this package fits are essentially
parametrizations of the multinormal distribution. The function uses optim
and nlm sequentially to maximize a multinormal likelihood. One of the
changes I've introduced is to use an analytic gradient rather than rely on
numerical derivatives. (If I can figure it out, I'd like to use an analytic
Hessian as well.)
I could provide additional details, but the question that I have is
straightforward. I expected that using an analytic gradient would make the
program faster and more stable. It *is* substantially faster, by up to an
order of magnitude on the problems that I've tried. In one case, however, a
model that converged (to the published solution) with numerical derivatives
failed to converge with analytic derivatives. I can program around the
problem, by having the program fall back to numerical derivatives when
convergence fails, but I was surprised by this result, and I'm concerned
that it reflects a programming problem or an error in my math. I suspect
that if I had made such an error, however, the other examples I tried would
not have worked so well.
So, my question is, is it possible in principle for an optimization to fail
using a correct analytic gradient but to converge with a numerical
gradient? If this is possible, is it a common occurrence?
Any help would be appreciated.
John
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list