posterior_sample: Posterior parameter sample from a fit

View source: R/convergence.R

posterior_sampleR Documentation

Posterior parameter sample from a fit

Description

Returns a fit's posterior draws for summary purposes (quantiles, derived quantities, density plots), regardless of how they were produced – an MCMC chain, a nested-Laplace node mixture, or a variational sample all answer here. For the chain-only view used by convergence diagnostics, see mcmc_draws().

Usage

posterior_sample(fit)

Arguments

fit

A tulpa_fit (or subclass) carrying posterior ⁠$draws⁠.

Details

A fit that carries no draws returns NULL with a message naming its backend, the posterior representation it carries instead, and the accessor that turns that representation into draws where one exists – an absent draws matrix is a property of the backend, not a failure of the accessor, and saying which is the difference between a diagnosable answer and a bare NULL.

Value

The posterior draws matrix/array, or NULL if the fit carries none.

See Also

mcmc_draws(), tulpa_posterior_draws(), diagnostics()

Examples


set.seed(1)
df <- data.frame(x = rnorm(80))
df$y <- rpois(80, exp(0.5 + 0.3 * df$x))
fit <- tulpa(y ~ x, data = df, family = "poisson")
dim(posterior_sample(fit))


tulpa documentation built on Oct. 19, 2026, 5:09 p.m.