# post_normal

0th

Percentile

##### Posterior Draw from a Normal Distribution

Produces a draw of coefficients from a normal posterior density.

##### Usage
post_normal(y, x, sigma_i, a_prior, v_i_prior)
##### Arguments
y

a $K \times T$ matrix of endogenous variables.

x

an $M \times T$ matrix of explanatory variables.

sigma_i

the inverse of the $K \times K$ variance-covariance matrix.

a_prior

a $KM \times 1$ numeric vector of prior means.

v_i_prior

the inverse of the $KM \times KM$ prior covariance matrix.

##### Details

The function produces a vectorised posterior draw $a$ of the $K \times M$ coefficient matrix $A$ for the model $$y_{t} = A x_{t} + u_{t},$$ where $y_{t}$ is a K-dimensional vector of endogenous variables, $x_{t}$ is an M-dimensional vector of explanatory variabes and the error term is $u_t \sim \Sigma$.

For a given prior mean vector $\underline{a}$ and prior covariance matrix $\underline{V}$ the posterior covariance matrix is obtained by $$\overline{V} = \left[ \underline{V}^{-1} + \left(X X^{\prime} \otimes \Sigma^{-1} \right) \right]^{-1}$$ and the posterior mean by $$\overline{a} = \overline{V} \left[ \underline{V}^{-1} \underline{a} + vec(\Sigma^{-1} Y X^{\prime}) \right],$$ where $Y$ is a $K \times T$ matrix of the endogenous variables and $X$ is an $M \times T$ matrix of the explanatory variables.

A vector.

##### References

L<U+00FC>tkepohl, H. (2007). New introduction to multiple time series analysis (2nd ed.). Berlin: Springer.

• post_normal
##### Examples
# NOT RUN {
# Prepare data
data("e1")
data <- diff(log(e1))
temp <- gen_var(data, p = 2, deterministic = "const")
y <- temp$Y x <- temp$Z
k <- nrow(y)
t <- ncol(y)
m <- k * nrow(x)

# 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) / t)

# Draw parameters
a <- post_normal(y = y, x = x, sigma_i = sigma_i,
a_prior = a_mu_prior, v_i_prior = a_v_i_prior)

# }
Documentation reproduced from package bvartools, version 0.0.1, License: GPL (>= 2)

### Community examples

Looks like there are no examples yet.