add_priors.dfmodel {bvartools} | R Documentation |
Add Priors to Dynamic Factor Model
Description
Adds prior specifications to a list of models, which was produced by
function gen_dfm
.
Usage
## S3 method for class 'dfmodel'
add_priors(
object,
lambda = list(v_i = 0.01),
sigma_u = list(shape = 5, rate = 4),
a = list(v_i = 0.01),
sigma_v = list(shape = 5, rate = 4),
...
)
Arguments
object |
a list, usually, the output of a call to |
lambda |
a named list of prior specifications for the factor loadings in the measurement equation. For the default specification the diagonal elements of the inverse prior variance-covariance matrix are set to 0.01. The variances need to be specified as precisions, i.e. as inverses of the variances. |
sigma_u |
a named list of prior specifications for the error variance-covariance matrix. See 'Details'. |
a |
a named list of prior specifications for the coefficients of the transition equation. For the default specification the diagonal elements of the inverse prior variance-covariance matrix are set to 0.01. The variances need to be specified as precisions, i.e. as inverses of the variances. |
sigma_v |
a named list of prior specifications for the error variance-covariance matrix. See 'Details'. |
... |
further arguments passed to or from other methods. |
Details
Argument lambda
can only contain the element v_i
, which is a numeric specifying the prior
precision of the loading factors of the measurement equation. Default is 0.01.
The function assumes an inverse gamma prior for the errors of the measurement equation.
Argument sigma_u
can contain the following elements:
shape
a numeric or character specifying the prior shape parameter of the error terms of the measurement equation. Default is 5.
rate
a numeric specifying the prior rate parameter of the error terms of the measurement equation. Default is 4.
Argument a
can only contain the element v_i
, which is a numeric specifying the prior
precision of the coefficients of the transition equation. Default is 0.01.
The function assumes an inverse gamma prior for the errors of the transition equation.
Argument sigma_v
can contain the following elements:
shape
a numeric or character specifying the prior shape parameter of the error terms of the transition equation. Default is 5.
rate
a numeric specifying the prior rate parameter of the error terms of the transition equation. Default is 4.
Value
A list of models.
References
Chan, J., Koop, G., Poirier, D. J., & Tobias J. L. (2019). Bayesian econometric methods (2nd ed.). Cambridge: Cambridge University Press.
Lütkepohl, H. (2007). New introduction to multiple time series analysis (2nd ed.). Berlin: Springer.
Examples
# Load data
data("bem_dfmdata")
# Generate model data
model <- gen_dfm(x = bem_dfmdata, p = 1, n = 1,
iterations = 5000, burnin = 1000)
# 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))