[ADMB Users] The benefits of ADMB
Arni Magnusson
arnima at hafro.is
Tue Feb 23 10:07:44 PST 2010
Laurie raised a few points besides DLL compiling:
> ... a worked example of an ADMB/R package with a discussion of benefits
> would be useful eg. The benefits of using ADMB rather than R non-linear
> solvers (e.g. optim/minpack.lm), the benefits of using R for graphics,
> data-bases, and linking with other tools. Then a discussion of object
> orientated programming in R, i.e. S4 classes and FLR.
>
> I think a candidate for this example could be Pella-T example.
The benefits of using ADMB rather than R nonlinear solvers like
optim/minpack.lm are mainly speed, reliability, and built-in features like
random effects and MCMC.
Benchmark results like http://otter-rsch.ca/SchnuteRichardsOlsen1998.pdf,
http://otter-rsch.com/admbre/examples/logistic/logistic.html, and
http://otter-rsch.com/admbre/examples/sdv/sdv.html indicate that ADMB is
faster than Gauss, Matlab, S-Plus, and BUGS. I agree with Laurie, that
given the current variety of nonlinear solvers available in R, it would be
interesting to benchmark them against ADMB using a Pella-Tomlinson model.
If you want random effects and/or MCMC inside R, the functions are
limiting compared to ADMB. R packages like nlme, lme4, MCMCglmm, MCMCpack,
and mcmc are practical for many things, but can only express a small
subset of the models that can be built with ADMB. I have found this
especially true for models that are time-structured but not basic
time-series models.
R is excellent for many things, but there are some tasks that are better
performed by more specialized software, like databases or spreadsheets, or
a programming language with particularly strong support for specific
tasks, like ADMB and Perl. Even expert R programmers recognize its
limitations, and delegate some tasks to other languages, including
C/C++/Fortran to crunch numbers, and Perl to build packages.
If I was to do a Pella-Tomlinson assessment, I would probably start with a
quick Excel prototype, to get some initial parameter values and to verify
later that I get the same numbers in ADMB. Then I would write the model in
ADMB (probably borrow from the existing pella-t.tpl example), diagnose and
plot the model fit in R, run ADMB -mcmc, diagnose and plot the MCMC
results in R, evaluate possible transformations and reparametrizations,
and then plot and summarize the final results in R. Even though R is my
preferred programming language, I would use Excel and ADMB for the things
they do better. There are many other candidate tools, but these are the
ones I would use.
The benefits of ADMB become more important when dealing with models with
hundreds of parameters and very large datasets.
I have only used optim() and other nonlinear solvers in R to satisfy my
curiosity, never for work. The approach is very similar to ADMB: prepare
data objects, define parameters, make predictions, and evaluate the
objective function. Even the code will look quite similar, but in my
opinion I have a more reliable and versatile tool if I implement a model
in ADMB.
Of course, it would be nice to back up this opinion with a Pella-Tomlinson
benchmark. To test the "reliable" part, we would need a difficult dataset
with local minima. Does anyone know of a suitable dataset?
Arni
P.S. I'm looking forward to trying out the FLR
(http://r-forge.r-project.org/R/?group_id=318) way to do Pella-Tomlinson
and other assessment models. The FLash package is particularly interesting
to ADMB users, as it implements automatic differentiation for other FLR
packages using ADOL-C, although it appears not quite ready for testing.
FLR is an ambitious project, and even if the S4 classes take some of the
playfulness out of R, they're probably the best approach to manage a
project of this scope.
More information about the Users
mailing list