dfm | R Documentation |
dfm
is used to create objects of class "dfm"
.
A plot function for objects of class "dfm"
.
dfm(x, lambda = NULL, fac, sigma_u = NULL, a = NULL, sigma_v = NULL)
## S3 method for class 'dfm'
plot(x, ci = 0.95, ...)
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. |
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.
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. |
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.