| tulpa_draws_array | R Documentation |
Assembles a fitted model's posterior draws into an [iteration, chain, parameter] array – the layout expected by bayesplot and analogous to
posterior::as_draws_array(). Multiple chains are recognised from a 3D
draws array, a $chain_id row map, or an $n_chains count over chain-major
rows; a single pooled chain yields a one-chain array.
tulpa_draws_array(fit)
fit |
A |
As with posterior_sample(), a fit that carries no draws returns NULL with
a message naming its backend and the representation it carries instead.
A numeric array with dimensions [n_iter, n_chain, n_param] and the
parameter names on the third dimension, or NULL if the fit carries no
draws. Chains of unequal length are truncated to the shortest.
posterior_sample(), tulpa_posterior_draws(), diagnostics()
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(tulpa_draws_array(fit)) # [iteration, chain, parameter]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.