-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path0_main.R
117 lines (96 loc) · 3.64 KB
/
0_main.R
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
# Preliminary ------------------------------------------------------------------
path <- getwd()
setwd(path)
## Load functions and packages
source('load_functions.R')
load_functions()
source('create_vfci_and_instruments.R')
source('create_figures.R')
source('create_tables.R')
# Load Data --------------------------------------------------------------------
base::load("variables.RData")
vfci_data <- variables
vfci_data$date = seq.Date(as.Date('1962-01-01'),as.Date('2022-07-01'),by = 'quarter')
#Set lags for all models
nlags <- 4
# Main results -----------------------------------------------------------------
## Baseline results ------------------------------------------------------------
type <- "baseline"
### Volatility BVAR ------------------------------------------------------------
source('1_vol_bvar_calibration.R')
source('1_vol_bvar_estimation.R')
source('1_vol_bvar_output.R')
### SVAR-IV, LP-IV, Cholesky, Sign Restrictions --------------------------------
source('2_svariv_lpiv_chol_sn_calibration.R')
source('2_svariv_lpiv_chol_sn_estimation.R')
source('2_svariv_lpiv_chol_sn_output.R')
### Export Residuals when running baseline ------------------------------------
if(type == "baseline"){
source("3_create_residual_mat.R")
}
### Panel: All models ----------------------------------------------------------
ff_y <- c("ff", "y")
for (i in ff_y) {
vfci_pair = i
source('3_panel_all_models.R')
}
# Robustness of the five identification schemes --------------------------------
#Robustness
# 1. Models specified in stationary terms
# 2. Models specified with exponential VFCI
five_model_robustness <- c("stationary", "vfci_lev")
for (i in five_model_robustness) {
type = i
## Volatility BVAR -----------------------------------------------------------
source('1_vol_bvar_calibration.R')
source('1_vol_bvar_estimation.R')
source('1_vol_bvar_output.R')
## SVAR-IV, LP-IV, Cholesky, Sign Restrictions -------------------------------
source('2_svariv_lpiv_chol_sn_calibration.R')
source('2_svariv_lpiv_chol_sn_estimation.R')
source('2_svariv_lpiv_chol_sn_output.R')
## Panel: All models ---------------------------------------------------------
ff_y <- c("ff", "y")
for (i in ff_y) {
vfci_pair = i
source('3_panel_all_models.R')
}
}
# Robustness of the heteroskedastic BVAR ---------------------------------------
#Robustness
# 3. Regime-specific IRFs across the 7 regimes
# 4. Data sample before 2008-10 global financial crisis
# 5. Normal distribution of errors in BVAR
# 6. Horserace with ECY
# 7. Horserace with GZ
# 8. Horserace with TEDR
# 9. Horserace with NFCI
# 10. 100,000 draws in the MCMC chain
# 11. 1 million draws in the MCMC chain
vol_bvar_robustness_a <- c("regimes", "pre_crisis", "normal", "100k", "1M")
for (i in vol_bvar_robustness_a) {
type = i
source('1_vol_bvar_calibration.R')
source('1_vol_bvar_estimation.R')
source('1_vol_bvar_output.R')
}
vol_bvar_robustness_b <- c("horserace_gz", "horserace_tedr","horserace_ecy", "horserace_nfci")
for (i in vol_bvar_robustness_b) {
type = i
source('1_vol_bvar_calibration.R')
source('1_vol_bvar_estimation.R')
source('1_vol_bvar_output.R')
}
# Other robustness checks (not in Appendix) ------------------------------------
#Robustness
# 12. Remove VFCI and add GZ
# 13. Remove VFCI and add TED
# 14. Remove VFCI and add both GZ and TED
# 15. Add both GZ and TED
vol_bvar_robustness_c <- c("horserace_no_vfci_yes_gz","horserace_no_vfci_yes_tedr", "horserace_no_vfci_yes_gz_tedr","horserace_gz_tedr")
for (i in vol_bvar_robustness_c) {
type = i
source('1_vol_bvar_calibration.R')
source('1_vol_bvar_estimation.R')
source('1_vol_bvar_output.R')
}