dfmpost: Posterior Simulation for Dynamic Factor Models

View source: R/dfmpost.R

dfmpostR Documentation

Posterior Simulation for Dynamic Factor Models

Description

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

Usage

dfmpost(object)

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.

Value

An object of class "dfm".

References

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

Examples


# 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)


bvartools documentation built on Aug. 31, 2023, 1:09 a.m.