post_normal_sur {bvartools} | R Documentation |
Posterior Draw from a Normal Distribution
Description
Produces a draw of coefficients from a normal posterior density for a model with seemingly unrelated regresssions (SUR).
Usage
post_normal_sur(y, z, sigma_i, a_prior, v_i_prior, svd = FALSE)
Arguments
y |
a |
z |
a |
sigma_i |
the inverse of the constant |
a_prior |
a |
v_i_prior |
the inverse of the |
svd |
logical. If |
Details
The function produces a posterior draw of the coefficient vector for the model
where .
is a K-dimensional vector of endogenous variables and
is a
matrix of regressors with
as a vector of regressors.
For a given prior mean vector and prior covariance matrix
the posterior covariance matrix is obtained by
and the posterior mean by
Value
A vector.
Examples
# Load data
data("e1")
data <- diff(log(e1))
# Generate model data
temp <- gen_var(data, p = 2, deterministic = "const")
y <- t(temp$data$Y)
z <- temp$data$SUR
k <- nrow(y)
tt <- ncol(y)
m <- ncol(z)
# Priors
a_mu_prior <- matrix(0, m)
a_v_i_prior <- diag(0.1, m)
# Initial value of inverse Sigma
sigma_i <- solve(tcrossprod(y) / tt)
# Draw parameters
a <- post_normal_sur(y = y, z = z, sigma_i = sigma_i,
a_prior = a_mu_prior, v_i_prior = a_v_i_prior)