covar_vector_to_matrix | R Documentation |
Convenience function, which takes the vector of draws of lower triangular covariance coefficients and transforms it into a matrix with ones on the main diagonal. In case of time varying parameters the resulting matrix will be block diagonal.
covar_vector_to_matrix(psi, k, tt)
psi |
a |
k |
the number |
tt |
the number |
A sparse, block diagonal matrix.
Chan, J., Koop, G., Poirier, D. J., & Tobias J. L. (2019). Bayesian econometric methods (2nd ed.). Cambridge: Cambridge University Press.
Primiceri, G. E. (2005). Time varying structural vector autoregressions and monetary policy. The Review of Economic Studies 72(3), 821–852. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/j.1467-937X.2005.00353.x")}
# Create artificial data
k <- 5
tt <- 4
n_covar <- (k - 1) * k / 2
# Constant parameters
psi <- matrix(1:(n_covar))
covar_vector_to_matrix(psi, k, tt)
# Time varying parameters
psi <- matrix(1:(n_covar * tt))
covar_vector_to_matrix(psi, k, tt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.