MCMC with NUTS/Stan (that also doesn't converge very well yet):
library(tmbstan)
# options(mc.cores = parallel::detectCores()) # for parallel processing
pop_mcmc <- tmbstan(
model$obj,
chains = 1, # using only 1 chain and...
iter = 600, # only 600 iterations for a quick example
init = list("last.par.best"),
control = list(adapt_delta = 0.9, max_treedepth = 20L) # as needed, see ?stan
)
pars <- c("logR0", "logM1", "logh", "logmuC", "deltaC", "logqS1") # a selection
bayesplot::mcmc_trace(as.array(pop_mcmc), pars = pars)
bayesplot::mcmc_hist(as.array(pop_mcmc), pars = pars)
bayesplot::mcmc_pairs(as.array(pop_mcmc), pars = pars)
Got a first draft of this running without changing any input/output formats yet.
Documentation:
See example model fitting:
Example with built-in
pop_example
data:Doesn't always converge that well yet.
MCMC with NUTS/Stan (that also doesn't converge very well yet):
Continuous integration testing with Travis: https://travis-ci.org/pbs-assess/tmbpop
Could use a better package name, function names, data format, and argument names still.