Re: [Rd] Optimization in R

2007-08-07 Thread hadley wickham
On 8/7/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > Those are small parts of the calculation, not the whole thing. The > original point was that optim() is a very thin wrapper around the code > to do the optimization. I just don't see a need to make it more > complicated so it can be used to w

Re: [Rd] Optimization in R

2007-08-07 Thread Duncan Murdoch
Those are small parts of the calculation, not the whole thing. The original point was that optim() is a very thin wrapper around the code to do the optimization. I just don't see a need to make it more complicated so it can be used to wrap other methods. Authors of new optimization methods c

Re: [Rd] Optimization in R

2007-08-06 Thread hadley wickham
On 8/4/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > On 04/08/2007 2:53 PM, Gabor Grothendieck wrote: > > The example of generic functions. > > Show me an example where we have a list of ways to do a calculation > passed as an argument (analogous to the method argument of optim), where > the user

Re: [Rd] Optimization in R

2007-08-06 Thread Petr Savicky
Thank you for your response. This is a good idea. Although I use my own packages, some of them using other R API's, I missed the optimization ones. Thanks again. Petr Savicky. On Mon, Aug 06, 2007 at 07:16:11AM -0700, Thomas Lumley wrote: > On Mon, 6 Aug 2007, Petr Savicky wrote: > > >Question.

Re: [Rd] Optimization in R

2007-08-06 Thread Thomas Lumley
On Mon, 6 Aug 2007, Petr Savicky wrote: > Question. > > Is there a way how to optimize a function written in C > using optim? The algorithms used by optim are all accessible from C. The manual "Writing R Extensions" has a section on "The R API", including the optimization routines. -th

Re: [Rd] Optimization in R

2007-08-05 Thread Petr Savicky
I am sorry for omitting a citation in my previous post. The complete message is as follows (my text unchanged). PS I would like to add a remark and a question. Remark. There is a part of R, which allows the user to select among several methods for the same task and also to add his own C code: ra

Re: [Rd] Optimization in R

2007-08-05 Thread Petr Savicky
I would like to add a remark and a question. Remark. There is a part of R, which allows the user to select among several methods for the same task and also to add his own C code: random number generation. However, the interface for optimization is more complex. In my opinion, looking for a unifie

Re: [Rd] Optimization in R

2007-08-05 Thread Christophe Pouzat
Hi guys, I ran into the same problem and solved it by changing one line in Andrew's Makefile: instead of: gsl.so: vector.o multimin.o gcc -g -Wall -shared $^ -lgsl -o $@ use: gsl.so: vector.o multimin.o gcc -g -Wall -shared $^ -o $@ -lgsl -lgslcblas -lm Christophe Thanks for the func

Re: [Rd] Optimization in R

2007-08-04 Thread Manuel Morales
On Sat, 2007-08-04 at 16:37 -0400, Andrew Clausen wrote: > Hi Manuel, > > My multimin() wrapper will be merged into the Rgsl package. I expect that the > wrapper doesn't do anything special (compared to the rest of Rgsl) to break > the > compilation -- you're just having trouble with my very cru

Re: [Rd] Optimization in R

2007-08-04 Thread Gabor Grothendieck
I don't have an example of that but that does not make it less desirable. If one wants to use method 1, 2 or 3 then one can use optim with a method= but if one wants to use methods 4 or 5 then one must use an entirely different function. Surely it would be better to be consistent from the user's

Re: [Rd] Optimization in R

2007-08-04 Thread Andrew Clausen
Hi Manuel, My multimin() wrapper will be merged into the Rgsl package. I expect that the wrapper doesn't do anything special (compared to the rest of Rgsl) to break the compilation -- you're just having trouble with my very crude and temporary Makefile. Does Rgsl work for you? If it does, you c

Re: [Rd] Optimization in R

2007-08-04 Thread Manuel Morales
Thanks for the functions! I tried installing the multimin function. To get it to compile, I needed to change the Makefile to reflect my path and by adding the flags fPIC in response to the error: "/usr/bin/ld: vector.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a

Re: [Rd] Optimization in R

2007-08-04 Thread Duncan Murdoch
On 04/08/2007 2:53 PM, Gabor Grothendieck wrote: > The example of generic functions. Show me an example where we have a list of ways to do a calculation passed as an argument (analogous to the method argument of optim), where the user is allowed to add his own function to the list. Duncan Murdo

Re: [Rd] Optimization in R

2007-08-04 Thread Gabor Grothendieck
The example of generic functions. On 8/4/07, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > On 04/08/2007 2:23 PM, Gabor Grothendieck wrote: > > For the same reason that generic functions exist. They don't have > > a lot of common code but it makes easier to use. Perhaps the argument > > is not as

[Rd] Optimization in R

2007-08-04 Thread Nicholas Lewin-Koh
Hi, In my earlier post I eluded to a situation where that would be useful. In nlme, there is a choice of optimizers, minpack.lm has Levenberg-Marquardt, while nlminb has the port routines. For the same starting values, different optimizers will present different solutions, having a common interfac

Re: [Rd] Optimization in R

2007-08-04 Thread Duncan Murdoch
On 04/08/2007 2:23 PM, Gabor Grothendieck wrote: > For the same reason that generic functions exist. They don't have > a lot of common code but it makes easier to use. Perhaps the argument > is not as strong here since the class tends to be implicit whereas the > method is explicit but it would s

Re: [Rd] Optimization in R

2007-08-04 Thread Gabor Grothendieck
For the same reason that generic functions exist. They don't have a lot of common code but it makes easier to use. Perhaps the argument is not as strong here since the class tends to be implicit whereas the method is explicit but it would still be a convenience. On 8/4/07, Duncan Murdoch <[EMAIL

Re: [Rd] Optimization in R

2007-08-04 Thread Duncan Murdoch
On 04/08/2007 1:05 PM, Gabor Grothendieck wrote: > I think it would be desirable for optim to have a dispatching mechanism > that allows users to add their own optimization techniques to those > provided without having to modify optim and without having to come > up with a new visible function. Fo

Re: [Rd] Optimization in R

2007-08-04 Thread Gabor Grothendieck
I think it would be desirable for optim to have a dispatching mechanism that allows users to add their own optimization techniques to those provided without having to modify optim and without having to come up with a new visible function. For example, if we call optim as optim(...whatever..., meth

Re: [Rd] Optimization in R

2007-08-04 Thread Duncan Murdoch
On 04/08/2007 10:30 AM, Andrew Clausen wrote: > Hi Duncan, > > On Sat, Aug 04, 2007 at 09:25:39AM -0400, Duncan Murdoch wrote: >> This is interesting work; thanks for doing it. Could I make a >> suggestion? Why not put together a package containing those test >> optimization problems, and offe

[Rd] Optimization in R

2007-08-04 Thread Nicholas Lewin-Koh
ate: Sat, 4 Aug 2007 01:12:31 -0400 > From: Andrew Clausen <[EMAIL PROTECTED]> > Subject: [Rd] Optimization in R > To: r-devel@r-project.org > Cc: [EMAIL PROTECTED] > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=unknown-8bit > > Hi all, >

Re: [Rd] Optimization in R

2007-08-04 Thread Andrew Clausen
Hi Duncan, On Sat, Aug 04, 2007 at 09:25:39AM -0400, Duncan Murdoch wrote: > This is interesting work; thanks for doing it. Could I make a > suggestion? Why not put together a package containing those test > optimization problems, and offer to include other interesting ones as > they arise?

Re: [Rd] Optimization in R

2007-08-04 Thread Andrew Clausen
Hi Pat, On Sat, Aug 04, 2007 at 09:59:57AM +0100, Patrick Burns wrote: > Sounds like a good project. Thanks :) > How much extra overhead are you getting from the > algorithm being in R? On the Rosenbrock function (which is very quick to evaluate), here are the system.time() results: > system.t

Re: [Rd] Optimization in R

2007-08-04 Thread Duncan Murdoch
On 04/08/2007 1:12 AM, Andrew Clausen wrote: > Hi all, > > I've been working on improving R's optim() command, which does general purpose > unconstrained optimization. Obviously, this is important for many statistics > computations, such as maximum likelihood, method of moments, etc. I have > fo

[Rd] Optimization in R

2007-08-03 Thread Andrew Clausen
Hi all, I've been working on improving R's optim() command, which does general purpose unconstrained optimization. Obviously, this is important for many statistics computations, such as maximum likelihood, method of moments, etc. I have focused my efforts of the BFGS method, mainly because it be