Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

draw_posterior

Posterior Simulation


Description

Forwards model input to posterior simulation functions.

Usage

draw_posterior(object, FUN = NULL, mc.cores = NULL)

Arguments

object

a list of model specifications, which should be passed on to function FUN. Usually, the output of a call to gen_var, gen_vec or gen_dfm in combination with add_priors.

FUN

the function to be applied to each list element in argument object. If NULL (default), the internal functions bvarpost is used for VAR model, bvecpost for VEC models and dfmpost for dynamic factor models.

mc.cores

the number of cores to use, i.e. at most how many child processes will be run simultaneously. The option is initialized from environment variable MC_CORES if set. Must be at least one, and parallelization requires at least two cores.

Value

For multiple models a list of objects of class bvarlist. For a single model the object has the class of the output of the applied posterior simulation function. In case the package's own functions are used, this will be "bvar", "bvec" or "dfm".

Examples

# Load data 
data("e1")
e1 <- diff(log(e1)) * 100

# Generate model
model <- gen_var(e1, p = 1:2, deterministic = 2,
                 iterations = 100, burnin = 10)
# Chosen number of iterations and burn-in should be much higher.

# Add priors
model <- add_priors(model)

# Obtain posterior draws
object <- draw_posterior(model)

bvartools

Bayesian Inference of Vector Autoregressive Models

v0.2.0
GPL (>= 2)
Authors
Franz X. Mohr [aut, cre]
Initial release
2021-04-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.