tmbstan back end to CmdStan

24 views
Skip to first unread message

Hyuna Seo

unread,
Jul 20, 2026, 2:59:29 AMJul 20
to TMB Users
Hi there,

Would it be possible/of any interest to consider implementing tmbstan() with CmdStan instead of RStan? 

Our lab has a couple use cases where running the HMC step-wise after running the adaptation phase once at the beginning, which requires passing the stepsize and the mass matrix (see https://github.com/stan-dev/rstan/issues/433). The current version of RStan only allows control = list(stepsize = ...) argument, and the mass matrix specification is only possible through CmdStan's inv_metric and metric_file arguments.

Thank you!

Kasper Kristensen

unread,
Jul 20, 2026, 5:49:17 AMJul 20
to TMB Users
The StanEstimators package uses CmdStan:
Would that work?

Cole Monnahan - NOAA Federal

unread,
Jul 21, 2026, 11:58:49 AMJul 21
to TMB Users
The SparseNUTS package is a wrapper around StanEstimators specifically for TMB and RTMB models, and allows more flexible mass matrix specifications. Have a look and see if that suits your purposes. It's possible to do what you want with some hacks, but I don't have an easy interface to pass a previously estimated mass matrix.  I could add one if you think it would be used. If so please file an issue on that repo. SNUTS will just use the asymptotic joint precision (or it's inverse) if the model converges and has a marginal mode (as almost all TMB models do). If you want to use MCMC to estimate a dense matrix it may be easier to just use a longer warmup period and turn on the dense mass matrix estimation of Stan too?
Reply all
Reply to author
Forward
0 new messages