# INITIALISATION
nlag = 1
tau = 0.5
nfore = 20
corrected = TRUE
window.size = 200
data(cgs2021)
kable(SummaryStatistics(cgs2021))## The following statistics are used:
##
## Skewness: D'Agostino, R.B. (1970). Transformation to Normality of the Null Distribution of G1. Biometrika, 57, 3, 679-681.
##
## Excess Kurtosis: Anscombe, F.J., Glynn, W.J. (1983) Distribution of kurtosis statistic for normal statistics. Biometrika, 70, 1, 227-234
##
## Normality test: Jarque, C. M., & Bera, A. K. (1980). Efficient tests for normality, homoscedasticity and serial independence of regression residuals. Economics Letters, 6(3), 255-259.
##
## ERS unit-root test: Elliott, G., Rothenberg, T. J., & Stock, J. H. (1996). Efficient Tests for an Autoregressive Unit Root. Econometrica, 64(4), 813-836.
##
## Weighted Portmanteau statistics: Fisher, T. J., & Gallagher, C. M. (2012). New weighted portmanteau statistics for time series goodness of fit testing. Journal of the American Statistical Association, 107(498), 777-787.
##
##
| USD1Y | EUR1Y | GBP1Y | JPY1Y | |
|---|---|---|---|---|
| Mean | -0.001 | -0.001* | -0.001*** | 0.000 |
| (0.160) | (0.074) | (0.007) | (0.805) | |
| Variance | 0.001*** | 0.001*** | 0.001*** | 0.000*** |
| Skewness | -0.628*** | -0.385*** | -0.693*** | -0.398*** |
| (0.000) | (0.000) | (0.000) | (0.000) | |
| Ex.Kurtosis | 13.975*** | 25.931*** | 18.756*** | 20.212*** |
| (0.000) | (0.000) | (0.000) | (0.000) | |
| JB | 31983.470*** | 109332.245*** | 57462.247*** | 66469.083*** |
| (0.000) | (0.000) | (0.000) | (0.000) | |
| ERS | -6.358*** | -23.176*** | -22.380*** | -21.865*** |
| (0.000) | (0.000) | (0.000) | (0.000) | |
| Q(20) | 90.481*** | 135.246*** | 160.961*** | 54.735*** |
| (0.000) | (0.000) | (0.000) | (0.000) | |
| Q2(20) | 1723.487*** | 967.321*** | 1522.432*** | 755.185*** |
| (0.000) | (0.000) | (0.000) | (0.000) | |
| kendall | USD1Y | EUR1Y | GBP1Y | JPY1Y |
| USD1Y | 1.000*** | 0.274*** | 0.280*** | 0.096*** |
| EUR1Y | 0.274*** | 1.000*** | 0.313*** | 0.085*** |
| GBP1Y | 0.280*** | 0.313*** | 1.000*** | 0.105*** |
| JPY1Y | 0.096*** | 0.085*** | 0.105*** | 1.000*** |
dca = ConnectednessApproach(cgs2021,
model="QVAR",
connectedness="Time",
nlag=nlag,
nfore=nfore,
corrected=corrected,
window.size=window.size,
VAR_config=list(QVAR=list(tau=tau)))## Estimating model
## Computing connectedness measures
## The QVAR connectedness approach is implemented according to:
## Chatziantoniou, I., Gabauer, D., & Stenfors, A. (2021). Interest rate swaps and the transmission mechanism of monetary policy: A quantile connectedness approach. Economics Letters, 204, 109891.
kable(dca$TABLE)| USD1Y | EUR1Y | GBP1Y | JPY1Y | FROM | |
|---|---|---|---|---|---|
| USD1Y | 75.84 | 10.45 | 11.12 | 2.60 | 24.16 |
| EUR1Y | 10.21 | 76.47 | 11.14 | 2.18 | 23.53 |
| GBP1Y | 11.87 | 11.15 | 74.82 | 2.15 | 25.18 |
| JPY1Y | 5.01 | 2.86 | 2.85 | 89.27 | 10.73 |
| TO | 27.10 | 24.46 | 25.11 | 6.93 | 83.60 |
| Inc.Own | 102.93 | 100.94 | 99.93 | 96.20 | cTCI/TCI |
| NET | 2.93 | 0.94 | -0.07 | -3.80 | 27.87/20.90 |
| NPT | 2.00 | 3.00 | 1.00 | 0.00 |
PlotTCI(dca)PlotNET(dca)k = ncol(cgs2021)
t = nrow(dca$TCI)
date = index(cgs2021)
NAMES = colnames(cgs2021)
n = 10
quantiles = seq(0.05, 0.95, 1/n)
print(quantiles)[1] 0.05 0.15 0.25 0.35 0.45 0.55 0.65 0.75 0.85 0.95
DCA_list = list()
TCI = array(NA, c(t, length(quantiles)), dimnames=list(as.character(tail(date,t)), quantiles))
NET = array(NA, c(t, k, length(quantiles)), dimnames=list(as.character(tail(date,t)), NAMES, quantiles))
for (j in 1:length(quantiles)) {
dca = suppressMessages(ConnectednessApproach(cgs2021,
model="QVAR",
connectedness="Time",
nlag=nlag,
nfore=nfore,
corrected=corrected,
window.size=window.size,
VAR_config=list(QVAR=list(tau=quantiles[j]))))
TCI[,j] = dca$TCI
NET[,,j] = dca$NET
DCA_list = c(DCA_list, list(dca$TABLE))
print(quantiles[j])
}[1] 0.05 [1] 0.15 [1] 0.25 [1] 0.35 [1] 0.45 [1] 0.55 [1] 0.65 [1] 0.75 [1] 0.85 [1] 0.95
nlevels = 20
threshold = 0.01 # get rid of outliers
filled.contour(tail(date,t), quantiles, TCI, xlab="", ylab="", ylim=c(0,1))for (i in 1:k) {
net = NET[,i,,drop=FALSE]
net[which(net<quantile(net, threshold), arr.ind=TRUE)] = as.numeric(quantile(net, threshold))
net[which(net>quantile(net, 1-threshold), arr.ind=TRUE)] = as.numeric(quantile(net, 1-threshold))
lvls = seq(-ceiling(max(abs(net))), ceiling(max(abs(net))), length.out=nlevels)
color.palette = function(n) {hcl.colors(n, "RdBu", rev=TRUE)}
quantiles = as.numeric(dimnames(net)[[3]])
filled.contour(tail(date,t), quantiles, as.matrix(net[,1,]),
col=color.palette(nlevels-1), levels=lvls, main=colnames(net), ylim=c(0,1))
}