Generic function to convert an object to a posterior::rvar representation.
This is typically used to convert Markov Chain Monte Carlo (MCMC) output into a more flexible and vectorized format.
Usage
as_rvar(x, ...)
# S3 method for class 'rjuliabugs'
as_rvar(x, ...)
# S3 method for class 'array'
as_rvar(x, n_mcmc = NULL, ...)Value
An object of class rvar, or an updated rjuliabugs object with params converted to rvar.
An object of class "rjuliabugs" (a named list) with the following elements:
- params
Posterior samples, converted to the requested format:
rvarforas_rvar,mcmc/mcmc.listforas_mcmc,draws_arrayforas_draws.- name
The name of the Julia sampler object.
- sampler
The sampler object returned by
AbstractMCMC.samplein Julia.- n_threads
Number of Julia threads detected.
- mcmc
A list of MCMC configuration parameters, now including
posterior_typeindicating the format ofparams.- control
Control options passed to and used by the sampler.
An object of class rvar (from the posterior package). The input 3D array
(iterations × chains × parameters) is converted into a posterior rvar object,
where each parameter is represented as a random variable across iterations and chains.
