1 Introduction

In the last 20 years, economic literature has devoted a large amount of effort into investigating contagion, i.e. the unexpected transmission of shocks across countries (Rigobon 2016). Although some evidence of contagion can be traced back to the Great Depression in 1930s and to the Debt Crisis in 1980s, the first empirical contributions were only produced in the 1990s, and specifically after the Mexican (1994), Asian (1997), and Russian (1998) currency collapses. The intensity of the propagation mechanisms that characterized these shocks greatly surprised both academicians and practitioners. Indeed, whereas it is reasonable to expect that large countries suffering crises may influence smaller countries (as happened during the Great Depression), or that shocks in one country may affect its main trading partner (as in the case of the collapse in Russia in the 1980s that caused the collapse of Finland), in the aforementioned 1990s crises countries were heavily affected by shocks generated in other countries, despite the limited trading links with those countries. In contrast, in those years, other crises produced a confined contagion (or did not produce any contagion at all) as in the case of the Brazilian (1999), Turkish (2000), and Argentinean (2002) crises. This significantly contributed to the increase of interest in studying the drivers of shocks and, above all, the prevention of the related propagation mechanisms (Kaminsky et al. 2003). The 2008 US sub-prime crisis and the 2010 EU fiscal crisis have renewed the interest about contagion, creating a “near-ideal laboratory” for researchers in order to study causes and effects of financial contagion that arise at the time of stress (Longstaff 2010). As happened in the 1990s crises, in both the 2008 and 2010 crises a shock in small and isolated markets produced a huge impact at the global level. Indeed, even though the size of the sub-prime market in 2007 represented a very limited portion of the financial system, it had a massive impact in the US and across the world. Similarly, although Greece contributes in a very limited way to the financial flows in the Euro area, this makes it particularly hard to explain why other countries were affected by the collapse of Greece. Whereas in their recent study, Caporin et al. (2018) show there is no evidence for shift-contagion in European debt crisis, subject is still open to debate.

From an empirical point of view, the proper analysis of the possible contagion’s determinants (if any exists) requires the inclusion of many variables into the estimated models. However, due to the increasing number of variables, the dimension of data space increases and observations become sparse and the situation worsens in presence of small samples. In conventional statistical techniques (in several forms of regression settings), obtaining statistically significance results becomes therefore nearly impossible. Even when significant results are achieved, model assumptions and validity are not hold. In order to deal with high dimensionality, a number of approaches can be employed. One of the simplest examples is to conduct a stepwise variable selection procedure to find the best fitting combination of variables (Siebenbrunner et al. 2017). But as the number of candidate variables increases, this approach quickly becomes time-consuming and mostly not efficient at finding the best or near-best combination of variables. Today, there are more options to deal with so-called curse of dimensionality, particularly machine learning methods (Athey 2018; Athey and Imbens 2019), combinatorial optimization techniques (Gilli and Winker 2008) and their hybrid forms. Their use in economic empirical research is fast growing providing a valuable option instead of simplification and misspecification in highly complex problems in economics.

In this framework, the present article contributes to the empirical literature on contagion by investigating the determinants of shocks propagation in the Euro area using data from 2001 to 2015 applying a hybridized approach based on a machine learning, metaheuristic optimization and conventional econometric methods. More specifically, we adopted a three-step methodology. Firstly, we used a principal component analysis (PCA) on the first differences of countries’ bond yields to reveal any co-movement in bond yields’ changes. This allowed us to divide analysis period into sub-periods and to group countries in sub-groups. Secondly, we employed a random forest (RF) model with the aim of searching for government bond yields’ determinants in the identified sub-periods. Thirdly, impulse response functions (IRF) were produced from estimated vector auto regression (VAR) models. In equations, we used bond yield spreads between groups and focused on those in which spreads were regressed on their own lags along with selected variables’ (from second step) lags. In second and third steps, a simulated annealing (SA) algorithm was used for the variable selection (i.e. for optimization) to increase efficiency and reliability of our results. The improved success of RF learning and diagnosis test results on VAR models confirmed the SA contribution to our objective. We believe therefore that the methodology employed and the robust results achieved in this study contribute to literature in both respects.

Next section reports the literature review followed by the material and methods section. Results are then presented along with discussions, and the paper ends with some concluding remarks.

2 Literature Review

2.1 Definition, Identification, and Explanation of Contagion

Despite the large amount of both theoretical and empirical literature investigating contagion, literature lacks a universally recognised definition of contagion. In their seminal article, Forbes and Rigobon (2002) define contagion as a significant increase in cross-market linkages after a shock to one market. Alternatively, contagion can be defined as the propagation of shocks between two markets in excess of what should be reasonably expected (Billio and Pelizzon 2003). Relatedly, Broto and Perez-Quiros (2015) defined contagion as a significant variation in the cross-country co-movements (of CDS spreads) compared with that of non-crisis periods. This definition is consistent with the fact that realization of a reasonable expectation can mostly be possible in calm periods.

In more general terms, contagion can be identified with the process of shock transmission occurring within a complex system (i.e. a system composed of many elements interacting with each other by means of non-linear dynamics) in both calm and crisis periods (Kaminsky et al. 2003). In this study, we refer to this definition to test the contagion determinants in Euro area. Following such approach, financial system provides a relevant example of a “complex system” where contagion can be conceived as the probability that the instability of a given financial institution (market, infrastructure, etc.) spreads to other parts of the system, thus creating a negative effect that leads to a wide financial crisis (Allen et al. 2009; Gai et al. 2011; Helbing 2012) and in some cases segmentation in global system.

It is worth noting that banking system is inherently more vulnerable to contagion. According to Kaufman (1992), bank failure contagion occurs faster, spreads more broadly within the industry, results in a larger number of failures, causes greater losses to creditors (depositors) at failed banks, and spreads further beyond banking industry. This causes substantial damage to both financial system and macroeconomy.

In order to identify contagion, the literature proposes several different criteria (Smaga 2014). In particular, contagion happens when: (i) the transmission is in excess of what can be explained by economic fundamentals; (ii) the transmission is different from regular adjustments observed in calm times; (iii) the events constituting contagion are negative extremes; (iv) the transmission is sequential, for example, in a causal sense.

Moreover, contagion can happen by means of both direct and indirect channels (Upper 2011). Direct channels are exposures arising from interbank loans, payment systems, and derivative securities. For instance, the fear that a bank might become insolvent stokes a panic that pushes depositors to withdraw their deposits on mass, thus increasing the risk of insolvency of the bank itself. Cases of bank runs happened recently in London due to Brexit, and in Greece and Cyprus in 2015. In addition, interbank connections can act as a contagion channel that exposes banking system to a lack of coordination phenomena (gridlock equilibrium) even when all banks are solvent. Indirect channels include the effects of deterioration in the assets of balance sheet price.

The literature explains contagion by means of three main approaches, namely the fundamental, financial, and coordination views (Rigobon 2016). The fundamental view concentrates on real channels (such as bilateral trade and macroeconomic policies) to explain the propagation of shocks across countries (Corsetti et al. 2000, 2005; Gerlach and Smets 1995). This approach was used mainly to explain contagion deriving from Great Depression, as well as for the 1970s and 1980s crises in Europe. The financial view believes that contagion is caused by constraints and inefficiencies in banking sectors and international equity markets (Goldstein et al. 2000; Kaminsky and Reinhart 2003). The main idea behind this approach is that imperfections in the financial system can be exacerbated during a crisis, increasing the propagation of shocks across countries. Finally, the coordination view explains contagion by means of coordination failures among investors and/or policymakers (Calvo and Mendoza 2000; Drazen 2000; Masson 1998). According to this approach, the transmission of shocks occurs because of informational problems that may push market participants to withdraw resources jointly across countries, or policymakers to give up a macroeconomic policy. More recently some authors (Acemoglu et al. 2015; Gai and Kapadia 2010) have examined how shocks propagate through a network based on debt holdings or interbank lending; also, how shocks propagate as a function of network architecture. Results suggest that incomplete networks are more inclined to contagion than complete ones, and that the more the network is connected, the more it is resistant. This is because the proportion of losses in the portfolio of a bank is transferred to more banks through interbank agreements.

2.2 Contagion Determinants

The literature has proposed several different variables as possible determinants of contagion. In particular, fundamental macroeconomic variables (especially GDP growth rate, GDP per capita, unemployment rate, inflation rate, government debt amounts and GDP ratios) are the more frequently used ones in the empirical studies (Bernal et al. 2016; Boumparis et al. 2015; Bratis et al. 2015; Brutti and Sauré 2015; Dufrénot et al. 2016; Gómez-Puig and Sosvilla-Rivero 2016; Ho 2016). Together with variables that measure financial linkages and regional/global shocks (Gómez-Puig and Sosvilla-Rivero 2016), it is possible to distinguish the effects of the economic situation and interconnections of countries on contagion; this is also known as “fundamentals-based contagion” (Calvo and Reinhart 1996; Kaminsky and Reinhart 2000).

Moreover, some studies suggest that contagion also occurs due to the behavioural reactions of investors or market participants, not just because of economic fundamentals (Masson 1999; Mondria and Quintana-Domeque 2013). Benchmark stock market indices, economic policy uncertainty indices, rating announcements from rating agencies, political announcements, economic indicators/information announcements and events are incorporated into models for better understanding the transmission of shocks (Apergis 2015; Baum et al. 2016; Bernal et al. 2016; Brutti and Sauré 2015; Dufrénot et al. 2016; Gómez-Puig and Sosvilla-Rivero 2016; Pragidis et al. 2015). These studies generally conclude that contagion transmission is seen as stemming from both fundamentals and market sentiment variables.

Starting from this framework, the present study follows Gómez-Puig and Sosvilla-Rivero (2016) by setting two main variable categories:

  1. 1.

    Market sentiment variables that proxy the participant behaviour in the economy related to existing information. These variables ultimately shape future expectations.

  2. 2.

    Macroeconomic fundamentals variables that proxy the financial and economical linkages that may adversely affect several countries simultaneously.

Within the above two categories, we have defined two sub-categories of variables, namely country-specific and global. In this way, we aim to assess whether cross-country contagion is effective on economic variations, and investigate which indicators primarily influence cash flows and credit collections.

3 Materials and Methods

3.1 Data

In order to assess the determinants of contagion in Euro area, we selected 10 out of 17 countries belonging to Economic and Monetary Union (EMU). These were Austria, Belgium, France, Germany, Greece, Ireland, Italy, Netherlands, Portugal, and Spain. Five of these (Portugal, Ireland, Italy, Greece, Spain; also known as “PIIGS”) are EMU peripheral countries and exhibit serious sovereign debt problems. In contrast, remaining countries (Netherlands, Austria, Belgium, France, and Germany) are EMU core economies: they are financially stabilised and considered to be “safe-heavens” by investors.

Our initial dataset included 28 global variables. We first reduced the dataset dimension by dropping variables with a correlation score higher than 0.9. Then, we combined the remaining variables (total of 17) with each country-specific variable dataset. A summary of the ultimate variables used in our empirical investigation is reported in Table 1Footnote 1 and description of variables can be found in Appendix A.

Table 1 Types and data sources of variables

First, we used yields of Euro area sovereign 10-year mature bonds as the dependent variable, for PCA and RF. The literature (see, for instance, Cronin et al. 2016; Gómez-Puig and Sosvilla-Rivero 2016; Koop and Korobilis 2016; Singh et al. 2016) uses country bond yield spreads (mostly difference with Germany bond yields) instead of yields, but we initially opted for yields because we did not differentiate Euro area countries as a priori “core” and “peripheral”. After country groups and bond yields' determinants are identified, mean bond yields of groups are calculated and spreads between groups are used in VAR models. We employed monthly sampled observations from 2001:01 to 2015:12; a total of 179 observations for each variable for each country.Footnote 2

3.2 Methodology

As shortly described in introduction, in this study we followed a three-step methodology.

In step 1, PCA on the first differences of countries’ bond yields was used to reveal any co-movement in bond yields’ changes. By exploiting information provided by PCA, we could thus identify disturbances/breaks in co-movements and find evidence on the dissociation of Euro area economies. Analysis period was then divided into sub-periods and countries grouped according to the findings achieved. Within each group, a bond yield variable was calculated by averaging countries’ bond yields. In step 2, an RF model was employed with the aim of searching for the government bond yields’ determinants in the identified sub-periods. We preferred to use a machine learning method rather than conventional statistical approach (e.g. linear regressions) since RFs are usually more reliable and efficient to determine which variables are more important in predicting yields, especially when relationships are not linear but in complex forms and with a large number of features that are not related to the outcome (Athey and Imbens 2019; Wager and Athey 2018). In step 3, IRF were produced from estimated vector auto regression (VAR) models. In equations, we used bond yield spreads between groups and focused on those in which spreads were regressed on their own lags along with selected variables’ (from step 2) lags. In steps 2 and 3, an SA algorithm was used for selecting variables (i.e. for optimization) in order to remove redundant predictors, decrease noise, increase degrees of freedom, and thus enhance efficiency and reliability of our results. Improved success of RF learning and diagnosis test results on VAR models confirmed the SA contribution to our objective. All this process is visualized in Appendix B.

3.2.1 Step 1: Principal Component Analysis

We started our investigation by checking for stationarity in bond yields using the Augmented Dickey-Fuller (ADF) test.Footnote 3 Unit root tests showed that none of the yields were stationary at 95% significance. Consequently, we calculated logarithmic first differences finding that all yields were now stationary and could be treated as first-difference stationary variables. We then performed PCA on the stationary dataset.

Following James et al. (2000), the combination of loading values on the first PC (PC1) can be written as:

$$ Z_{1} = \varphi_{11} X_{1} + \varphi_{12} X_{2} + \cdots + \varphi_{p1} X_{p} $$
(1)

where φp1 are the loadings of variable p on PC1.

The PC1 computation is an optimisation problem expressed as:

$$ maximize\;\; \frac{1}{n} \mathop \sum \limits_{i = 1}^{n} z_{i1}^{2} $$
(2)
$$ \begin{gathered} {\text{subject}}\;{\text{to,}} \hfill \\ \mathop \sum \limits_{j = 1}^{p} \varphi_{j1}^{2} = 1 \hfill \\ \end{gathered} $$
(3)

where there are n observations of p variables and zi1:

$$ z_{i1} = \varphi_{11} x_{i1} + \varphi_{21} x_{i2} + \cdots + \varphi_{p1} x_{ip} $$
(4)

where zn1 are scores of sample observations on PC1. PC1 allows us to explain most of the variance over the variables used.

PC1 allowed us to explain most of the variance over the variables used. Second principal component (PC2) can be found in a similarly way to PC1. However, because it must be uncorrelated with PC1, an orthogonality constraint between directions PC1 and PC2 must be added to the problem. Following this procedure, it is also possible to find the remaining PCs, any PC being uncorrelated.

Although components can be interpreted in many ways, we focused on examination of correlation behaviour among variables in order to reveal any changes. In this way, we were able to identify different sub-periods and assess their differentiation with further analysis. To this end, we employed Pruned Exact Linear Time (PELT) method proposed by (Killick et al. 2012) that considers changes in mean in the score values—which is associated with co-movements—provided by PCA.

A PCA was conducted on 10-year mature yields of sovereign bonds for all countries in our dataset, with the aim of investigating correlation behaviour of the countries’ yields over the whole period analysed. We chose PCA to overcome any possible bias arising from high correlations among the variables. Indeed, traditional econometric estimates are based upon strict assumptions about data used, taking the risk to of being biased due to existence of a high correlation among variables. The analysis of variance in variable/feature space with PCA overcomes this kind of problems by building normalized linear combinations (principal components—PCs) of variables.

3.2.2 Step 2: Random Forest Models

In the second step, we run RF models for any sub-period defined in step 1, by using all variables. RF is a kind of “tree-based method”. These techniques recursively subdivide data into smaller groups by means of binary splits (nodes) through branches and selects the best combination that has the lowest error to explain response. The best split is made at the top of the tree and continues until the end of the splitting process. In terminal nodes of the tree, class decisions are made. However, trees may suffer from several drawbacks: e.g. a tree can be too complex to retrieve useful information; a dominant variable may prevent possibility of other predictors to be considered, thus resulting thus in a biased output; high variance-related problems may emerge, hindering possibility of generalising the learning process. RF allowed us to overcome most of these problems. RF selects a random subset of predictors every time a new split is considered and eventually provides de-correlated trees. Diversity is maintained through the process and low biased predictions are thus obtained.

There are three tuning parameters that adjust RF performance, namely (i) size of each predictor subset, (ii) number of trees to be grown, and (iii) minimum number of observations in terminal nodes. In our case, we used 1/3 of predictors for any subset, set the size of the forest to 200 and the minimum number of observations in terminal nodes to 1.Footnote 4 We ran the randomforest function of the RF library (Liaw and Wiener 2002). This tool provides an important report that indicates the predictors’ explanation powers with increase in mean square error of predictions when the corresponding variable is excluded from the subset. Such measure was therefore referred to as the indicator of influences of determinant variables on bond yields.

3.2.3 Step 3: Impulse Response Function Production

In the third and final step of our analysis, we built VAR models with the variables selected from step 2. As Sims (1980) mentioned in his study, structural econometric models, the models which are based on economic theories have ad hoc restrictions. But most of economic relationships are too complex to be revealed by strict and static approaches. In this sense, it will be more beneficial to let data, rather than the analyst, to specify the dynamic structure of the model (Pyndyck and Rubinfeld 1991, p. 354). Without a stringent theoretical framework,Footnote 5 all variables in the system are assumed as endogenous and necessary lag lengths are added.

VAR models are multi-equation systems constructed with the variables which are all assumed as endogenous. Vector of this endogenous variables are modelled as an autoregressive function of their lagged values. A VAR model with lag order m equation can be constructed as:

$$ {\varvec{Y}}_{t} = {\varvec{\beta}}_{1} {\varvec{Y}}_{t - 1} + {\varvec{\beta}}_{2} {\varvec{Y}}_{t - 2} + \cdots + {\varvec{\beta}}_{m} {\varvec{Y}}_{t - m} + \epsilon_{t } ,\quad t = p + 1, \ldots , T $$
(5)

where, Yt denote the vector of variable values at time t, β1..m denote coefficient matrices and \( \epsilon_{t } \) is an unobservable zero mean white noise vector process. We used vars (Pfaff 2008) library to build VAR models and create IRFs. Groups’ monthly bond yields were calculated as means of in group countries’ monthly bond yields. Differences between each groups’ monthly bond yields were used as spread measurements and included in VAR models along with variables selected from previous step. Stationarity of all variables was checked with Augmented-Dickey Fuller (ADF) and Kwiatkowski, Phillips, Schmidt, Shin (KPSS) tests (Dickey and Fuller 1979; Kwiatkowski et al. 1992). We differentiated the series when stationarity was rejected by ADF test. If unit root existence was rejected, we additionally referred to KPSS test to ensure stationarity. This process continued until all series were approved as stationary.

Moreover, since the order of a VAR process is an important parameter affecting explanatory power of the model on relationships, we used the Akaike Information Criterion to determine lag order with maximum lag order of 4 for the pre-crisis period models and 2 for the crisis period models.

No matter VAR models are useful tools, small degrees of freedom will be a serious problem as the number of lags and variables increase. Thus, individual parameters cannot be estimated precisely, and they will not be reliable. We have tried to overcome this issue by reducing total number of variables included in VAR models, by using the SA algorithm selection procedure again.

Lastly, in order to understand how shock propagation takes place, we applied impulse response analyses. IRFs created by these analyses determine how each variable responds to a shock (in one or more variable and trace that response over time (Pyndyck and Rubinfeld 1991, p. 385).

3.2.4 Simulated Annealing Algorithm

SA algorithm is inspired by the controlled cooling processes of metals. Material is heated to a high level of temperature and then, the temperature is gradually lowered gradually in order to obtain a minimum energy crystalline structure. Similarly, SA algorithm begins with a high value of T, which is the system state variable and gradually lowered to a termination level (which is 2000 for SA-RF and 1 for SA-VAR). T was initially set to 15,000 (SA-RF) and 200 (SA-VAR) and geometric scheme (Tupdated  =  Tcurrent×α) is used to update T after n number of new solution acceptances (iterations) completed at current temperature level. n is set to 7 (SA-RF) and 10 (SA-VAR) and with a constant factor of α (set as 0.95 for SA-RF and 0.99 for SA-VAR).

After T value is updated, it is used as current T level. All parameters of SA algorithm were evaluated with several trials. Selected values provided adequate investigation of solution space with meaningful run time.

Initially, a random vector consisting of cells with a size of the number of independent variables is created and accepted as current solution. Each cell corresponds to a specific variable and may take value of 1 or 0. A cell with value of 1 indicates the corresponding variable is used for learning whereas a value of 0 indicates exclusion. By using selected variables, explained variances in RF models and AdjustedR2 in VAR models are used as performance measures of selections. At any system state a new solution (neighbour) is created by flipping a random cell's value. If neighbour solution has better performance, it is accepted as the current solution. In case of worse performance, neighbourhood movement can still be accepted, depending on following probability:

$$ P\left( {\Delta C} \right) = \frac{1}{{\exp \left( {\frac{\Delta C}{T}} \right)}} $$
(6)

which this known as “metropolis acceptance criterion”. \(\Delta C\) is the difference of cost values between the neighbour solution and the current solution.

In a maximization problem like ours, the cost value of a solution is inversely proportional to its performance value (fsolution) and it must be calculated by multiplying explained variance or AdjustedR2 of associated model by “− 1”. But in this study, differences in performance values were less than 1, so their impact on probability of acceptance change that is calculated from exponential function would be minimal. Because of that, the performance values were altered with “1/fsolution” operation. This allowed to convert the maximization problem to a minimization problem and thus, newly obtained fsolution values were used as solution costs without multiplication by “− 1”.

SA algorithm was used for variable selection process for both RF and VAR models developed in steps 2 and 3, with the aim of obtaining more reliable results. Indeed, high-dimensional, and complex datasets like that used in our investigation can result in low and/or non-optimal performances on learning. From this viewpoint, a search algorithm like SA may significantly reduce the number of variables to be considered by models, thus improving explanation success achieved.

In this study, hence therefore, we run RF and VAR models by using the variables selected by SA algorithm at any candidate solution. We implemented all models and algorithms in statistical computing software “R” (version 3.3.1) via R Studio interface.

4 Empirical Findings

4.1 Principal Component Analysis Results

Identification of periods with different characteristics of co-movements among bond yields can be very useful for a more reliable analysis of contagion determinants. Especially in presence of integrity/diversity shifts, there is a possibility that determinant variables and their impact levels, which effected these shifts may have changed. A determinant with a relatively strong influence on an idiosyncratic time period will lower chance of distinguishing other influencing determinants over remaining periods. Dividing a wide and heterogeneous horizon into smaller and more homogeneous ones thus provides a less biased examination opportunity along with better understanding of time-varying structure of Euro area contagion.

We found that PC1 and PC2, together, explain 88% of variance (see Fig. 1, top row; 72% by PC1 and 16% by PC2). It is worth noting that, apart from Greece, PC1 corresponds to a high correlation of bond yields. PC2 obviously corresponds to differentiation of bond yields as core and peripheral countries' bond yields (top of zero belongs to core and bottom to peripheral). Among core countries, Austria and Netherlands are highly correlated, although, within peripheral countries, Italy and Spain are in a close relationship one with each other. As this component explicitly refers to economic powers of countries, Germany is in the strongest position and Greece is in the weakest. Such results seem therefore to be in line with the situation.

Fig. 1
figure 1

PCA outputs (top) and change points in score means (bottom)

Bottom row of Fig. 1 shows means of scores on PC1 and PC2. Looking at the left plot, it is possible to note that PC1 dynamics do not change before the 150th observation, which corresponds roughly to 2.5 years before the end of 2015. This implies that high correlation was valid for a very long time period. In contrast, differentiation emerges after the 100th observation on the right plot, which corresponds approximately to the date 2009:05. These results show, therefore, existence of some breakpoints for Euro area countries' systemic co-movements in our sampling period. Using PELT method, we detected 11 change point locations for PC1 and 5 for PC2. Looking to bottom-right plot in Fig. 1, it can be said that the integrity of sovereign bond yields was maintained until 2010:08. Later, fluctuations became apparent with several lengths, and even monthly changes were observed.

The bottom-right plot which indicates differentiation of core and peripheral countries, shows fewer change points and larger intervals. As we focused on disintegration, we determined our sub-periods based on this information by combining the last four intervals in order to obtain enough observations for our future analysis and to simplify the process. Ultimately, we determine that bond yield co-movement levels haves changed significantly at following dates: 2009:11, 2012:07, and 2014:09.

Robustness Checks and Country Groups

In order to test for significance of our sub-periods’ determination, we ran a PCA on bond yields for any sub-period identified. First time period (TP1) covers the sub-period from 2001:01 to 2009:10; second (TP2) from 2009:11 to 2012:06; third (TP3) from 2012:07 to 2014:08; finally fourth (TP4) from 2014:09 to 2015:12. For visualized relationships between bonds in different time intervals, see Figs. 2 and 3.

Fig. 2
figure 2

The first two PCs for bond yields and cumulative proportion of variance explained by PCs (TP1-top row; TP2-bottom row)

Fig. 3
figure 3

The first two PCs for bond yields and cumulative proportion of variance explained by PCs (TP3-top row; TP4-bottom row)

For TP1, PC1 achieves an explanation rate of 92%, which represents an adequate score to rely on its significance alone. We can conclude that all bond yields are characterised by a strong correlation during this sub-period, which implies that TP1 can be defined as the pre-crisis period.

TP2 needs a deeper examination according to PCs' scores. Loading scores for first four PCs and their explanation rates can be seen in Table 2. In this period, first two PCs suggest a break in common trends of yield movements, which can be attributed to a reduction in investor confidence on several countries, thus core and peripheral duality emerges. On PC2, gaps among countries become more evident, which conceivably relates to the fact that Germany and Netherlands were perceived as more secure economies whereas Spain, Italy, and Greece as the riskiest investing zones. It is not easy to read information provided by PC3, but it is possible to say that this component shows more complex divergence among countries. PC4 refers almost entirely to Greece bond yield movements. Thereby, it can be concluded that this period is highly associated with changing dynamics in Euro area countries. Thus, we called this period as the crisis period for Euro area.

Table 2 Loadings on the first four PCs of TP2 and their explanation rates

For TP3, enough explanation rate (82%) is achieved with first two PCs (see Fig. 3). During the period, Belgium converges to other core countries and all strong economies tend to move together. PC2 loadings of countries whose economies suffer from sovereign debt problems are on same direction but, by considering both PC1 and PC2 loadings, it is not possible to say that these countries have high co-movements among themselves like core economies through this time period. Impacts of crisis are distinguishable. As this period still refers to a de-facto crisis phenomenon, we consider this period together with TP2 as the crisis period.

Finally, by examining first two PCs for TP4 (see Fig. 3), we can substantiate re-integration of core and peripheral countries except Greece with an explanation power of 82%. Distinctions are still observable among countries on PC2. The most notable point is that Greece is on in a very particular position compared to other countries on PC1 and PC2. This implies serious economic problems still observable for this country, and thus it deserves a more emphasis in order to understand reasons for this. Excluding Greece, we called this period as the post-crisis period for most Euro area countries, but it is not included in following analyses because it has too few observations for a reliable examination, specifically in VAR models.

These results are in line with Baur (2018) who found evidence of partially disintegrated Euro area bond markets during the debt crisis period, which is also seen as a necessary condition for strong contagion effects.

We built VAR models with groups of similar characteristics as found in here. Plots show clear evidence about these similar and different bond yield characteristics. Especially after pre-crisis period, groupings become obvious among Germany, France, Netherlands, Austria, Belgium (core) and among Portugal, Greece, Italy, Ireland, Spain (peripheral). Because Greece exhibits a distinct behaviour in peripheral countries, we treat it as a third group itself in VAR models.

4.2 Random Forest Results and Simulated Annealing Algorithm Improvement

We ran RF models 20 times. Then, we calculated the average importance values of indicators and consulted rate of variance explained as the performance measure of the models. In Table 3 (RF Model part), the explanations for both pre-crisis and crisis periods are shown. Explanations are adequate for all countries but as explained before, a variable selection (also known as feature selection) technique is an ideal tool to overcome a high dimensional predictor space problem; as they foster learning by excluding irrelevant variables from the model. For this reason, we implemented SA algorithm as a variable selection approach to find a near-optimal subset of predictors.

Table 3 Means of the variances explained by models

The enhanced learning performances achieved with the proposed variable selection process can be seen in Table 3 (SA-RF part). The table shows improvement for both periods. We also conducted paired-samples t-test and non-parametric Mann–Whitney test to assess significance of explanation performances regarding to the base and the enhanced models. The hypothesis that mean explanation performance of the base model is equal to mean performance of SA-RF model was rejected at 1% level of significance. Therefore, results from our model may conveniently be relied on.

4.2.1 Influencers of Bond Yields in Euro Area

Determinants of bond yields are selected according to the importance of variables given by RF models.

4.2.1.1 The Pre-crisis Period

Table 4 reports, for all countries, importance of the variables during the pre-crisis period and those selected for VAR models are underlined. Looking at core countries, Belgium seems to be mostly influenced by Euro area unemployment, Euro area inflation, US unemployment, and the country's own unemployment. Excluding Euro area inflation, the same influencers affected Germany, although US dollar rate played an influential role for Germany than Belgium. Influencing variables for Germany also had similar impacts on Netherlands. France bond yields was intensively related with country unemployment, whereas US unemployment and financial corporations' debts had relatively minor effects. Among core countries, we found Brent oil price as one of primary influencers only for Austria, together with Euro area unemployment and financial corporations' debts.

Table 4 Variable importance during the pre-crisis period

On the side of peripheral countries, some primarily influencing indicators are analogous to those affecting core countries and, we found that some market sentiment variables were prominent. In particular, Ireland's unemployment rate was the primary influencer for this country, followed by Euro area inflation, US unemployment, and Euro area industrial production. Greece had three high influencers, namely country GDP change rate, Euro area unemployment, and country economic sentiment indicator score. US dollar, Euro area inflation, country inflation, unemployment and government debt to GDP ratio change rates were main modifiers for bond yields in Spain. Italy had five remarkable influencers: Country unemployment rate, US dollar rate, Euro area inflation, Euro area unemployment, and Brent oil price. Lastly, consumer confidence indicator, country and US unemployment rates, and Euro area inflation rate were found as directive variables for Portugal.

4.2.1.2 The Crisis Period

Table 5 reports, for all countries, importance of the variables during the crisis period and those selected for VAR models are underlined. Fundamental variables that affected core countries during the pre-crisis period seem preserved their relevance during the crisis period. Euro area inflation and unemployment rates, US dollar rate, and US unemployment rate were noteworthy for Belgium. Euro area unemployment was determinant for all core countries, especially for Netherlands with its high importance value. Country unemployment rate was mutually important for Germany, France, Netherlands, and Austria. US unemployment was the other primary influencer for bond yields in both Germany and Austria. France, Netherlands, and Austria were under the influence of US dollar. Country GDP change rate was another relevant variable for Austria, whereas country economic sentiment indicator seems to be the only market sentiment variable that had a notable effect on Netherlands.

Table 5 Variable importance during the crisis period

Looking at peripheral countries, country unemployment rate, GDP change, and US unemployment represented three primary influencers for Ireland where they exerted increased effects on the bond yields compared to the pre-crisis period. Greece received higher exposure to country economic sentiment indicator, country government debt to GDP ratio change, and Euro area inflation. Together with these, Euro area unemployment rate exerted a relevant influence on bond yields in Greece. Spain and Italy had more primary influencers than other countries. Country government debt to GDP change and country inflation, US dollar, Euro area inflation and Euro area industrial production were the most significant bond yields' influencers in Spain; also, as a market sentiment indicator, Kansas City Financial Stress score was found to be high. Country unemployment and Euro area inflation rates were important for both Italy and Portugal. US dollar rate, US and Euro area unemployment rates, and World GDP change rate were remaining noteworthy determinants for Italy, and country GDP change, consumer confidence indicator, and Kansas City Financial Stress score were in the foreground for Portugal. Selected variables to include in VAR models in next step are summarized in Appendix C.

4.3 Vector Autoregression Models’ Results and Simulated Annealing Algorithm Improvement

Key performance measures of VAR models are shown in Table 6. Tests suggest that for both pre-crisis and crisis periods, only Core-Greece models are adequate. In pre-crisis period, other models' diagnostics failed to validate appropriateness of models but especially in crisis period, models have series problems. These problems are mainly due to low number of observations against total number of variables with their lags included in models.

Table 6 Key performance measures of VAR models with all determinant variables

After SA algorithm was used for variable selection, better results are achieved, and high-dimension problem have overcome. Results are shown in Table 7. In next step, variables with significant impacts on spreads are considered and presented only.

Table 7 Key performance measures of VAR-SA models with selected variables

4.3.1 Contagion in Euro Area

4.3.1.1 The Pre-crisis Period

Reaction of Core-Peripheral groups' bond yield spread to shocks in selected variables' can be seen in Fig. 4. IRFs indicate that most significant effects are emerged from shocks in US Dollar, Brent Oil Price, Spread's own innovations, EA Unemployment and DE Unemployment. Shocks in Spread has instant and high positive impact on itself, which turns to negative and become positive again within few lags. US Dollar shocks have negative significant responses on spread after two periods and this effect fades off after six periods. Like US Dollar, Brent Oil Price shocks have negative significant responses on spread between lags two and four and at lag eight, a positive impact becomes evident. Oil Price's effect then declines to zero sharply. Shocks in Financial Corporations' Debt have positive impact on spread through four and five period lags. Beside these, significant shock effects emerge at some lags; negatively from ES Debt to GDP Ratio at lag 4 and positively from EA Unemployment and DE Unemployment shocks at lag two.

Fig. 4
figure 4

Core countries-peripheral countries bond yield spread responses to shocks in pre-crisis period

Impulse response plots of core-Greece groups' bond yield spreads with selected variables are shown in Fig. 5. US Dollar and Brent Oil Prices impacts follow very similar patterns to core-peripheral ones. Significant negative impacts are observed at lag lags two and five from US Dollar and after first period to fourth period for Brent Oil Price, which eventually turned to positive impact for eight and ninth lags. Spread shocks have positive responses which begin instantly and continues until fourth lag. Financial Corporations' Debt causes significant positive responses on spread at lags two and five.

Fig. 5
figure 5

Core countries-Greece bond yield spread responses to shocks in pre-crisis period

Impulse response plots of Peripheral-Greece groups' bond yield spreads with selected variables are shown in Fig. 6. Again, for Peripheral-Greece bond yield spreads, Brent Oil Price shocks have similar response pattern like in previous two groups. As observed in core-Greece spreads, Spread shocks have gradually decreasing positive impacts until third period. ES Debt to GDP Ratio Change shocks effect spread positively at lag two. Unemployment rates in IR and PT have significant negative impacts on spread at lag one.

Fig. 6
figure 6

Peripheral countries-Greece bond yield spread responses to shocks in pre-crisis period

Broadly, it is possible to say that spreads against core countries' bond yields are more sensitive to US Dollar, Financial Corporations' Debt and Brent Oil Price. Latter one is also an important contagion factor for Peripheral-Greece bond yield spreads. Spread is found as the most effective shock source on all three group spreads.

4.3.1.2 The Crisis Period

Industrial production and inflation in EA, unemployment rates in IR and IT and spread's own shocks have significant impacts on bond yield spreads between core and peripheral groups in crisis period (see Fig. 7). Industrial production has a negative significant effect at first lag which then rapidly converges to zero. Shocks in EA Inflation have significant positive responses on spread after first period until third period. Both unemployment rates have positive impacts on spread at first lag. Spread's own shocks have an instant and strong positive impact on itself; but shocks are no longer effective after first period.

Fig. 7
figure 7

Core-peripheral countries bond yield spread responses to shocks in crisis period

Core economies-Greece contagion (see Fig. 8) is triggered by short term powerful shocks of GR Debt to GDP Ratio Change at lags two with negative response and Spread's own shocks with positive response emerging instantly which turns into negative response for lags one and two.

Fig. 8
figure 8

Core countries-Greece bond yield spread responses to shocks in crisis period

GR Debt to GDP Ratio Change shocks and Spread's owns shocks effect peripheral countries-Greece bond yield spreads likewise core economies-Greece bond yield spreads (see Fig. 9). Beside these two, PT Unemployment has a positive impact on spread at lag two, which then loses its significance and settles around zero after eight period.

Fig. 9
figure 9

Peripheral countries-Greece bond yield spread responses to shocks in crisis period

In the crisis period, number of transmission channels have seen decreased and shocks are significant only at short lags. This points to disintegration of EA countries during the crisis time and possible proactive strategies to prevent adverse effects to spread. An important finding is that between Greece and other groups, magnitude of impacts is very high. Together with Step 1 findings, Greece is found in an opted-out position among EA.

5 Conclusions

The 2008 US sub-prime crisis has been remarkable in its severity and has raised many concerns about the problem of contagion in financial markets. In particular, the risk of large shock transmissions in sovereign default has driven policymakers to invoke necessity of bailouts aimed at containing the negative effects resulting from shock propagation. In this context, understanding the determinants of financial contagion can be particularly relevant for policymakers to take corrective actions and investors to implement preventive hedging strategies and eventually design the most suitable crisis management policies. Shedding light on the contagion determinants may be useful for investors who can derive relevant information about countries which are less sensitive to be affected by shocks, orienting thus their investment strategies.

Major challenge of such examinations is their complex nature; there are too many candidate variables and it is not an easy -and sometimes impossible- task to form proper models and obtain consistent results. Instead of making subjective modelling decisions, which are mostly based on prior knowledge and/or intuitions, implementing machine learning methods without any restrictions possess more opportunities in terms of information revealing from data. Besides, more meaningful and reliable outputs can be reached by using metaheuristic optimization algorithms for variable selection.

In this framework, the present study has contributed to the empirical literature on contagion by investigating the determinants of shocks propagation in the Euro area with optimized learning and econometric models, using data for the period 2001–2015 from ten EMU countries (five core economies and five peripheral countries). First part of our analysis show that Greece must be considered as a separate country than other peripheral countries due to its government bond yield's distinct behaviour.

Overall, our analysis indicates that innovations in bond yield spreads between groups represents the most significant source of shock propagation in the Euro Area and that other global indicators—especially US dollar/Euro exchange rate, Financial Corporation's Debts and Brent Oil Price—form the most relevant subset in increasing the probability of a contagious event. In contrast our findings reveal a less relevant role played by macroeconomic fundamental variables in attracting bear market speculative attacks that could generate financial tensions upon the public accounts, short selling strategies on public securities and consequently increase the risk of contagion. It is worth noting that the economic literature has suggested other possible determinants of shock propagation in addition to those considered in this article, such as changes in risk aversion or an updating of creditors' beliefs about the likelihood of a sovereign default. Therefore, further lines of research could assess these other channels so that policymakers can be fully informed about the potential externalities from a sovereign default. Finally, our findings could induce to analyse in detail the risk of contagion resulting from speculative strategies of institutional investors, above all in those countries or areas with structural weaknesses that therefore may significantly suffer from a speculative attack, as happened in several EMU countries in recent years.