[R] nlm gradient and hessian

Jim Lindsey jlindsey at alpha.luc.ac.be
Wed Nov 24 10:05:06 CET 1999


  Out of curiosity, I have tried, without success, to use the new
facility in nlm to specify the gradient and hessian. (It is many years
since I had a problem simple enough to make analytic derivation of
these worthwhile.) The help now says that the function must have
attributes with these names but gives no indication as to what should
be in the attributes. The online example and demo do not use the new
feature.
  I tried supplying the gradient attribute as a function, as this
seemed most logical, but nothing changed in the results. In fact, no
matter what I supplied, even a character string in the attribute, I got
no reaction from nlm. So I took a look at the C code and found that
nlm seems to be looking for a numerical vector of the same length as
the parameter vector in the attribute. I am not sure what this could
be as the gradient will change as nlm searches through different sets
of parameter values. In any case, supplying such a vector quite
arbitrarily also was completely ignored by nlm. (I also tried looking
in the nlme code for examples without success.)
  Can anyone supply a simple example of how to use the gradient
attribute with nlm please? Even better would be an example where it
actually was worthwhile to supply it by an improvement in the results
from nlm...
  Thanks. Jim
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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