Bayesian Structural Vector Autoregressions

by Tomasz Woźniak

\[ \]

Structural Vector Autoregressions

Identification of Structural VARs

Dynamic Causal Effects

Bayesian Estimation

Monetary Policy Analysis Using the bsvars Package

Materials

\[ \]

Lecture Slides as a Website

R script for your own Australian monetary policy analysis

GitHub repo to reproduce the slides and results

Tasks

Structural Vector Autoregressions

Structural Vector Autoregressions

  • go-to models for the analysis of policy effects
  • facilitate the analysis of dynamic causal effects of a well-isolated cause
  • extensively used for: monetary and fiscal policy, financial markets, …
  • relatively simple to work with data and provide empirical evidence on the propagation of shocks through economies and markets
  • provide data-driven stylised facts to be incorporated in theoretical model
  • require identification of the cause of the dynamic effects
  • extendible: featuring many variations in specification
    • non-normality
    • heteroskedasticity
    • time-varying parameters
    • Bayesian
  • Proposed by Sims (1980)

Structural Vector Autoregressions

The model.

\[\begin{align} \text{VAR equation: }&& y_t &= \mathbf{A}_1 y_{t-1} + \dots + \mathbf{A}_p y_{t-p} + \boldsymbol\mu_0 + \epsilon_t\\[1ex] \text{structural equation: }&& \mathbf{B}\epsilon_t &= u_t\\[1ex] \text{structural shocks: }&& u_t |Y_{t-1} &\sim N_N\left(\mathbf{0}_N,\mathbf{I}_N\right) \end{align}\]

Notation.

  • \(\mathbf{B}\) - \(N\times N\) structural matrix of contemporaneous relationships

  • \(u_t\) - \(N\)-vector of structural shocks at time \(t\)

    Isolating these shocks allows us to identify dynamic effects of uncorrelated shocks on variables \(y_t\)

  • \(\epsilon_t\) - \(N\)-vector with error terms at time \(t\)

  • the rest as in the lecture on Bayesian VARs

Structural Vector Autoregressions

The VAR errors.

\[\begin{align} &&&\\ \text{structural equation: }&& \epsilon_t &= \mathbf{B}^{-1}u_t = \mathbf{\Theta}_0 u_t\\[1ex] \text{error terms: }&& \epsilon_t |Y_{t-1} &\sim N_N\left(\mathbf{0}_N,\Sigma\right)\\[1ex] \text{covariance: }&& \mathbf\Sigma &= \mathbf{B}^{-1}\mathbf{B}^{-1\prime} = \Theta_0\Theta_0' \end{align}\]

Notation.

  • \(\mathbf\Sigma\) - \(N\times N\) covariance matrix of error terms
  • \(\Theta_0 = \mathbf{B}^{-1}\) - \(N\times N\) matrix of contemporaneous effects

Structural Vector Autoregressions

Plug the VAR equation into the structural equation to obtain:

\[\begin{align} \mathbf{B}y_t &= \mathbf{B}\mathbf{A}_1 y_{t-1} + \dots + \mathbf{B}\mathbf{A}_p y_{t-p} + \mathbf{B}\boldsymbol\mu_0 + u_t\\[1ex] &\\ \end{align}\]

Contemporaneous relationships.

Let \(N=2\)

\[\begin{align} \mathbf{B}y_t &= \begin{bmatrix}B_{11}&B_{12}\\B_{21}&B_{22}\end{bmatrix}\begin{bmatrix}y_{1t}\\y_{2t}\end{bmatrix} \end{align}\]

Structural Vector Autoregressions

Plug the structural equation for \(\epsilon_t\) into the VAR equation to obtain:

\[\begin{align} y_t &= \mathbf{A}_1 y_{t-1} + \dots + \mathbf{A}_p y_{t-p} + \boldsymbol\mu_0 + \mathbf{B}^{-1}u_t\\[1ex] y_t &= \mathbf{A}_1 y_{t-1} + \dots + \mathbf{A}_p y_{t-p} + \boldsymbol\mu_0 + \mathbf{\Theta}_0 u_t \end{align}\]

Contemporaneous effects.

Let \(N=2\)

\[\begin{align} \begin{bmatrix}y_{1t}\\y_{2t}\end{bmatrix} &= \dots + \begin{bmatrix}\Theta_{11}&\Theta_{12}\\\Theta_{21}&\Theta_{22}\end{bmatrix}\begin{bmatrix}u_{1t}\\ u_{2t}\end{bmatrix} \end{align}\]

Task.

What is the contemporaneous effect of the first shock on the second variable?

Identification of Structural VARs

Identification of SVARs (Simplified)

Covariance and structural relationships.

\[\begin{align} &\\ \mathbf\Sigma &= \mathbf{B}^{-1}\mathbf{B}^{-1\prime}\\[1ex] \end{align}\]

  • \(\mathbf\Sigma\) can be estimated using data easily
  • The relationship presents a system of equations to be solved for \(\mathbf{B}\)
  • \(\mathbf\Sigma\) is a symmetric \(N\times N\) matrix
  • \(\mathbf\Sigma\) has \(N(N+1)/2\) unique elements given equations
  • \(\mathbf{B}\) is an \(N\times N\) matrix with \(N^2\) unique elements to estimate
  • We cannot estimate all elements of \(\mathbf{B}\) using \(N(N+1)/2\) equations
  • \(\mathbf{B}\) is not identified

Identification of SVARs (Simplified)

Covariance and structural relationships.

\[\begin{align} &\\ \mathbf\Sigma &= \mathbf{B}^{-1}\mathbf{B}^{-1\prime}\\[1ex] \end{align}\]

Identification.

  • Only \(N(N+1)/2\) elements in \(\mathbf{B}\) can be estimated
  • Impose \(N(N-1)/2\) restrictions on \(\mathbf{B}\) to solve the equation
  • This identifies the rows of \(\mathbf{B}\) (and the columns of \(\mathbf\Theta_0\)) up to a sign
  • Change the sign of any number of \(\mathbf{B}\) rows and \(\mathbf\Sigma\) will not change
  • Often \(\mathbf{B}\) is made lower-triangular

Identification of SVARs (Simplified)

Covariance and structural relationships.

Let \(N=2\)

\[\begin{align} \begin{bmatrix}\sigma_1^2&\sigma_{12}\\ \sigma_{12}&\sigma_2^2\end{bmatrix} &\qquad \begin{bmatrix}B_{11}&B_{12}\\ B_{21}&B_{22}\end{bmatrix}\\[1ex] \end{align}\]

  • 3 unique elements in \(\mathbf\Sigma\) - 3 equations in the system
  • 4 elements in \(\mathbf{B}\) cannot be estimated

Identification.

\[\begin{align} \begin{bmatrix}\sigma_1^2&\sigma_{12}\\ \sigma_{12}&\sigma_2^2\end{bmatrix} &\qquad \begin{bmatrix}B_{11}& 0\\ B_{21}&B_{22}\end{bmatrix}\\[1ex] \end{align}\]

  • 3 equations identify 3 elements in \(\mathbf{B}\)

Identification of Monetary Policy Shock

Consider a system of four variables:

\[\begin{align} y_t = \begin{bmatrix} \Delta rgdp_t & \pi_t & cr_t & \Delta rtwi_t \end{bmatrix}' \end{align}\]

  • \(\Delta rgdp_t\) - real Gross Domestic Product growth
  • \(\pi_t\) - Consumer Price Index inflation
  • \(cr_t\) - Cash Rate Target - Australian nominal interest rate
  • \(\Delta rtwi_t\) - real Trade-Weighted Index rate of return (exchange rate)

Identified system.

A lower-triangular matrix identifies:

  • contemporaneous relationships \(\mathbf{B}\)
  • contemporaneous effects \(\mathbf\Theta_0\)
  • structural shocks \(u_t\)

Identification of Monetary Policy Shock

Identified system.

\[\begin{align} \begin{bmatrix} B_{11}&0&0&0\\ B_{21}&B_{22}&0&0\\ B_{31}&B_{32}&B_{33}&0\\ B_{41}&B_{42}&B_{43}&B_{44} \end{bmatrix} \begin{bmatrix} \Delta rgdp_t \\ \pi_t \\ cr_t \\ \Delta rtwi_t \end{bmatrix} &= \dots + \begin{bmatrix} u_t^{ad} \\ u_t^{as} \\ u_t^{mps} \\ u_t^{ex} \end{bmatrix} \end{align}\]

Identified shocks.

\(u_t^{ad}\) - aggregate demand shock is exogenous to the rest of the system

\(u_t^{as}\) - aggregate supply shock

\(u_t^{mps}\) - monetary policy shock identified via Taylor’s Rule

\(u_t^{ex}\) - currency shock

Identification of Monetary Policy Shock

Identified system.

\[\begin{align} \begin{bmatrix} B_{11}&0&0&0\\ B_{21}&B_{22}&0&0\\ B_{31}&B_{32}&B_{33}&0\\ B_{41}&B_{42}&B_{43}&B_{44} \end{bmatrix} \begin{bmatrix} \Delta rgdp_t \\ \pi_t \\ cr_t \\ \Delta rtwi_t \end{bmatrix} &= \dots + \begin{bmatrix} u_t^{ad} \\ u_t^{as} \\ u_t^{mps} \\ u_t^{ex} \end{bmatrix} \end{align}\]

Tasks.

  • Write out the third equation for the cash rate.
  • Let \(B_{33}>0\). What values of \(B_{31}\) and \(B_{32}\) does theory imply?

Identification of Monetary Policy Shock

Identified system.

\[\begin{align} \begin{bmatrix} B_{11}&0&0&0\\ B_{21}&B_{22}&0&0\\ B_{31}&B_{32}&B_{33}&0\\ B_{41}&B_{42}&B_{43}&B_{44} \end{bmatrix} \begin{bmatrix} \Delta rgdp_t \\ \pi_t \\ cr_t \\ \Delta rtwi_t \end{bmatrix} &= \dots + \begin{bmatrix} u_t^{ad} \\ u_t^{as} \\ u_t^{mps} \\ u_t^{ex} \end{bmatrix} \end{align}\]

Monetary policy shock.

  • is uncorrelated with any other shocks
  • consists of the unanticipated part of the monetary policy instrument, interest rate
  • In this model, the systematic part of the monetary policy consists of:
    • contemporaneous relationships with GDP and inflation
    • lagged relationships with all variables

Alternative Identification

Identified system.

\[\begin{align} \begin{bmatrix} B_{11}&B_{12}&B_{13}&B_{14}\\ B_{21}&B_{22}&B_{23}&B_{24}\\ B_{31}&B_{32}&B_{33}&B_{34}\\ B_{41}&B_{42}&B_{43}&B_{44} \end{bmatrix} \begin{bmatrix} \Delta rgdp_t \\ \pi_t \\ cr_t \\ \Delta rtwi_t \end{bmatrix} &= \dots + \begin{bmatrix} u_t^{ad} \\ u_t^{as} \\ u_t^{mps} \\ u_t^{ex} \end{bmatrix} \end{align}\]

Identification.

Assume the structural shocks are: \[\begin{align} \text{heteroskedastic: }&& u_t^{(i)}\mid\mathbf{Y}_{t-1} &\sim N(0,\sigma_{i.t}^2) \\ \text{non-normal: }&& u_t^{(i)}\mid\mathbf{Y}_{t-1} &\sim t(0,1, \nu_i) \\ \end{align}\]

Alternative Identification

Dynamic Causal Effects

Dynamic Causal Effects

Impulse response functions

Impulse response functions to orthogonal shocks computed for an empirically relevant SVAR model are considered the dynamic causal effects of the underlying shocks \(u_t\) on economic measurements \(y_{t+i}\) \(i\) periods ahead.

\[\begin{align*} \frac{\partial y_{n.t+i}}{\partial u_{j.t}}&=\theta_{nj.i} \end{align*}\]

  • \(\theta_{nj.i}\) - response of \(n\)th variable to \(j\)th shock \(i\) periods after shock’s occurrence

    for \(i=0,1,\dots,h\) and \(n,j=1,\dots,N\)

Dynamic Causal Effects

Impulse response functions

Impulse response functions to orthogonal shocks computed for an empirically relevant SVAR model are considered the dynamic causal effects of the underlying shocks \(u_t\) on economic measurements \(y_{t+i}\) \(i\) periods ahead.

\[\begin{align*} \frac{\partial y_{t+i}}{\partial u_t}&=\underset{N\times N}{\mathbf\Theta_i} \end{align*}\]

  • \(\mathbf\Theta_i\) - responses of all of the variables to all of the shocks \(i\) periods after shocks’ occurrence

    for \(i=0,1,\dots,h\) and \(n,j=1,\dots,N\)

Dynamic Causal Effects

Impulse response functions at finite horizon.

Define matrices

\[ \underset{(pN\times pN)}{\mathbb{A}} = \begin{bmatrix}\mathbf{A}_1 & \mathbf{A}_2 &\dots& \mathbf{A}_p\\ &\mathbf{I}_{N(p-1)}&&\mathbf{0}_{N(p-1)\times N} \end{bmatrix}\quad\text{and}\quad \underset{(N\times pN)}{\mathbf{J}} = \begin{bmatrix} \mathbf{I}_{N} & \mathbf{0}_{N\times N(p-1)} \end{bmatrix} \] Impulse response at horizon \(i=0,1,\dots,h\) are equal to:

\[\begin{align} \mathbf\Theta_i &= \mathbf{J}\mathbb{A}^i\mathbf{J}'\mathbf{\Theta}_0 \end{align}\] where \(\mathbb{A}^0=\mathbf{I}_N\), \(\mathbb{A}^1=\mathbb{A}\), \(\mathbb{A}^2=\mathbb{A}\mathbb{A}\), …

At infinite horizon.

Inform about the value of the effect in the long run.

\[\begin{align} \mathbf\Theta_{\infty} &= \left( \mathbf{I}_N - \mathbf{A}_1 - \dots - \mathbf{A}_p \right)^{-1}\mathbf{\Theta}_0 \end{align}\]

Dynamic Causal Effects

Tasks.

Consider a bivariate (\(N=2\)) Structural VAR model with \(p=1\) lag and no constant term: \[\begin{align} y_t &= \mathbf{A}y_{t-1} + \epsilon_t\\ \mathbf{B}\epsilon_t &= u_t \end{align}\]

Derive:

  • on impact impulse response, \(\mathbf\Theta_0\)
  • impulse response at horizon 1, \(\mathbf\Theta_1\)

Dynamic Causal Effects

Bayesian Estimation.

Step 1. Estimate the model

Obtain a sample from the posterior distribution \[\left\{ \mathbf{A}^{(s)},\mathbf{B}^{(s)} \right\}_{s=1}^{S}\]

Step 2. Compute impulse responses

For each of the \(S\) draws, compute impulse responses \(\mathbf\Theta_0^{(s)}, \dots, \mathbf\Theta_h^{(s)}\) as a function of \(\mathbf{A}^{(s)}\) and \(\mathbf{B}^{(s)}\) and return \[\left\{\mathbf\Theta_0^{(s)}, \dots, \mathbf\Theta_h^{(s)}\right\}_{s=1}^{S}\] as a sample drew from the posterior distribution the impulse responses.

Bayesian Estimation

Bayesian Estimation

\(\left.\right.\)

Gibbs sampler by Waggoner & Zha (2003)

facilitates estimation of Bayesian SVARs for

  • lower-triangular and non-recursive identification patterns of exclusion restrictions
  • over-identifying (more than \(N(N − 1)/2)\) exclusion restrictions
  • models identified via heteroskedasticity and non-normality

\(\left.\right.\)

Other approaches facilitate estimation of SVARs

  • identified through non-normal residuals
  • identified by zero and sign restrictions
  • identified using instrumental variables (Proxy SVARs)

Bayesian Estimation

Exclusion restrictions on the rows of \(\mathbf{B}\)

\[ \underset{(1\times N)}{\mathbf{B}_{[n\cdot]}} = \underset{(1\times r_n)}{\mathbf{b}_n} \underset{(r_n\times N)}{V_n} \qquad\text{such that}\qquad \mathbf{B} = \begin{bmatrix} \mathbf{b}_1V_1\\ \vdots \\ \mathbf{b}_NV_N \end{bmatrix} \]

  • \(\mathbf{b}_n\) - a \(1\times r_n\) vector of unrestricted elements of \(n\) row of \(\mathbf{B}\)
  • \(V_n\) - an \(r_n\times N\) fixed matrix of ones and zeros

Example.

\[\mathbf{b}_n = \begin{bmatrix} b_1 & b_2\end{bmatrix}\quad V_n = \begin{bmatrix} 1&0&0\\0&0&1\end{bmatrix} \quad\rightarrow\quad \mathbf{B}_{[n\cdot]} = \begin{bmatrix} b_1&0 & b_2\end{bmatrix} \]

Bayesian Estimation

The \(n\)th Structural Equation.

\[\begin{align*} \mathbf{b}_nV_n\epsilon_t &= u_{n.t}\\ u_{n.t} &\sim N(0,1) \end{align*}\]

Matrix Notation.

\[\begin{align*} E V_n' \mathbf{b}_n' &= U_n\\ U_n &\sim N_T\left(\mathbf{0}_T,I_T\right)\\[2ex] \underset{(T\times1)}{U_n} &= \begin{bmatrix} u_{n.1} & \dots & u_{n.T} \end{bmatrix}'\\ \underset{(T\times N)}{E} &\text{ - defined as before} \end{align*}\]

Bayesian Estimation

Likelihood function.

\[\begin{align*} L(\mathbf{A},\mathbf{B}|Y,X) &\propto |\text{det}\left( \mathbf{B} \right)|^{T}\exp\left\{ -\frac{1}{2}\sum_{n=1}^N \mathbf{b}_nV_nE'EV_n'\mathbf{b}_n' \right\}\\[1ex] E &= Y - X\mathbf{A} \end{align*}\]

Hierarchical prior for \(\mathbf{B}\)

\[\begin{align*} \mathbf{b}_n | \gamma_B &\sim N_{r_n}\left(\mathbf{0}_{r_n}, \gamma_B V_n\underline{S}^{-1}V_n'\right)\\[1ex] \gamma_B &\sim IG2(\underline{s},\underline{\nu}) \end{align*}\]

  • \(\underline{S}\) - \(N\times N\) prior scale matrix
  • \(\underline{s}\) and \(\underline{\nu}\) positive scalars of scale and shape

Bayesian Estimation

Kernel of the full conditional posterior for \(\mathbf{B}\)

\[\begin{align*} p(\mathbf{B}|Y,X,\mathbf{A}, \gamma_B)&\propto |\text{det}\left( \mathbf{B} \right)|^{T}\exp\left\{ -\frac{1}{2}\sum_{n=1}^N \mathbf{b}_n \overline{S}_n^{-1}\mathbf{b}_n' \right\}\\[1ex] \overline{S}_n^{-1} &= V_n\left[ \gamma_B^{-1}\underline{S}^{-1} + (Y-X\mathbf{A})'(Y-X\mathbf{A}) \right]V_n'\\[2ex] \end{align*}\]

  • This is a kernel of a Generalised-Normal distribution
  • A feasible Gibbs sampler was proposed by by Waggoner & Zha (2003)
  • The Gibbs sampler draws from the full conditional posterior for \(n = 1,\dots,N\): \[ p(\mathbf{b}_n | \mathbf{b}_1,\dots, \mathbf{b}_{n-1},\mathbf{b}_{n+1}, \mathbf{b}_N, \mathbf{A}, \gamma_B, Y, X) \]

Monetary Policy Analysis Using R Package bsvars

bsvars an R Package

bsvars an R Package: Features

  • Bayesian estimation of Structural VARs
  • identification via:
    • exclusion restrictions
    • heteroskedasticity
    • non-normality
  • six heteroskedastic processes
  • efficient and fast Gibbs sampler
  • excellent computational speed
    • frontier econometric techniques
    • compiled code using C++
  • data analysis in R

bsvars an R Package: Features

bsvars an R Package: Features

  • simple model setup using specify_*()
  • flexibility in setting priors, restrictions, etc.
  • one function for estimation estimate()
  • posterior processing utility functions

The simplest workflow using pipe.

library(bsvars)

data(us_fiscal_lsuw)
set.seed(1)

us_fiscal_lsuw |>
  specify_bsvar_sv$new(p = 2) |>
  estimate(S = 1000) |>
  estimate(S = 5000) |>
  compute_impulse_responses(horizon = 8) -> irfs

Australian Monetary Policy Analysis

Based on Turnip (2017)

System of four variables.

\[\begin{align} y_t = \begin{bmatrix} \Delta rgdp_t & \pi_t & cr_t & \Delta rtwi_t \end{bmatrix}' \end{align}\]

Alternative identification patterns.

\[\begin{align} \textbf{lower-triangular} && \textbf{extended}\\ \begin{bmatrix} B_{11}&0&0&0\\ B_{21}&B_{22}&0&0\\ B_{31}&B_{32}&B_{33}&0\\ B_{41}&B_{42}&B_{43}&B_{44} \end{bmatrix} \begin{bmatrix} \Delta rgdp_t \\ \pi_t \\ cr_t \\ \Delta rtwi_t \end{bmatrix} && \begin{bmatrix} B_{11}&0&0&0\\ B_{21}&B_{22}&0&0\\ B_{31}&B_{32}&B_{33}&B_{34}\\ B_{41}&B_{42}&B_{43}&B_{44} \end{bmatrix} \begin{bmatrix} \Delta rgdp_t \\ \pi_t \\ cr_t \\ \Delta rtwi_t \end{bmatrix} \end{align}\]

  • In the extended model, the monetary policy shock is not identified
  • Use identification via heteroskedasticity to identify it

Four-Variable Monetary System

# Gross domestic product (GDP); Chain volume
rgdp_dwnld      = readrba::read_rba(series_id = "GGDPCVGDP")
rgdp_tmp        = xts::xts(rgdp_dwnld$value, rgdp_dwnld$date, tclass = 'yearqtr')
drgdp           = na.omit(400 * diff(log(rgdp_tmp)))
drgdp           = xts::to.quarterly(drgdp, OHLC = FALSE)

# Consumer price index; All groups; Quarterly change (in per cent)
picpi_dwnld     = readrba::read_rba(series_id = "GCPIAGSAQP")
pi              = 4 * xts::xts(picpi_dwnld$value, picpi_dwnld$date, tclass = 'yearqtr')
pi              = xts::to.quarterly(pi, OHLC = FALSE)

# Interbank Overnight Cash Rate
cr_dwnld        = readrba::read_rba(series_id = "FIRMMCRID")   # Cash Rate Target
cr_tmp          = xts::xts(cr_dwnld$value, cr_dwnld$date)
cr              = xts::to.quarterly(cr_tmp, OHLC = FALSE)

# Real Trade-Weighted Index
rtwi_dwnld      = readrba::read_rba(series_id = "FRERTWI")
rtwi_tmp        = xts::xts(rtwi_dwnld$value, rtwi_dwnld$date, tclass = 'yearqtr')
rtwi            = 100 * na.omit(diff(log(rtwi_tmp)))
drtwi            = xts::to.quarterly(rtwi, OHLC = FALSE)

y               = na.omit(merge(drgdp, pi, cr, drtwi))
plot(y, main = "Australian monetary system",
     legend.loc = "bottomleft", col = c("#FF00FF","#990099","#ff69b4","#330033"))

Four-Variable Monetary System

Estimation Setup

# setup
############################################################
library(bsvars)
set.seed(123)

N       = ncol(y)
p       = 9
S_burn  = 1e4
S       = 2e4
thin    = 2

Extended Model Identification Setup

# structural matrix - extended model
############################################################
B_LR = matrix(TRUE, N, N)
B_LR[upper.tri(B_LR)] = FALSE
B_LR[3,4] = TRUE
B_LR
     [,1]  [,2]  [,3]  [,4]
[1,] TRUE FALSE FALSE FALSE
[2,] TRUE  TRUE FALSE FALSE
[3,] TRUE  TRUE  TRUE  TRUE
[4,] TRUE  TRUE  TRUE  TRUE

Alternative Models Estimation

Lower-triangular model with zero prior mean for \(\mathbf{A}\).

# estimation - lower-triangular model
############################################################
spec_bsvar0     = specify_bsvar$new(as.matrix(y), p = p, stationary = rep(TRUE, N))
spec_bsvar0 |>
  estimate(S = S_burn) |>
  estimate(S = S, thin = thin) -> soe_bsvar0
**************************************************|
bsvars: Bayesian Structural Vector Autoregressions|
**************************************************|
 Gibbs sampler for the SVAR model                 |
**************************************************|
 Progress of the MCMC simulation for 10000 draws
    Every draw is saved via MCMC thinning
 Press Esc to interrupt the computations
**************************************************|
**************************************************|
bsvars: Bayesian Structural Vector Autoregressions|
**************************************************|
 Gibbs sampler for the SVAR model                 |
**************************************************|
 Progress of the MCMC simulation for 20000 draws
    Every 2nd draw is saved via MCMC thinning
 Press Esc to interrupt the computations
**************************************************|

Alternative Models Estimation

Lower-triangular model with MLE prior mean for \(\mathbf{A}\).

# estimation - lower-triangular model - MLE prior for A
############################################################
spec_bsvar      = specify_bsvar$new(as.matrix(y), p = p, stationary = rep(TRUE, N))

A_mle           = t(solve(
  tcrossprod(spec_bsvar$data_matrices$X),
  tcrossprod(spec_bsvar$data_matrices$X, spec_bsvar$data_matrices$Y)
))
spec_bsvar$prior$A = A_mle

spec_bsvar |>
  estimate(S = S_burn) |>
  estimate(S = S, thin = thin) -> soe_bsvar
**************************************************|
bsvars: Bayesian Structural Vector Autoregressions|
**************************************************|
 Gibbs sampler for the SVAR model                 |
**************************************************|
 Progress of the MCMC simulation for 10000 draws
    Every draw is saved via MCMC thinning
 Press Esc to interrupt the computations
**************************************************|
**************************************************|
bsvars: Bayesian Structural Vector Autoregressions|
**************************************************|
 Gibbs sampler for the SVAR model                 |
**************************************************|
 Progress of the MCMC simulation for 20000 draws
    Every 2nd draw is saved via MCMC thinning
 Press Esc to interrupt the computations
**************************************************|

Alternative Models Estimation

Extended model with MLE prior mean for \(\mathbf{A}\).

# estimation - extended model - MLE prior for A
############################################################
spec_bsvar_lr   = specify_bsvar$new(as.matrix(y), p = p, B = B_LR, stationary = rep(TRUE, N))
spec_bsvar_lr$prior$A = A_mle

spec_bsvar_lr |>
  estimate(S = S_burn) |>
  estimate(S = S, thin = thin) -> soe_bsvar_lr
**************************************************|
bsvars: Bayesian Structural Vector Autoregressions|
**************************************************|
 Gibbs sampler for the SVAR model                 |
**************************************************|
 Progress of the MCMC simulation for 10000 draws
    Every draw is saved via MCMC thinning
 Press Esc to interrupt the computations
**************************************************|
**************************************************|
bsvars: Bayesian Structural Vector Autoregressions|
**************************************************|
 Gibbs sampler for the SVAR model                 |
**************************************************|
 Progress of the MCMC simulation for 20000 draws
    Every 2nd draw is saved via MCMC thinning
 Press Esc to interrupt the computations
**************************************************|

Alternative Models Estimation

Lower-triangular model with Stochastic Volatility heteroskedastisity.

# estimation - lower-triangular SV heteroskedastic model
############################################################
spec_bsvar_sv = specify_bsvar_sv$new(as.matrix(y), p = p, stationary = rep(TRUE, N))
spec_bsvar_sv$prior$A = A_mle

spec_bsvar_sv |>
  estimate(S = S_burn) |>
  estimate(S = S, thin = thin) -> soe_bsvar_sv
**************************************************|
bsvars: Bayesian Structural Vector Autoregressions|
**************************************************|
 Gibbs sampler for the SVAR-SV model              |
   Non-centred SV model is estimated              |
**************************************************|
 Progress of the MCMC simulation for 10000 draws
    Every draw is saved via MCMC thinning
 Press Esc to interrupt the computations
**************************************************|
**************************************************|
bsvars: Bayesian Structural Vector Autoregressions|
**************************************************|
 Gibbs sampler for the SVAR-SV model              |
   Non-centred SV model is estimated              |
**************************************************|
 Progress of the MCMC simulation for 20000 draws
    Every 2nd draw is saved via MCMC thinning
 Press Esc to interrupt the computations
**************************************************|

Alternative Models Estimation

Extended model with Stochastic Volatility heteroskedastisity.

# estimation - extended SV heteroskedastic model
############################################################
spec_bsvar_lr_sv = specify_bsvar_sv$new(as.matrix(y), p = p, B = B_LR, stationary = rep(TRUE, N))
spec_bsvar_lr_sv$prior$A = A_mle

spec_bsvar_lr_sv |>
  estimate(S = S_burn) |>
  estimate(S = S, thin = thin) -> soe_bsvar_lr_sv
**************************************************|
bsvars: Bayesian Structural Vector Autoregressions|
**************************************************|
 Gibbs sampler for the SVAR-SV model              |
   Non-centred SV model is estimated              |
**************************************************|
 Progress of the MCMC simulation for 10000 draws
    Every draw is saved via MCMC thinning
 Press Esc to interrupt the computations
**************************************************|
**************************************************|
bsvars: Bayesian Structural Vector Autoregressions|
**************************************************|
 Gibbs sampler for the SVAR-SV model              |
   Non-centred SV model is estimated              |
**************************************************|
 Progress of the MCMC simulation for 20000 draws
    Every 2nd draw is saved via MCMC thinning
 Press Esc to interrupt the computations
**************************************************|

IRFs: Compute impulse responses

ir_bsvar0       = compute_impulse_responses(soe_bsvar0, horizon = 20)
ir_bsvar0[,3,,] = 0.25 * ir_bsvar0[,3,,] / mean(ir_bsvar0[3,3,1,])

ir_bsvar        = compute_impulse_responses(soe_bsvar, horizon = 20)
ir_bsvar[,3,,]  = 0.25 * ir_bsvar[,3,,] / mean(ir_bsvar[3,3,1,])

ir_bsvar_lr        = compute_impulse_responses(soe_bsvar_lr, horizon = 20)
ir_bsvar_lr[,3,,]  = 0.25 * ir_bsvar_lr[,3,,] / mean(ir_bsvar_lr[3,3,1,])

ir_bsvar_sv        = compute_impulse_responses(soe_bsvar_sv, horizon = 20)
ir_bsvar_sv[,3,,]  = 0.25 * ir_bsvar_sv[,3,,] / mean(ir_bsvar_sv[3,3,1,])

ir_bsvar_lr_sv        = compute_impulse_responses(soe_bsvar_lr_sv, horizon = 20)
ir_bsvar_lr_sv[,3,,]  = 0.25 * ir_bsvar_lr_sv[,3,,] / mean(ir_bsvar_lr_sv[3,3,1,])

IRFs: Zero vs. MLE prior mean

IRFs: Recursive vs. Extended (homosk)

IRFs: Homosk vs. SV (Recursive)

IRFs: Homosk vs. SV (Extended)

SDs: homoskedastic vs. SV (Recursive)

SDs: homoskedastic vs. SV (Extended)