[R] Nonlinear statistical modeling -- a comparison of R and AD Model Builder

Spencer Graves spencer.graves at pdf.com
Sat Nov 25 00:03:48 CET 2006

Hi, Mike & Dave: 

      Have you considered nonlinear mixed effects models for the types 
of problems considered in the comparison paper you cite?  Those 
"benchmark trials" consider "T years of data ... for A age classes and 
the total number of parameters is m = T+A+5".  Without knowing more 
about the problem, I suspect that the T year parameters and the A age 
class parameters might be better modeled as random effects.  If this 
were done, the optimization problem would then involve 7 parameters, the 
5 fixed-effect parameters suggested by the computation of "m" plus two 
variance parameters, one for the random "year" effects and another for 
the random "age class" effect.  This would replace the problem of 
maximizing, e.g., a likelihood over T+A+5 parameters with one of 
maximizing a marginal likelihood over 2+5 parameters after integrating 
out the T and A random effects. 

      These integrations may not be easy, and I might stick with the 
fixed-effects solution if I couldn't get answers in the available time 
using a model I thought would be theoretically more appropriate.  Also, 
I might use the fixed-effects solution to get starting values for an 
attempt to maximize a more appropriate marginal likelihood.  For the 
latter, I might first try 'nlmle'.  If that failed, I might explore 
Markov Chain Monte Carlo (MCMC).  I have not done MCMC myself, but the 
"MCMCpack" R package looks like it might make it feasible for the types 
of problems considered in this comparison.  The CRAN summary of that 
package led me to an Adobe Acrobat version of a PPT slide presentation 
that seemed to consider just this type of problem (e.g., 

      Have you considered that? 
      Hope this helps. 
      Spencer Graves

Mike Prager wrote:
> dave fournier <otter at otter-rsch.com> wrote:
>> I  think that many R users understimate the numerical challenges
>> that some of the typical nonlinear statistical model used in different
>> fields present. R may not be a suitable platform for development for
>> such models.
>> Around 10 years ago John Schnute, Laura Richards, and Norm Olsen
>> with Canadian federal fisheries undertook an investigation
>> comparing various statistical modeling packages for a simple
>> age-structured statistical model of the type commonly used in
>> fisheries. [...] It is possible
>> to produce a working model with the present day version of R so that
>> R can now be directly compared with AD Model Builder for this type of model.
>> The results are that AD Model builder is roughly 1000 times faster than
>> R for this problem. ADMB takes about 2 seconds to converge while
>> R takes over 90 minutes.
> Our group's experiences reflect, at least qualitatively, what
> Dave says above.  We use R for analyzing results from models
> written in his AD Model Builder, and a couple of years ago, we
> started programming one of our models directly in R.  We quickly
> abandoned that idea because of lengthy execution time under R.
> That is not a judgement of either piece of software.  R and ADMB
> are designed for different types of task, and it seems to me
> that they complement each other well.
> That experience was in part the genesis of our X2R software (now
> at CRAN -- pardon the plug), which saves results from ADMB
> models into a format that R can read as a list.  We feel that
> now we have the best of both worlds -- fast execution with ADMB,
> followed by the programming ease and excellent graphics of R for
> analysis of results and projections under numerous scenarios.

More information about the R-help mailing list