Learn R Programming

bvartools (version 0.2.4)

dfmpost: Posterior Simulation for Dynamic Factor Models

Description

Produces draws from the posterior distributions of Bayesian dynamic factor models.

Usage

dfmpost(object)

Value

An object of class "dfm".

Arguments

object

an object of class "dfmodel", usually, a result of a call to gen_dfm in combination with add_priors.

Details

The function implements the posterior simulation algorithm for Bayesian dynamic factor models.

The implementation follows the description in Chan et al. (2019) and C++ is used to reduce calculation time.

References

Chan, J., Koop, G., Poirier, D. J., & Tobias J. L. (2019). Bayesian econometric methods (2nd ed.). Cambridge: Cambridge University Press.

Examples

Run this code

# Load data
data("bem_dfmdata")

# Generate model data
model <- gen_dfm(x = bem_dfmdata, p = 1, n = 1,
                 iterations = 20, burnin = 10)
# Number of iterations and burnin should be much higher.

# Add prior specifications
model <- add_priors(model,
                    lambda = list(v_i = .01),
                    sigma_u = list(shape = 5, rate = 4),
                    a = list(v_i = .01),
                    sigma_v = list(shape = 5, rate = 4))

# Obtain posterior draws
object <- dfmpost(model)

Run the code above in your browser using DataLab