The comprehensive TMB documentation
1 Introduction
TMB (Template Model Builder) is an R package for fitting statistical latent variable models to data. It is strongly inspired by ADMB. Unlike most other R packages the model is formulated in C++. This provides great flexibility, but requires some familiarity with the C/C++ programming language.
- TMB can calculate first and second order derivatives of the likelihood function by AD, or any objective function written in C++.
 - The objective function (and its derivatives) can be called from R. Hence, parameter estimation via e.g. 
nlminb()is easy. - The user can specify that the Laplace approximation should be applied to any subset of the function arguments.
- Yields marginal likelihood in latent variable model.
 
 - Standard deviations of any parameter, or derived parameter, obtained by the ‘delta method’.
 - Pre and post-processing of data done in R.
 - TMB is based on state-of-the art software: CppAD, Eigen, …
 
A more general introduction including the underlying theory used in TMB can be found in this paper.