-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.qmd
1316 lines (882 loc) · 33.3 KB
/
index.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Lecture 8: Bayesian Structural Vector Autoregressions"
author: "by Tomasz Woźniak"
email: "tomasz.wozniak@unimelb.edu.au"
title-slide-attributes:
data-background-color: "#9933FF"
number-sections: false
format:
revealjs:
theme: [simple, theme.scss]
slide-number: c
transition: concave
smaller: true
multiplex: true
execute:
echo: true
---
## {background-color="#9933FF"}
$$ $$
### Structural Vector Autoregressions
### Identification of Structural VARs
### Dynamic Causal Effects
### Bayesian Estimation
### Monetary Policy Analysis Using the [bsvars](https://cran.r-project.org/package=bsvars) Package
## Materials {background-color="#9933FF"}
$$ $$
### Lecture Slides [as a Website](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
### Quarto [document template](https://github.com/Bayesian-Econometrics-2023/be23-lecture8/blob/main/be23-lecture8.qmd) for your own Australian monetary policy analysis
### GitHub [repo](https://github.com/Bayesian-Econometrics-2023/be23-lecture8) to reproduce the slides and results
### Tasks
## Structural Vector Autoregressions {background-color="#9933FF"}
## Structural Vector Autoregressions
- go-to models for the analysis of policy effects
::: incremental
- 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)](https://doi.org/10.2307/1912017)
:::
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
## Structural Vector Autoregressions
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### 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}
::: {.fragment}
### 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 VAR errors at time $t$
- the rest as in [Lecture 7: Bayesian VARs](https://bayesian-econometrics-2023.github.io/be23-lecture7/#/varp-model)
:::
## Structural Vector Autoregressions
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### The VAR errors.
\begin{align}
&&&\\
\text{structural equation: }&& \epsilon_t &= \mathbf{B}^{-1}u_t\\[1ex]
\text{structural shocks: }&& \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 VAR errors
- $\Theta_0 = \mathbf{B}^{-1}$ - $N\times N$ matrix of **contemporaneous effects**
## Structural Vector Autoregressions
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
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
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
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 {background-color="#9933FF"}
## Identification of SVARs (Simplified)
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### 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
::: incremental
- 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 <text style="color:#9933FF;">**not identified**</text>
:::
## Identification of SVARs (Simplified)
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### 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)
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### 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
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
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
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### 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
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### 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
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### 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 shock
- consists of the unanticipated (unpredictable) 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
## Identification via Heteroskedasticity
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
Suppose that:
- there are two covariances, $\mathbf\Sigma_1$ and $\mathbf\Sigma_2$, associated with the sample
- matrix $\mathbf{B}$ does not change over time
- structural shocks are heteroskedastic with covariances $\text{diag}\left(\boldsymbol\sigma_1^2\right)$ and $\text{diag}\left(\boldsymbol\sigma_2^2\right)$
\begin{align}
\mathbf\Sigma_1 &= \mathbf{B}^{-1}\text{diag}\left(\boldsymbol\sigma_1^2\right)\mathbf{B}^{-1\prime}\\[1ex]
\mathbf\Sigma_2 &= \mathbf{B}^{-1}\text{diag}\left(\boldsymbol\sigma_2^2\right)\mathbf{B}^{-1\prime}
\end{align}
### Identification.
- $\mathbf\Sigma_1$ and $\mathbf\Sigma_2$ contain $N^2+N$ unique elements
- All $N^2$ elements of $\mathbf{B}$ can be estimated
- Both $N$-vectors $\boldsymbol\sigma_1^2$ and $\boldsymbol\sigma_2^2$ can be estimated due to additional restriction: $E\left[\text{diag}\left(\boldsymbol\sigma_i^2\right)\right] = \mathbf{I}_N$
## Identification via Heteroskedasticity
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
The setup can be generalised to conditional heteroskedasticity of structural shocks
\begin{align}
u_t |Y_{t-1} &\sim N_N\left(\mathbf{0}_N, \text{diag}\left(\boldsymbol\sigma_t^2\right)\right)\\[1ex]
\mathbf\Sigma_t &= \mathbf{B}^{-1}\text{diag}\left(\boldsymbol\sigma_t^2\right)\mathbf{B}^{-1\prime}\\[1ex]
E\left[\text{diag}\left(\boldsymbol\sigma_t^2\right)\right] &= \mathbf{I}_N
\end{align}
### Identification.
- Matrix $\mathbf{B}$ is identified up to its rows' sign change and equations' reordering
- Structural shocks' conditional variances $\boldsymbol\sigma_t^2$ can be estimated
### Heteroskedasticity Modeling.
Choose any (conditional) variance model for $\boldsymbol\sigma_t^2$ that fits the data well.
## Dynamic Causal Effects {background-color="#9933FF"}
## Impulse response functions
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### Definition.
**Impulse response functions** to *orthogonal shocks* computed for an empirically relevant SVAR model are considered the <text style="color:#9933FF;">**dynamic causal effects**</text> 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$
## Impulse response functions
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### Definition.
**Impulse response functions** to *orthogonal shocks* computed for an empirically relevant SVAR model are considered the <text style="color:#9933FF;">**dynamic causal effects**</text> 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$
## Impulse response functions
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### 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{B}^{-1}
\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{B}^{-1}
\end{align}
## Impulse response functions
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### 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 $\mathbf\Theta_i^{(s)}$ as a function of $\mathbf{A}^{(s)}$ and $\mathbf{B}^{(s)}$ and return
$$\left\{\mathbf\Theta_i^{(s)}\right\}_{s=1}^{S}$$
as a sample drew from the posterior distribution of $\Theta_i$ given data.
## Bayesian Estimation {background-color="#9933FF"}
## Bayesian Estimation
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
$\left.\right.$
#### **Gibbs sampler** by [Waggoner & Zha (2003)](https://doi.org/10.1016/S0165-1889(02)00168-9)
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
$\left.\right.$
#### Further extensions include SVARs
- identified through non-normal residuals
- identified by zero and sign restrictions
- identified using instrumental variables (Proxy SVARs)
## Bayesian Estimation
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### 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
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### 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
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### 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
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### 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)](https://doi.org/10.1016/S0165-1889(02)00168-9)
- 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](https://cran.r-project.org/package=bsvars) {background-color="#9933FF"}
## [bsvars](https://cran.r-project.org/package=bsvars) an R Package
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
![](cran.png)
## [bsvars](https://cran.r-project.org/package=bsvars) an R Package: Features
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
- 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 **cpp** via [**Rcpp**](https://www.rcpp.org) and [**RcppArmadillo**](https://cran.r-project.org/package=RcppArmadillo)
- data analysis in **R**
## [bsvars](https://cran.r-project.org/package=bsvars) an R Package: Features
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
![](progress.png)
## [bsvars](https://cran.r-project.org/package=bsvars) an R Package: Features
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
- 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.
```{r}
#| eval: false
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
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
Based on [Turnip (2017)]( https://doi.org/10.1111/1475-4932.12345)
### 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
```{r}
#| label: data
#| cache: true
#| warning: false
#| fig-align: "center"
#| fig-height: 6
#| output-location: slide
# 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","#9933FF","#330033"))
```
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
## Estimation Setup
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
```{r}
# setup
############################################################
library(bsvars)
set.seed(123)
N = ncol(y)
p = 9
S_burn = 1e4
S = 2e4
thin = 2
```
## Extended Model Identification Setup
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
```{r}
# structural matrix - extended model
############################################################
B_LR = matrix(TRUE, N, N)
B_LR[upper.tri(B_LR)] = FALSE
B_LR[3,4] = TRUE
B_LR
```
## Alternative Models Estimation
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### Lower-triangular model with zero prior mean for $\mathbf{A}$.
```{r}
#| eval: false
# 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
```
## Alternative Models Estimation
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### Lower-triangular model with MLE prior mean for $\mathbf{A}$.
```{r}
#| code-line-numbers: "5-9"
#| eval: false
# 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
```
## Alternative Models Estimation
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### Extended model with MLE prior mean for $\mathbf{A}$.
```{r}
#| code-line-numbers: "3-4"
#| eval: false
# 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
```
## Alternative Models Estimation
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### Lower-triangular model with Markov-switching heteroskedastisity.
```{r}
#| code-line-numbers: "3-4"
#| eval: false
# estimation - lower-triangular MS heteroskedastic model
############################################################
spec_bsvar_msh = specify_bsvar_msh$new(as.matrix(y), p = p, M = 2, stationary = rep(TRUE, N))
spec_bsvar_msh$prior$A = A_mle
spec_bsvar_msh |>
estimate(S = S_burn) |>
estimate(S = S, thin = thin) -> soe_bsvar_msh
```
## Alternative Models Estimation
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### Extended model with Markov-switching heteroskedastisity.
```{r}
#| code-line-numbers: "3"
#| eval: false
# estimation - extended MS heteroskedastic model
############################################################
spec_bsvar_lr_msh = specify_bsvar_msh$new(as.matrix(y), p = p, B = B_LR, M = 2, stationary = rep(TRUE, N))
spec_bsvar_lr_msh$prior$A = A_mle
spec_bsvar_lr_msh |>
estimate(S = S_burn) |>
estimate(S = S, thin = thin) -> soe_bsvar_lr_msh
```
## Alternative Models Estimation
::: footer
[Bayesian Structural VARs](https://bayesian-econometrics-2023.github.io/be23-lecture8/)
:::
### Lower-triangular model with Stochastic Volatility heteroskedastisity.
```{r}
#| code-line-numbers: "3"
#| eval: false
# 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