Re: [R] an alternative to R for nonlinear stat models

From: Prof. John C Nash <>
Date: Wed, 16 Jun 2010 09:30:55 -0400

I'd echo Paul's sentiments that we need to know where and when and how R goes slowly. I've been working on optimization in many environments for many years (try ?optim and you'll find me mentioned!). So has Dave Fournier. AD Model Builder has some real strengths and we need Automatic Differentiation in R -- hence the Google Summer of Code project in which I'm mentoring Chillu (see the R Wiki for some info on this). But it will be a while before we really have really good interfaces to such capability. There is already some capability for ADMB. Dave F. may even agree with me when I suggest that most users find ADMB and indeed most optimization tools quite an effort to use.

Moreover, there's a general feeling that to "go fast" you need to "go C". Yet my package Rcgmin is all in R, and does large-n optimization via a more modern CG method than optim's CG (I've primary rights to complain as the latter is based on my own code.) Yet on some fairly common test problems it often goes extremely fast. We're talking 3 seconds to minimize a function of 5000 parameters on an Asus netbook (with analytic derivatives). BUT ... sometimes I can slow it down by just changing the starting vector.

We're statisticians -- so let's make sure the sample is large enough and representative enough. But my main messages here:


> Message: 119 Date: Wed, 16 Jun 2010 09:36:24 +0200 
>  From: Paul Hiemstra <> 
>  To: Cc:, Subject: 
>  Re: [R] an alternative to R for nonlinear stat models 
>  Message-ID: <> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 
>  On 06/16/2010 07:35 AM, wrote:

>> > Hi
>> > I implemented the age-structure model in Gove et al (2002) in R, which is a
>> > nonlinear statistical model. However running the model in R was very slow.
>> > So Dave Fournier suggested to use the AD Model Builder Software package and
>> > helped me implement the model there.
>> > ADMB was incredibly fast in running the model:
>> > While running the model in R took 5-10 minutes, depending on the settings,
>> > in ADMB it took 1-2 seconds!
>> > I'm reporting this so that people who have performance issues with nonlinear
>> > statistical models in R will know that there is a good free alternative for
>> > more difficult problems.
>> > There is also a help platfrom equivalent to the one for R, and people
>> > running it are extremley helpful.
>> > I hope this might help someone
>> > cheers
>> > Beni
>> > ______________________________________________
>> > mailing list
>> >
>> > PLEASE do read the posting guide
>> > and provide commented, minimal, self-contained, reproducible code.
>> >
> Hi Beni,
> Thanks for posting information that might be useful for people on the 
> list. The only thing is that without a little more detail on how exactly 
> you implemented things in R, we are left to guess if the performance 
> issues are a problem of R, or that your particular implementation was 
> the problem. There are was of implementing R code in two ways, where the 
> first takes minutes and the second 1-2 seconds. Furthermore, you are 
> giving us no option to defend R  ;) .
> cheers,
> Paul
> -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri ------------------------------

______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 16 Jun 2010 - 13:33:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Jun 2010 - 14:00:32 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive