Fitting dynamic occupancy models with TMB
The reasons for trying TMB were the same as before: TMB is said to be fast, allows for parallel computations, works with R, accomodates spatial stuff, allows easy implementation of random effects).
I found materials on the internet to teach myself TMB, at least what I needed to implement a simple HMM model. See here for a linear regression and a Gompertz state space model examples, here for the same linear regression example on Youtube (that’s awesome!) and many other examples here.
The R code is available on my GitHub here. TMB was… wait for it… > 300 times faster than ADMB, > 140 times than Unmarked and > 6000 times faster than Jags (although the comparison with the latter is a bit unfair I suppose). The results are available here.