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 |
lambda |
an |
fac |
an |
sigma_u |
an |
a |
a |
sigma_v |
an |
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
where
is an
vector of observed variables,
is an
vector of unobserved factors and
is the corresponding
matrix of factor loadings.
is an
error term.
The transition equation is
where
is an
coefficient matrix and
is an
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 |
factor |
an |
sigma_u |
an |
a |
an |
sigma_v |
an |
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)