bartjoosen wrote: > > Hi, > > Is it possible to share the code on this list? > I'm also interested (and maybe others to) > Or are you planning to make a package? > > Best regards > > Bart > > > > Ted.Harding-2 wrote: >> >> On 12-Oct-09 13:33:17, Ted Harding wrote: >>> On 12-Oct-09 13:24:01, Terry Therneau wrote: >>>> ---------- begin included -------- >>>> Greetings! >>>> I want to follow the evolution of a Nelder-Mead function >>>> minimisation (a function of 2 variables). Hence each simplex >>>> will have 3 vertices. >>>> >>>> Therefore I would like to have a function which can output >>>> the coordinates of the 3 vertices after each new simplex >>>> is generated. However, there seems to be no way (which I can >>>> detect) of extracting this information from optim() (the 'trace' >>>> argument to 'control' does not seem to have provision for this, >>>> according to '?optim', and I have tried it out without success). >>>> >>>> --- end include ----- >>>> >>>> Why not put a cat() statement into "fn", the function that you supply >>>> which optim is calling? That will give the vertices that it tries one >>>> by one. >>>> >>>> Terry T. >>> >>> That's neat and simple! It hadn't occurred to me. Thanks! >>> Ted. >> >> And, 10 seconds after posting, I realised why it hadn't -- there >> would be no visible association between the vertex and the simplex >> (in this instance the triangle) that it belongs to. >> >> In other words, which two other points in the preceding sequence, >> along with the current one, make up the triangle being tested? >> >> Given the complexity of the Nelder-Mead process, it would be very >> tricky indeed to try to track this through the sequence of vertices >> which cat() would output. >> >> As it happens, Ben Bolker kindly sent me code which he wrote (see >> his earlier mail) which does do this nicely, since it has an output >> option within the Nelder-Mead routine itself -- at which point, >> the routine itself knows what the simplex is. >> >> Ted. >> >> -------------------------------------------------------------------- >> E-Mail: (Ted Harding) <[email protected]> >> Fax-to-email: +44 (0)870 094 0861 >> Date: 12-Oct-09 Time: 14:45:00 >> ------------------------------ XFMail ------------------------------ >> >> ______________________________________________ >> [email protected] 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. >> >> > >
The reason I haven't shared is that the code is a translation from _Numerical Recipes in C_. Therefore I'm uncertain about its redistribution status. If it were a straight transcription rather than a translation, it would be un-redistributable (I feel bound to honor Press et al's redistribution policy, even though it's really annoying: see <http://mingus.as.arizona.edu/~bjw/software/boycottnr.html>). Because it's a translation of their C implementation of a public-domain algorithm, it's less clear to me whether this is allowed or not (any intellectual property lawyers lurking on the list should feel free to chime in here!); my compromise is that I'm willing to send the code on request, but won't post it to the list. If people really want an R-only implementation of Nelder-Mead, it would presumably take someone not very long to translate from an unencumbered source (the source code in R, or the source code in GSL, or the description of the original algorithm) ... cheers Ben Bolker -- View this message in context: http://www.nabble.com/Nelder-Mead-with-output-of-simplex-vertices-tp25838572p25874021.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ [email protected] 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.

