Learn R Programming

bsvarSIGNs (version 2.0)

specify_posterior_bsvarSIGN: R6 Class Representing PosteriorBSVARSIGN

Description

The class PosteriorBSVARSIGN contains posterior output and the specification including the last MCMC draw for the Bayesian Structural VAR model with sign and narrative restrictions. Note that due to the thinning of the MCMC output the starting value in element last_draw might not be equal to the last draw provided in element posterior.

Arguments

Public fields

last_draw

an object of class BSVARSIGN with the last draw of the current MCMC run as the starting value to be passed to the continuation of the MCMC estimation using estimate().

posterior

a list containing Bayesian estimation output including: an NxNxS array B, an NxKxS array A, and a 5xS matrix hyper.

Methods


Method new()

Create a new posterior output PosteriorBSVARSIGN.

Usage

specify_posterior_bsvarSIGN$new(specification_bsvarSIGN, posterior_bsvarSIGN)

Arguments

specification_bsvarSIGN

an object of class BSVARSIGN with the last draw of the current MCMC run as the starting value.

posterior_bsvarSIGN

a list containing Bayesian estimation output collected in elements an NxNxS array B, an NxKxS array A, and a 5xS matrix hyper.

Returns

A posterior output PosteriorBSVARSIGN.


Method get_posterior()

Returns a list containing Bayesian estimation output collected in elements an NxNxS array B, an NxKxS array A, and a 5xS matrix hyper.

Usage

specify_posterior_bsvarSIGN$get_posterior()

Examples

data(optimism)
specification  = specify_bsvarSIGN$new(optimism)
set.seed(123)
estimate       = estimate(specification, 50)
estimate$get_posterior()


Method is_normalised()

Returns TRUE if the posterior has been normalised using normalise_posterior() and FALSE otherwise.

Usage

specify_posterior_bsvarSIGN$is_normalised()

Examples

data(optimism)
specification  = specify_bsvarSIGN$new(optimism)
set.seed(123)
estimate       = estimate(specification, 20)

# check normalisation status afterwards posterior$is_normalised()


Method clone()

The objects of this class are cloneable with this method.

Usage

specify_posterior_bsvarSIGN$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

See Also

estimate.BSVARSIGN, specify_bsvarSIGN

Examples

Run this code
# This is a function that is used within estimate()
data(optimism)
specification  = specify_bsvarSIGN$new(optimism, p = 4)
set.seed(123)
posterior      = estimate(specification, 50)
class(posterior)


## ------------------------------------------------
## Method `specify_posterior_bsvarSIGN$get_posterior`
## ------------------------------------------------

data(optimism)
specification  = specify_bsvarSIGN$new(optimism)
set.seed(123)
estimate       = estimate(specification, 50)
estimate$get_posterior()


## ------------------------------------------------
## Method `specify_posterior_bsvarSIGN$is_normalised`
## ------------------------------------------------

data(optimism)
specification  = specify_bsvarSIGN$new(optimism)
set.seed(123)
estimate       = estimate(specification, 20)

# check normalisation status afterwards
posterior$is_normalised()

Run the code above in your browser using DataLab