RTMB-package: RTMB: R bindings for TMB

RTMB-packageR Documentation

RTMB: R bindings for TMB

Description

The RTMB package provides a native R interface for a subset of TMB so you can avoid coding in C++. RTMB only affects the TMB function MakeADFun that builds the objective function. Once MakeADFun has been invoked, everything else is exactly the same and models run as fast as if coded in C++.

Details

RTMB offers a greatly simplified interface to TMB. The TMB objective function can now be written entirely in R rather than C++ (TMB-interface). In addition, we highlight two new simplifications:

  1. For most cases, simulation testing can be carried out automatically without the need to add simulation blocks (Simulation).

  2. Quantile residuals can be obtained without any essential modifications to the objective function (OSA-residuals).

The introduction vignette describes these basic features - see vignette("RTMB-introduction").

In addition to the usual MakeADFun interface, RTMB offers a lower level interface to the AD machinery (MakeTape). MakeTape replaces the functionality you would normally get in TMB using C++ functors, such as calculating derivatives inside the objective function.

The advanced vignette covers these topics - see vignette("RTMB-advanced").

Note

RTMB relies heavily on the new AD framework 'TMBad' without which this interface would not be possible.

Author(s)

Kasper Kristensen

Maintainer: kaskr@dtu.dk


RTMB documentation built on Nov. 5, 2025, 6:19 p.m.