dfm {bvartools}R Documentation

Bayesian Dynamic Factor Model Objects

Description

dfm is used to create objects of class "dfm".

A plot function for objects of class "dfm".

Usage

dfm(x, lambda = NULL, fac, sigma_u = NULL, a = NULL, sigma_v = NULL)

## S3 method for class 'dfm'
plot(x, ci = 0.95, ...)

Arguments

x

an object of class "dfm", usually, a result of a call to dfm.

lambda

an MN \times S matrix of MCMC coefficient draws of factor loadings of the measurement equation.

fac

an NT \times S matrix of MCMC draws of the factors in the transition equation, where the first N rows correspond to the N factors in period 1 and the next N rows to the factors in period 2 etc.

sigma_u

an M \times S matrix of MCMC draws for the error variances of the measurement equation.

a

a pN^2 \times S matrix of MCMC coefficient draws of the transition equation.

sigma_v

an N \times S matrix of MCMC draws for the error variances of the transition equation.

ci

interval used to calculate credible bands.

...

further graphical parameters.

Details

The function produces a standardised object from S draws of a Gibbs sampler (after the burn-in phase) for the dynamic factor model (DFM) with measurement equation

x_t = \lambda f_t + u_t,

where x_t is an M \times 1 vector of observed variables, f_t is an N \times 1 vector of unobserved factors and \lambda is the corresponding M \times N matrix of factor loadings. u_t is an M \times 1 error term.

The transition equation is

f_t = \sum_{i=1}^{p} A_i f_{t - i} + v_t,

where A_i is an N \times N coefficient matrix and v_t is an N \times 1 error term.

Value

An object of class "dfm" containing the following components, if specified:

x

the standardised time-series object of observable variables.

lambda

an S \times MN "mcmc" object of draws of factor loadings of the measurement equation.

factor

an S \times NT "mcmc" object of draws of factors.

sigma_u

an S \times M "mcmc" object of variance draws of the measurement equation.

a

an S \times pN^2 "mcmc" object of coefficient draws of the transition equation.

sigma_v

an S \times N "mcmc" object of variance draws of the transition equation.

specifications

a list containing information on the model specification.

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)


# 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 <- draw_posterior(model)

# Plot factors
plot(object)


[Package bvartools version 0.2.4 Index]