Returns a fit's posterior draws only when they form a genuine MCMC chain
($draws_kind == "chain", or an untagged legacy fit); for an i.i.d. /
approximation fit (nested Laplace, VI, SMC, ...) it returns NULL, because
chain diagnostics do not apply. This is the accessor diagnostics()
gates on. For the provenance-agnostic posterior sample used by summaries,
see posterior_sample().
Arguments
- fit
A tulpa_fit (or subclass) carrying posterior $draws.
Value
The chain draws matrix/array, or NULL for a non-chain fit.
Examples
# \donttest{
set.seed(1)
d <- data.frame(x = rnorm(60))
d$y <- rpois(60, exp(0.5 + 0.3 * d$x))
fit <- tulpa(y ~ x, data = d, family = "poisson", mode = "hmc",
control = list(n_iter = 400L, warmup = 200L, n_chains = 2L,
seed = 1L))
dim(mcmc_draws(fit))
# }