Learn R Programming

BVAR (version 0.2.2)

as.mcmc.bvar: Method for coda Markov chain Monte Carlo objects

Description

Method to convert chains of hyperparameters and marginal likelihoods obtained from bvar or coefficent values to objects compatible for further processing with coda, i.e., objects of class mcmc or mcmc.list. Multiple chains, that is comparable bvar objects may be converted using the chains argument.

Usage

as.mcmc.bvar(
  x,
  vars = NULL,
  vars_response = NULL,
  vars_impulse = NULL,
  chains = list(),
  ...
)

Arguments

x

A bvar object, obtained from bvar.

vars

Optional character vector used to subset the converted hyperparameters. The elements need to match the names of hyperparameters (plus "ml"). Defaults to NULL, i.e. all variables.

vars_response, vars_impulse

Optional integer vector with the positions of coefficient values to convert. vars_response corresponds to a specific dependent variable, vars_impulse to an independent one. Note that the constant is found at position one.

chains

List with additional bvar objects. If provided, contents are converted to an object of class mcmc.list.

...

Other parameters for as.mcmc and as.mcmc.list.

See Also

bvar; mcmc

Examples

Run this code
# NOT RUN {
library("coda")

data <- matrix(rnorm(200), ncol = 2)
x <- bvar(data, lags = 2)
y <- bvar(data, lags = 2)

# Convert hyperparameter lambda and the marginal likelihood
as.mcmc(x, vars = c("ml", "lambda"))

# Add second chain for further processing
as.mcmc(x, vars = c("ml", "lambda"), chains = list(y = y))
# }

Run the code above in your browser using DataLab