Systemic shock propagation in a complex system

We study the effects of delivering a shock to a complex system comprising components (‘agents’) that interact in a pairwise fashion, independent of other parts of the system and with no central control. There are three aspects to the contribution of this paper. First, shock propagation in a network is developed purely from fundamental principles of complex systems. Second, systemic risk is shown to arise naturally in such a complex system. If a shock is delivered either to one agent or to many agents simultaneously, that shock may be transmitted further, thereby resulting in systemic risk. Third, the monetary loss to the entire system as a result of systemic shock is quantified. Simulations are used to study two particular characteristics of the interactions. The first is the resistance or susceptibility of individual agents to a shock. The second is the time it takes for the shock to affect the entire system. The results show that if a shock is applied to all agents in a network, the systemic effect of that shock is transmitted very quickly. Applying a shock to very few agents results only in an idiosyncratic effect. If an agent can transmit the shock further, a systemic effect will result. The recovery period for agents affected by a systemic shock can be orders of magnitude greater than the time taken for the shock to take effect. The overall effect of the shock on the system is quantified by formulating a ‘contagion index’, which measures the ratio of the total capital lost due to the systemic effect to the total capital before the shock was delivered. The result (approximately 7%) is consistent with other studies, but is more widely applicable because it is not based on one empirical data set.


Introduction
The purpose of this research is to study financial systemic risk within the context of a complex system. It is important to distinguish the term complex, used as a technical term in the sphere of complexity science, from its colloquial use as a term that means not easy. In our context, we mean the former and will link it to financial systemic risk and contagion. The question What is complexity?
is best answered in a comment from Alain Barrat (Centre de Physique Théorique   Pajot (2018). It is quoted below in full.
The terms 'systemic' and 'systemic risk' will be used in this paper to describe a particular type of emergent behaviour. A good description of systemic risk may be found in the following definition from the Systemic Risk Centre (http:// www.systemicrisk.ac.uk/systemic-risk): Systemic risk refers to the risk of a breakdown of an entire system rather than simply the failure of individual parts. In a financial context, it captures the risk of a cascading failure in the financial sector, caused by interlinkages within the financial system, resulting in a severe economic downturn.
The above text goes on to distinguish a 'systemic' effect from an 'idiosyncratic' effect. The former is an effect that is common within an entire system, whereas the latter is limited to a single or a few parts of the system. The essential idea of a complex system is that interaction leads to emergent behaviour which is not determinable in advance. Emergent behaviour in the form of a systemic effect follows naturally from those interactions. The premise is that interactions between two agents within a system, which could easily manifest initially as an idiosyncratic effect, can result in a systemic effect in certain circumstances. With that premise, systemic risk leads naturally from complexity. Simulations in Sect. 4 of this paper will demonstrate the systemic effect of introducing a shock into a complex system. This point will be amplified in Sect. 1.2. The shock is propagated throughout the system (i.e. it is a contagion). Then, the emergent behaviour of the system is, in a sense, predictable. Nevertheless, the behaviour of individual agents within the system is not.

Structure of this paper
Immediately following this section are further notes on how interactions within a complex systems can result in systemic behaviour (Sect. 1.2). The previous work on modelling complex systems and systemic risk is summarised in Sect. 2. The main subject of this paper is a mathematical model of complexity. When a system is given a shock, a systemic effect can result under certain circumstances. The model is introduced and developed in Sect. 3. Simulation results from this model are reported in Sect. 4, and financial examples are also given.

The link between complex systems and systemic risk
In the introduction, we indicated how the concepts of complexity and systemic are linked: they have a common ancestor. That link is usually not explicit. Discussions of complexity tend not to explore systemic effects, and discussions on systemic risk do not propose complexity as a transmission mechanism for that risk. Therefore, the conceptual contribution proposed in this paper is to make the complexitysystemic link explicit.

Agent interaction: definition and notation
In the model described in Sect. 3.2, the mechanism for interaction between two agents is summarised. We denote such an interaction by A1 = A, B meaning that agent B tries to influence agent A, and the result of that interaction is A1, who is an influenced agent A. Agent B remains unchanged. This interaction is shown diagrammatically in Fig. 1. Sequences of pairwise interactions are shown in Fig. 2. Figure 2 illustrates how a systemic effect can be produced as the result of introducing a shock to a system. The shock is represented by an external agent E, and other agents are represented by Axy, where x and y are major and minor sequence numbers indicating an order for interactions.
The labelling is such that at each interaction, the minor label for the influenced agent is incremented by 1. For example, the interaction A1.0, A2.0 produces agent A1.1. Figure 2 shows that the shock is not introduced immediately, but is first transmitted to agent A3.2 (i.e. agent A3 has already had two interactions). The effect of the shock is transmitted further by agent A3.2 such that after very few interactions, all but one agent (A6) has been affected. More precise details of interactions and the transmission mechanism will be discussed in Sect. 3. The general characteristics of complexity are discussed in detail in chapters 1 and 2 of Rzevski and Skobelev (2014). It should be noted that a further complex system characteristic, adaptivity, does not formally form part of the model proposed in this paper, although it is discussed in Rzevski and Skobelev (2014). The adaptivity property is partly addressed in Sect. 3.6 and will be the subject of a separate paper. The relationship of the agents to a network will also be discussed. See Sect. 3.

Previous work on complex systems and systemic risk
The underlying concepts of complex systems (namely agentagent interaction and self-determination), and of systemic effects (principally one event being the cause of another) have only been linked previously in passing. The thesis of this paper is that they are naturally linked, almost to the extent that they are indistinguishable. Developing this idea further, systemic effects are caused by agent-agent interactions in a complex system. All of the simulations presented in this paper are a direct result of systemic effects arising from agent-agent interactions. However, the link between the two concepts 'systemic' and 'complexity' has been mentioned briefly by other authors. In this section, we summarise some of those comments and also discuss other approaches to the quantification of systemic risk.

The link between systemic risk and complexity
The link between systemic risk and complexity has been developing for at least five years. Yellin (2013) Prasanna et al. (2010) and Franklin and Gale (2000)) to show that systemic effects (i.e. contagion) occur less frequently and are less severe for low degrees of network connectivity. The reason given is incomplete information or a lack of coordination among market participants. One way to mitigate systemic risk in this context, she suggested, is to establish the use of central counterparties for OTC financial transactions. They reduce network connectivity considerably and therefore reduce contagion. Use of central counterparties can introduce additional risk due to concentration. The point is emphasised by Freixas et al. (2015). They argue that financial regulation has been focused on the risk for individual financial institutions, not on the financial system as a whole. As a result, banks have only their own interest in mind, so they behave in ways that benefit themselves only, but undermine the system as a whole. For example, banks hit by a negative shock can deleverage to relieve capital pressure, thereby causing a credit crunch and exacerbating the initial negative shock.
The European Central Bank De Bandt and Hartmann (2000) considers that the notion of contagion, often a strong external effect, is an essential component of systemic risk, and that such contagion works from institution to institution, and also from markets or similar systems to those institutions. They distinguish between idiosyncratic shocks, which are due to only one institution, and systematic shocks, which affect many institutions simultaneously. Either way, they then envisage the idea of continued transmission of an initial shock throughout a network. That constitutes the systemic effect, although the mode of transmission is not explicit. De Bandt and Hartmann concentrate on contagion models in which rational decisions are made, based on individual knowledge. Chen (1999) is an example of such a model. It is based on local observations within a network with Bayesian decision making. Those factors do not matter immediately, but they do have a bearing on further ideas in this paper, namely that such transmission also encompasses the ideas of irrational decision making, influence and resistance. De Bandt and Hartmann cite evidence that many banking crises are related to macroeconomic fluctuations and other aggregate or regional shocks. Therefore, the use of an External Agent proposed in this paper is justified.

Measurement and detection of systemic effects
It appears that it is not always straightforward to detect and measure systemic effects. In the paper by De Bandt and Hartmann (2000), the authors cite studies indicating that systemic effects may be studied via extreme co-movements in stock market returns, deposits (the two most reliable indicators), exchange rate returns, interest rates and sovereign spreads. Care must be taken to look at the right time and for the right type of effect. Some movements represent investor preferences, which were not treated as systemic. The arrival of bad news is a particular trigger event which may precipitate a systemic effect, even if unwarranted. Laeven and Valencia (2008) identify 124 systemic banking crises over the period 1970 to 2007. They provide only a loose definition for the term systemic and do not give details on extent or transmission. Nevertheless, the overall figure, 124, gives some idea of the extent of systemic effects. Kannan et al. (2009) implicitly embed systemic effects within wider business cycles. Such business cycles typically have a recession period of about one year, followed by a recovery period of about five years. The authors are explicit in stating a criterion for measuring a systemic effect: a move of an economic indicator of more than 1.75 standard deviations from the mean indicator value prior to the start of a shock. Smaga (2014) mentions the idea of 'systemic importance': some institutions are more prevalent in transmitting systemic effects than others. He also makes the point that even if an institution has little systemic importance during a boom, it may be very important during a recession. The reason is asymmetric information and lack of informational efficiency within financial markets. Consequently, systemic risk is not always reflected in financial market variables. He also cites transmission of shocks between interconnected elements of the system as key in spreading systemic risk. He suggests that systemic risk should be measured as the degree to which a single institution 'pollutes' financial stability. The state parameter in the analysis presented in this study does exactly that.

Mechanisms for transmitting systemic effects
In this section, we describe briefly the principal classes of model that incorporate the elements of systemic risk, complexity and measurement. Caccioli et al. (2018) review a selection of such models and include extensions of some of them.

Markov models for credit default
The essential element of Markov models for credit default is a classification of a counterparty in terms of a credit rating, with a probability of transition from one rating to another.
If there are J credit ratings, denote the probability that a counterparty X (or 'agent' in complexity terminology) has a credit rating j (0 ≤ j ≤ J ) at time t by P(X t = j). Let the conditional probability of a transition from a rating j at time t to a rating k at time t be p jk = P(X t = k|X t = j). Then, the probabilities p jk (0 ≤ j, k ≤ J ) define a transition matrix P. When all possible states at time t for the Markov process are organised in a vector S t , the probabilistic evolution of the Markov process can be represented by the equation S t+1 = PS t .
A detailed example with extensions is given in Kiefer and Larson (2004). Also, a neat numerical example may be found at https://www.vosesoftware.com/riskwiki/CreditratingsandM arkovChainmodels.php. At any given time, the total loss to the system can be calculated by noting which counterparties are in the default state at time t, their probabilities of default (such as P(X t = de f aulted)) and multiplying by the amount of capital lost.
Markov models are particularly appealing because of their simplicity, but they are rather restrictive. They are limited to the credit risk context and require the imposition of a credit rating. The idea of systemic risk is essentially a secondary consideration, and the concepts of complexity only enter in more advanced models. In practice, it can be difficult to determine the transition probabilities. The literature abounds with extensions of the basic model described.

Systemic risk and contagion models
This category explicitly models systemic risk from the outset, rather than noting that a systemic effect is a consequence of the model. The method of Cont et al. (2013)-hereinafter the Cont model-is a prime example, as it also references a specific network topology, with a transmission mechanism for contagion over that network. However, the topology is still static and deterministic. Cont et al. (2013) also define a metric for the systemic importance of institutions: the Contagion Index. This is defined as the expected loss to the network triggered by the default of one financial institution in a macroeconomic stress scenario. The Contagion Index takes into account both market shocks to portfolios and contagion through counterparty exposures. The premise is that most financial institutions present only a negligible risk of contagion, but a few are capable of generating a significant risk of contagion through their failure. We note this model in some detail because it has a bearing on the complexity model which is the subject of this paper. Many of the expressions used in our complexity model have equivalents in the Cont model. The notation has been amended to correspond more closely to our complexity model. Equations (1), (2) and (3) below all have parallels in Sect. 3 with corresponding results in Sect. 4.
With reference to a network in which the nodes represent financial institutions, let E i j represent the exposure of node i to node j, let the initial capital for node i be C i (0), and let the recovery rate for node i be R i . The capital for node i after time t + 1 is given as a function of the capital after time t and the sum of exposures to nodes with zero capital (the defaulted ones) by: The extent of contagion due to node i at time t is measured by the default impact Δ i (t): the capital lost by node i plus the contagion capital lost by other nodes. (2) Then, to measure the total systemic impact of an institution, the Contagion Index,Δ i (t, z), is defined as its expected default impact when the network is subject to a macroeconomic stress z, applied to the institution. The value z is determined from a random variable Z which has a predefined expected value that represents a large shock. (3)

Systemic effect models: variations
The Cont model contains the elements that many similar models rely on: a network, an interaction mechanism and a contagion propagation mechanism. In this section, we summarise some of the variations on the Cont theme. Gai and Kapadia (2010) describe a base model in which the focus is on the 'terms and conditions' of the interaction between a pair of banks. Their model starts with a predefined network in which each bank is represented by a node on a directed and weighted graph, where the weights represent exposure size. For bank i, those exposures comprise (simplifying the notation): interbank assets, A i , interbank liabilities, L i , illiquid external assets such as mortgages, M i and external liabilities such as deposits, D i . A solvency condition is expressed in terms of two parameters φ and q, where φ is the fraction of banks with obligations to bank i that have defaulted, and q is the resale price of the illiquid asset. The solvency condition is Equation 4 can be rewritten in terms of the capital buffer (assets-liabilities), K i , for bank i, Contagion then spreads in the following way. If bank i is linked to j others, it will lose a fraction 1/ j of its interbank assets when a single counterparty defaults. Therefore, Eq. (5) implies that the only way default can spread is if there is a neighbouring bank for which The probability that Eq. (6) applies for all j > 1 gives a measure of the vulnerability of bank i to default. The task is then to estimate that probability using any data available. Equation 6 is a more specific form of Eq. (1), which does not give any details of how a default might occur. Equation 6 is also the equivalent of our default condition in Sect. 3.
May and Arinaminpathy (2010) concentrate on how failure-causing shocks can arise in a network, and how they can be propagated by interbank lending-borrowing or by liquidity effects. In a similar way to Gai and Kapadia (2010), they use a simpler solvency condition (with the same notation as above, with γ meaning 'net worth'): If the probability that any one of j banks is linked to any other is p, the mean number of connections is z = p( j − 1). Now let θ be the ratio of outgoing loans to assets.
With this definition, the failure point is the condition (1 − θ) f > γ , in which f is the fraction of assets wiped out by the shock. The loss is then distributed equally among the defaulting bank's creditors. Therefore, each of the z creditors experiences on average a shock of magnitude (1−θ) f −γ z . This provides a mechanism for contagion propagation.
The failure condition implies an assumption that once a bank fails, all its external assets are lost. May and Arinaminpathy (2010) justified this as an extreme liquidity effect. If some recovery is possible, not all of the difference is lost. They argue that a necessary and sufficient condition for not all the difference to be lost is θ z > γ . Nier et al. (2007) present a hierarchical picture of the immediate consequence of default. There is an assumed priority of (insured) customer deposits over bank deposits which, in turn, take priority over net assets. Let s i be the size of an initial shock applied to bank i. That loss is first absorbed by bank i's net assets (capital buffers) K i , then its interbank liabilities L i and lastly its deposits D i . The bank defaults if Then with the assumption that all of the j creditor banks receive an equal amount of the initial residual loss, each creditor bank J absorbs a loss s J = s i −K i j . If the amount s J ≤ K J , bank J can absorb the loss. Otherwise bank J's residual loss s J − K J is transmitted to bank J's depositors and the contagion spreads further. Simulations show that contagion does not decrease linearly with bank capitalisation. For high levels of capitalisation only the first bank defaults. When the capitalisation decreases to between 1 and 4% of a benchmark level, second-round defaults occur. Third-round defaults only occur if capital decreases below 1% of the benchmark level.

Which banks are systemically important?
Little has been said so far about which banks pose systemic risk and which do not. Battiston (see Battiston et al. (2012) and Battiston et al. (2013)) attempts to do this using a metric DebtRank (DR). DR is intended to measure the systemic importance of a bank even when default cascade models predict no impact at all on amounts lost. It is defined as the fraction of the total economic value of a network due to a shock that hits a bank. Specifically, take a chain of unsecured loans granted by bank k to bank j and then by bank j to bank i. The amounts of these loans are x k j and x ji , respectively. Let E i , E j and E k be the equity of the three banks. Then, their total equity is E = E i + E j + E k . Then, the Deb-tRank for bank i is the following weighted sum, with weights The result of applying the DR metric to Italian banks is that the DR predicts sizable contagion effects. Measures which only account for a single transfer of default between two banks typically show no impact at all.
In cases discussed so far, the criterion for determining susceptibility to systemic risk has been taken as 'zero capital' or similar. That type of criterion only works by looking back at what has happened. It is not forward-looking. As an alternative, Huang et al. (2009) suggest an indicator of systemic risk that attempts to be more predictive, although it is much more complicated to calculate. This is their distress insurance premium-the theoretical price of insurance against financial distress. This indicator is calculated by constructing a hypothetical portfolio that consists of debt instruments (mainly bonds) issued by banks. The indicator of systemic risk is defined as the theoretical insurance premium that protects against distressed (credit) losses of this hypothetical portfolio in the coming three months. The components of the distress insurance premium are risk-neutral probabilities of default (PDs) and equity returns (as a proxy for asset returns). The steps in the calculation are: 1. For each bond i that defaulted at time t, calculate the risk neutral probability of default (PD i,t ) using published credit default swap spreads (S i,t ) and assumed recovery rates PD implied from the CDS market is a forward-looking measure. 2. Form a vector X t of bond prices and economic measures E i,t such as the S&P500 and VIX indices 3. Formulate 12-week future projections of X t+12 using correlations based on the X t and the E i,t 4. Formulate 12-week future projections of PD I ,t+12 using correlations based on the X t+12 and the PD I ,t 5. Define Monte Carlo bond pricing scenarios, each linked to a particular bond. Define distress as a situation in which at least 15% of total liabilities of those bonds are defaulted 6. Run the scenarios defined by PD I ,t+12 and X t+12 , and determine which have defaulted at time t + 12. For each defaulted bond b i , calculate the loss given default (LGD i ) as bond value at time t + 12 less its value at time t The required insurance premium for each bond is then the indicator of systemic risk. The trend in insurance premium was found to follow the average PD series and correlations in the banking system very closely. This result is consistent with the conventional view that higher default rates and higher exposures to common factors are both symptoms of higher systemic risk.

Models of population dynamics
Models of population dynamics are more appropriate for very large populations. Examples are cases of runs on banks, or bond transactions, or even the spread of rumours that a bank is in trouble.
The discussion by Hatchett and Kuhn (2006) is an example of a discrete time model. Their model is rooted in the idea of a population of size n, although they do not explicitly mention a numerical size. However, their model deviates immediately from a traditional population-based treatment because they use a principal random variable to denote whether or not a bank has defaulted. Thus, let n i,t be an indicator variable that bank i has defaulted at time t (it takes two values: 1 means 'defaulted' and 0 means 'not defaulted'). Then, equation 10 governs default. In that equation, W i,t is a 'wealth' variable, such that default is assumed if the wealth drops below zero, and H is the Heaviside function.
The wealth variable is a composite that comprises an initial wealth, stochastic components that represent changes in wealth (including defaults) and a Gaussian random component. Development of this model indicates that the effect of interactions is relatively weak in typical economic scenarios, but is pronounced in times of large economic stress. Thus, contagion is restricted to economic shock scenarios.
Contagion models based on continuous time have focussed on the spread of disease. Such models have been known for some time. Here, we summarise the base model, known as the SIR (susceptible-infected-recovered) model, details of which may be found in, for example, Hethcote (2000). Following a brief statement of the SIR model, we discuss an augmented version of it, which incorporates a time delay. Equation (11) shows the base SIR differential equations. All three components with their total N denote numbers of individuals, and all are functions of time, t. Initial conditions and other constant parameters are shown in greek typeface.
In order to apply them to the context of financial contagion, we associate: Wang et al. (2018) propose an updated version of the base continuous time model (Eq. 11) in which the same three states S, I and R are present. The original purpose of the model was to study the spread of a rumour in a social media context. With some adaptions, it can be used to model the spread of interbank financial contagion. In the context of social media, a person may be affected by his/her neighbours such that having been 'stimulated' several times by those neighbours, he/she will acquire the opinion of those neighbours. This is effectively a voter model with a time delay. In the context of financial contagion, the 'stimulus' is the default of a counterparty. A bank may be forced into default only if fewer than a critical threshold of its counterparties have already defaulted. In general, thresholds are likely to be lower in the context of banking than they are in the social context. Otherwise, the situations are very similar. The same three distinct states are recognised at each time step, although in Wang et al. (2018) the infected state is called affected and is designated the A-state. A bank in the S-state has not yet been affected by a systemic shock because the stimulus received from its neighbours is below its adoption threshold. A bank in the A-state has been affected by such a shock, as the stimulus received exceeded its adoption threshold. A bank in the R-state has recovered from any stimulus applied to it. For simplicity, set all banks at the same adoption threshold T. If p(X i ) is the probability that a bank i is in state X (where X is one of S, A or R), then, since there are only three states, Suppose that a bank has to receive up to m stimulae from its counterparties before it is affected (i.e. it has been shocked). The probability of having received k out of m stimulae by time t is where θ(t) is the probability that a randomly chosen counterparty bank has not transmitted a systemic effect to bank i by time t, and 1 − ρ is the probability that bank i is initially susceptible.
If there is a time-delay τ in transmitting a contagion, the equivalent 'time-delay' probability is obtained by replacing t by t − τ to get the following equation. (14) Then, if u is the probability that bank i can survive for a time-delay τ , the probability that bank i receives the shock by time t is In that case the proportion of banks in the S-state at time t is, where p k is the probability that k stimulae have been received: Given this expression for the proportion of banks in the S-state at time t, the proportion of banks in the A-state at time t is governed by the differential equation Lastly, the proportion of banks in the R-state at time t is governed by the differential equation Solving Eqs. (17) and (18) forâ andr then gives, together with the expression in Eq. (16) forŝ, the complete timedelayed dynamic of the system. The results indicate that with no time delays, R(t) is monotonic increasing with t. With time delays, both S(t) and A(t) show jumps in the direction of the R-state at the values of the time delay τ . Typically, there are three major jumps of this kind, followed by more smaller jumps, before all banks have recovered over the time horizon considered. It is not immediately clear how long that time horizon is, but given the 2008 banking crisis, the time horizon should be in the order of at least ten years.

Agent-based optimisation algorithms
In this section, we highlight some optimisation algorithms that are based on agent-agent interactions. As their principal aim is optimisation, they could be appropriate for modelling recovery after a shock is delivered, but not for shock initiation or propagation. Each has its own terminology, which has been cast in the terminology of complex systems.

Ant colony optimisation (ACO)
ACO is a probabilistic technique in which a search for an optimal solution proceeds on a predefined directed network. The ACO method originates from Dorigo (1992), and many subsequent summaries exist. See, for example, Dorigo et al. (1996). A transition matrix is associated with the network, and agents search for an optimal 'next move' along an arc leading from the agent's current node. That selection is based on arc 'intensity', which is increased every time another agent uses the arc. Those intensities define the transition probability for each available arc connected to a node. The probability that agent k moves from arc i to arc j is given by the first line of Eq. (19). In that equation, τ i j is the intensity on edge ij, η i j measures the desirability of edge ij, and α and β are influence parameters. The second line gives a common updated 'intensity' on arc ij. It incorporates a rate, ρ, and L [k] i j is the cost of agent k's move, typically measured by the length of arc ij.
After the agent has moved, it strengthens the arc by increasing its intensity. This is an adaptive system, as each agent is able to 'read' what other agents have done, but there is no central control. ACO has been used extensively in optimisation problems since its inception. Two recent advances on the method may be found in, for example, Deng et al. (2017bDeng et al. ( , 2019.

Particle swarm optimisation (PSO)
The PSO method originates from Kennedy and Eberhart (1995) and has many similarities with ACO. There is no formal network, but agents are sensitive to their near neighbours, so it can be argued that a dynamic network exists. An agent i is characterised by its 'position', X i and its 'velocity', V i . The agent records its 'local best position so far, X [L] i , and also has access to a 'global best position so far', X [G] i , determined by all agents in the system. These 'local' and 'global' views are used to calculate the next move, using the update equations below. In those equations, c L and c G are learning rates, and r is a random number in (0,1).
The result is that all agents appear to proceed as a group. There are clear parallels between PSO, ACO and the mechanism described in this paper. There are well-defined transition rules governing agent-agent interactions, and there is no central control. The group behaviour arises because every agent is able to monitor a summary of the entire system. An example of a recent improvement on PSO may be found in, for example, Deng et al. (2017a).

Complexity and systemic risk: methodology
Now, we discuss the subject of this paper: a simulation model that links complexity with systemic risk. The original model was developed in 2017 and is documented in Mitic (2018). The model sticks to the principles of complexity described in Rzevski and Skobelev (2014) and summarised in the quote from Barrat in the introduction to this paper (see Pajot (2018)). The framework described in Mitic (2018) has been extended to incorporate a shock mechanism for the purposes of this study. That mechanism will be described in Sect. 3.5. This model differs from previous models of systemic risk because it is based purely on the principles of agent-pair interactions, which lead to complexity. The only assumptions are those relevant to what happens when two agents interact. Thus, the base concepts of complexity and systemic are almost synonymous, the latter being an emergent behaviour due to the introduction of a shock.

Network considerations
The models in Sect. 2 are defined with respect to a welldefined network. Our analysis is different in that the existence of a network is implied, but is not necessary for simulations to progress. An agent-pair interaction implies that the two agents can be represented as two nodes in a network, an arc between the two representing the interaction. But that is merely a convenient visualisation since no formal network is defined.
There is one way in which it would be beneficial to consider that a network does exist. Consider a fully connected network in which each node represents an agent, and the arcs represent lines of influence. In other words, the arcs define the capability of one agent to influence another. Since the network is fully connected, any agent can influence any other. Not all such lines of influence need be used. Rather, they are available for use. This capability allows for a very fluid network. Arcs can emerge and disappear spontaneously. The simulations used depend on random interactions between agents, which implies that network paths are set dynamically, and are transient.

A mathematical framework for complexity
In this framework, an agent is modelled using a Beta function β(x, a, b) defined on the interval x ∈ (0, 1), where a and b are the Beta parameters in the range (1999). The parameters a and b are sufficient to define the agent's resistance to change and its state (see below) in the range (0,1). Formally, an agent X is a triple, defined in Eq. (21). In addition to the Beta function, Eq. (21) contains a parameter I ∈ (0, 1) that specifies the influence of an agent on another agent, and a string parameter Name that holds a designated name of the agent.
The definitions in Mitic (2018) referred to parameter x as the agent's view on some particular issue. For this analysis, we call that view the agent's state. The expected value of β(x, a, b) formally defines the current state of an agent X, and we denote it as in Eq. (22).
The resistance of an agent to a change of state, ρ ∈ (0, 1), is defined in terms of the standard deviation, σ , of the Beta distribution: Eq. (23). The form of the exponential in Eq. (23) ensures that the resistance is neither too fierce nor ineffective.
The interpretation of state in this context is the degree of debt default. An agent that has not defaulted has a state equal Fig. 3 Initial configuration for a group of 10 non-defaulted agents on the left, plus one agent Y in a state of near default on the right: before interaction to 0. An agent that has fully defaulted (i.e. is bankrupt) has a state equal to 1. Intermediate values for the state represent the amount of financial distress suffered by the agent. For example, it may have had one or more profits warnings, or it may have defaulted to a minor extent on a clause in a contract. The Beta function formulation is particularly useful for visualisation. The graphs of Beta functions that are tall and thin represent agents that are very resistant to default (because those agents have protections such as sufficient reserves in place), whereas graphs that have a wide flat profile represent agents that are more susceptible to default (those agents might have insufficient reserves). Figure 3 shows a (randomly generated) set of 10 agents (X 1, X 2, . . . , X 10) who are in a state of minimal debt default (x is nearer to 0 than to 1), with a further agent, Y, whose state is much nearer to full default. These agents have not yet interacted. The influences (parameter I) are indicated by their opacities. A strong solid colour means very influential, and a light pastel colour means not influential.

Agent interaction
Within the framework, the interaction mechanism between a pair of such agents is well defined (see Table 1) in terms of the influence of the agents concerned and also of their resistance to that influence. No assumptions are made about the ways in which the system can develop following a sequence of pairwise interactions. Indeed, a fundamental proposition in complexity science is that the system should exhibit selfdetermination. The implication is that it is not possible to tell in advance how a system will develop given its starting point. Systemic risk arises purely from the way in which pairs of agents interact.
The precise mechanism for pairwise agent interaction was described in detail in Mitic (2018). In any interaction between two agents X and Y, one agent, Y, influences the other, X, and remains unchanged after the interaction. Agent X emerges with modified Beta and Influence parameters. The convention

Fig. 4
Group of 10 agents (on the middle and left) and defaulted agent Y on the right: after interaction used to denote such an interaction is given in Eq. (24), in which X1 is the modified version of X after interaction.
The sequence in the following table (Table 1) is a summary of the interaction mechanism. Figure 4 shows the same agents as in Fig. 3 following a sequence of 10 interactions in which Y interacts with each of the 10 other agents separately.
Comparing Figs. 3 and 4, the effect of the agent most in default (agent Y -the rightmost one in both cases, with its peak at approximately 0.75) is apparent. That agent has forced the others further into the defaulted state. This is the start of a contagion effect, although it is not yet systemic because there is no chain of interactions.

State of a group of agents
An indication of the 'state' of a system can be gained by considering, indirectly, the states of all the agents within the system. Note that the definition of Group State in this section replaces the one given in Mitic (2018). The latter defines Group State as the mean state of agents in the system. However, that is an approximation. The strict definition is given here.
In a system with a large number of agents, it may be beneficial to partition the system and consider subsets of agents. For our purposes, where the number of agents in the simulations is small, it is sufficient to form only one group of agents. Formally, we define a Group of n agents X as a set: Then, the Group State,Ŝ X ,n is defined by a Beta function β(a , b ) in which the parameters a and b are weighted means of the Beta parameters a i and b i of each agent in the group (Eq. 25). The normalised weights (w i ) in Eq. (25) are calculated using the influences I i and resistances ρ i of each agent in the group.
Informally, we can think of the group state as the mean of the states of each member of the group, although Eq. (25) shows that the situation is actually more complicated than that.

Shock mechanism
We now extend the class of agents to incorporate a shock delivery feature, modelled as an External agent. An External agent is designated by an additional parameter, which triggers a different type of interaction behaviour. Similar to Eq. (21), an External agent E is defined as shown in Eq. (26), in which a fourth parameter is set to the value True.
An External agent is designed to deliver a shock to one or more agents in the system. The delivery is modelled by the interaction of the external agent with any non-external agent. The effect of the shock is to amend the Beta parameter ratio of the target non-external agent to reflect a bias determined by the external agent, but it is mitigated by the resistance of the target agent. In the External Agent-Agent interaction, a 'strength' parameter α ∈ (0, 1) determines the extent of the interaction. The use of the min function in ALGO SHOCK, below, ensures that the extenal agent does not completely dominate in the interaction. The algorithm used to calculate the amended Beta parameters a and b is: ALGO SHOCK : Shock mechanism 1. Calculate the absolute difference, d, of the states of X and E: Algorithm ALGO SHOCK allows a well-protected agent to be shocked to a limited extent but an agent with little protection to be shocked much more.
The effect of delivering a shock to any one agent is twofold: • to instantaneously change the state of the target agent.
• to convert the target agent's behaviour to that of an External agent.
The second bullet point produces the systemic effect. In terms of disease, an External agent acts as a contagion vector.
As an example, a shock may force an agent into full or partial default immediately. A second example is economic shock, which may affect a business so severely that it is either forced to cease trading or to take very drastic measures to survive. There have been several examples of this type of shock recently. In 2008, the world banking crisis resulted in a severe systemic effect, resulting from profligate lending practices. Its effect is still being felt eleven years later. It is described, with others, in Laeven and Valencia (2008). Leman Brothers ceased trading worldwide. In the UK, Royal Bank of Scotland (RBS) was effectively nationalised, and Northern Rock Bank was declared insolvent following rapid and concerted withdrawal of funds by its customers. All banks were affected to a greater or lesser extent. The degree of regulation increased for all of them worldwide, and all had to put To illustrate the effect of a shock, Fig. 5 shows the same group of 10 agents as in Fig. 3. after an external shock is delivered. The External agent is the one most to the right. The shock is delivered to each agent separately. The effect of the shock is to 'pull' each agent much further towards the defaulted state.

Recovery post shock
Given a response to a shock, it may be possible to recover a pre-shock state. In the context of credit default, it is more likely that an organisation would re-emerge as a new corporate entity or entities. In an economic context, sovereign states can recover economically, and there are clear examples. The 1930s depression in the USA is one. Measuring the variable state by GDP, the 1930 annual GDP (not seasonally adjusted) was $98.4bn. It fell to a low point of $58.3bn in 1933, and did not recover until 1940, when GDP reached $98.2bn. (see St Louis Federal Reserve Bank (2017). It took the demands of WW2 to stimulate recovery Crafts and Fearon (2010).
Two recovery models are proposed: Soft and Hard.

Soft recovery
In this recovery mode, agents attempt to adapt their behaviour in order to move towards a pre-shock state. This might be done, perhaps, by building up sufficient reserves or by costcutting. Agents interact 'as normal', but there is a pressure to move away from the shocked state. The model specifies that in any interaction, if the result is that the agent affected moves towards the pre-shock state, a move in that direction proceeds with an r ∈ (0, 1) relaxation augmentation. That is, there is an additional move of 100r % towards the pre-shock state. The change in the Beta parameters is limited to a fraction r of the calculated change. If the move is away from the P. Mitic pre-shock state, the result of the interaction is cancelled. This models the situation where an 'adverse' outcome is immediately rejected, and efforts are made to remedy the situation. Informally, we call this recovery mode 'lazy', since in any interaction, there is no initial intent to move towards the preshock state. The soft recovery model is then as follows.
Given an interaction X 1 = X , Y , let the state of agent X before and after the interaction with Y beŜ X andS X 1 , respectively, where the bar indicates an intermediate state.
The value of the intermediate state is then amended according to Eq. (27) to produce an amended post-interaction state for X,Ŝ X 1 .
The context of this paper is financial contagion and debt default. If we depart temporarily from this context, we can imagine a shock which works in the opposite direction. That is, the effect of the shock is to move the state of an agent from a value near to 1 to a value near to 0. In that case, provision must be made for the relaxation augmentation to be applied in the correct direction. This is a simple matter of accounting for the sign of the difference S X − S X 1 . An example of such a context is 'volume of complaints data'. 'State = 0' indicates no complaints, whereas 'State = 1' indicates a high volume of complaints. A shock that has the effect of eliminating the majority of complaints would be highly beneficial!

Hard recovery
In the Hard Recovery approach, a target state is set, and an agent tries to work actively towards the target. In principle, the target can be any state, but we take it to be the pre-shock state in the simulation in Sect. 4. Given the target, a relaxation augmentation factor r ∈ (0, 1) is used, but in a different way to the way it was used in Sect. 3.6.1. Denote the target state with a tilde:S X . Using the same notation as in Sect. 3.6.1, for an interaction X 1 = X , Y , the parameters of the Beta function for the resultant X 1 are set such that the state of X 1 moves towards the target by 100r %. See Eq. (28). The result is an extended (in time) geometric relaxation of the shocked state.
As with Sect. 3.6.1, in another context the shock can work in the opposite direction. In that case, Eq. (28) has to be amended by a sign change to account for the direction of travel to the target. The recovery period is very sensitive to the value of the relaxation augmentation parameter.

Systemic risk measures
Two systemic risk measures are considered. The first is the equivalent of Cont's Contagion Index,Eq. (3) in Sect. 2.3.2. The second measures volatility before and after a shock is delivered.

Systemic contagion index
We first describe a method to measure the total systemic effect within a system, if the shock is delivered to one member of the system. This is a parallel to the analysis of Cont in Sect. 2.3.2. However, Cont's systemic risk measure differs in one important respect from ours: it has to use a single empirical data set. We can go further because we can generate multiple simulated data sets. Therefore, we propose an equivalent but different Contagion Index measure, which calculates the ratio of capital lost due to the systemic effect, to the capital before the shock was delivered. With respect to a predefined list of n agents X = {X 1 , X 2 , ...X n }, the inputs for our Contagion Index calculation are: • A vector of initial capitals C, in which the component C i is the initial capital for agent X i . A capital C i = 0 means that the agent is in default. • An exposure matrix, E, in which each entry E i j gives the exposure of agent i to agent j. The major diagonal entries in E are the exposures of each agent to itself, and these entries are set to zero (E ii = 0, i = 1..n).
The algorithms below show details of the interaction process used to derive the Contagion Index,K and a countĉ of the number of interactions for a contagion to spread to all agents. A quick summary of that algorithm is that in a sequence of interactions, there is a probability that a counterparty will default on its debt. In that case, the other party to the transaction will suffer an expected loss of capital equal to the product of the probability of default and the exposure to the defaulter. Furthermore, the total capital within the system will be reduced by the same amount. Once one agent has defaulted, we assume that its capital is wiped out and it takes no further part in the process. The Contagion Index is the ratio of the total capital reduction due to those exposures to the total initial capital. The detail of our proposed calculation can be summarised in two algorithms.

Algorithm index 1
ALGO INDEX 1 is a process in which the index is calculated once, using a single simulated data set. The start is an initialisation stage. Following that, pairs of agents, selected at random, interact to simulate the way they could influence each other in reality. Those interactions comprise a calcula-tion of exposures, probabilities of default and expected losses at default.

Initialise:
(a) Induce a shock by setting one element in C to zero (b) Calculate the initial capital C ini = n i=1 C i (c) Initialise a total loss due to systemic risk for this instance, Λ m , to zero (d) Zero a counter,ĉ m , for the number of interactions 2. Initiate a sequence of interactions X i , X j in which i and j are chosen at random from the range 1..n. If X i has defaulted ignore this interaction. If not, continue. 3. Calculate the net exposure E j i = E ji − E i j . If E j i < 0 omit the next three steps as X j is not then exposed to X i : the exposure is the other way round. 4. Calculate the probability that X i defaults, P X i by drawing from an exponential distribution (common to all agents), E x p(2). Default X i if P X i < 0.1 by setting C i = 0. With this distribution, default occurs in approximately 10% of interactions. 5. Calculate the expected loss at default for agent X j , L j = P X i E j i 6. Reduce the total capital and X j 's capital by the amount of the loss: (a) Λ m := Λ m − L j (b) C j := C j − L j . Note that if C j ≤ 0, X j is automatically marked as defaulted (c) Increment the interaction count:ĉ m :=ĉ m + 1 7. When all agents have defaulted, calculate the Contagion IndexK m = Λ m C ini , and the interaction count,ĉ m .
(Outputs:K m andĉ m ) The outputs of ALGO INDEX 1 are used as inputs to ALGO INDEX 2. Those outputs are based on one simulated data set each, so each one in isolation is the equivalent of Eq. (3) from Sect. 2.3.2 (Cont's Contagion Index).

Algorithm index 2
ALGO INDEX 2 is a Monte Carlo procedure which calls ALGO INDEX 1 many times and calculates a mean value for the all the calculated values of the index. The outputK represents the mean values of many data set instances. Therefore, it is a more general result than that of (Cont's Contagion Index) in Eq. (3).

Volatility measure
In order to assess the volatility effect of the shock on the state before and after the shock is delivered, the standard deviation of the simulated state for a given period before and after the shock was calculated.
Suppose the shock is applied at iteration T to a group of n agents X, and the state volatility is measured for a period τ before and after the shock. Denote the values for the state of X for those periods by {Ŝ X ,n } T T −τ and {Ŝ X ,n } T +τ T , respectively. Then, the expression V X ,T ,τ in Eq. (31), below, provides the required volatility ratio measure. .

Simulation results
In this section, we report simulation results for a randomly generated group of 10 agents. General points that emerge are reported after specific simulation scenarios, in Sect. 4.8. The simulations trace the path of the Group State, defined in Sect. 3.4, over time. Agents interact 'normally' up to a certain time. After that time the shock is introduced. It should be noted that time is measured in number of interactions, not as a fixed-length duration. The actual duration between interactions can vary. Specific scenarios, with their results, are discussed below.

Parameter values
Prior to reporting simulation results, we give a general indication of the parameter values used, with an explanation of the reasons for choosing those parameter values. In each simulation, a single shock affects 10 agents. The number 10 is sufficient to model the effect of multiple interactions and is designed to model a typical small system of banks that trade in particular financial products (bonds, options, commodities, etc.). Ranges for the agent Beta parameters are chosen to model moderate extremes of protection against financial shock. Referring to Fig. 3, the well-protected agents on the left have Beta parameters in the ranges (10, 30) and (100,200). The poorly-protected agent on the right has 'reversed' Beta parameters 150 and 50. Agent influence parameters are generated at random from a U(0,1) distribution.
The strength parameter in Algorithm ALGO SHOCK that governs the extent of the shock varies in the range (0,1], and its value depends on whether the shock is mild (0.1), medium (0.4) or severe (1.0). Its effect is to change an agent's state (i.e. its Beta parameter values) to close to the those of the external agent that originates the shock if the shock is severe, and to change an agent's state by only a small amount for a mild shock. The shocking mechanism has been chosen to simulate an effect that happens quickly but not immediately. We have assumed that shock transmission from agent to agent is 100%. That assumption could be relaxed in further investigations.
In recovery, the relaxation augmentation parameters on Sects. 3.6.1 and 3.6.2 can be changed to reflect the speed of recovery. For soft recovery, the value r = 10% models an active attempt by the agent to retrieve a pre-shock state. That value represents a slow but gentle effort. For hard recovery, r is set to 0.2 in Eq. (28). That value is intended to simulate a determined effort to return to the pre-shock state, but is also open to discussion.
In order to calculate a value for the Contagion Index (defined in Sect. 3.7.1, with numerical results in Sect. 4.9.1), bank capitals and exposures have been selected at random, and in arbitrary monetary units, to reflect a reasonable range of operational characteristics. The capitals are such that the ratio of smallest to largest is 1:10. The exposures vary between 1 and 100%, reflecting a very diversified portfolio and a totally concentrated portfolio, respectively.

Shock delivered to a single agent
The first simulation is very basic: a shock is delivered to a single agent. Figure 6 shows this result for the three distinct agents. The shock is felt by the agent who has good shock protection (Red), but this agent is not severely affected. The shock has a severe effect for the agent with poor shock protection (Blue). The (Green) trace shows an agent with medium shock protection. In each case, the state continues The Shock is delivered to only one agent in a group: no systemic effect at its 'shocked' level and does not recover, since no recovery mechanism is in place.

Shock delivered to a single agent in a group
Each trace in Fig. 7 shows the Group State before and after the shock is delivered to only one agent in the group. The affected agent is chosen at random, and there is only one instance of a shock delivery. The three cases represent single agents who start with good (Red), medium (Green) and poor (Blue) shock protection. Pre-shock, there is a relatively stable period for all three. Post-shock, the External agent takes no further part. The effect of the shock is clearly visible (at interaction 100), but is not felt immediately. The shock is characterised by a period of greater instability immediately following it, but the depth of the shock is almost imperceptible. The single shock remains limited to one agent, and there is a no systemic effect. It appears that the opposite occurs: other members of the group can reduce the impact of the shock.

Shock delivered to all agents in a group: limited systemic effect
This is similar to the previous case, except that the shock is delivered to all agents in the group. After that, the External Fig. 8 The Shock is delivered to all agents in a group Fig. 9 Systemic Shock passed from agent to agent agent takes no further part. Figure 8 shows that in each case the state is shifted further towards the default state. Instability post-shock is again present. There is a therefore a limited systemic effect because the effect is not transmitted beyond the initial targets. However, this case does illustrate that there is much more damage if a shock hits all agents rather than only one. Figure 9 illustrates the effect of a true systemic shock. A shock delivered to only one agent is transmitted to other agents in interactions. The effect is marked even for the well-protected agents (in Red). No agent can hide from the systemic effect, even with apparently adequate protection. The state of default increases with the number of interactions, independent of the degree of protection of the agent. Figure 10 illustrates an instance of recovery from a shock if the Soft Recovery mode is used. The mechanism for this recovery mode was discussed in Sect. 3.6.1. The figure shows the shock, followed by a short period near the fully defaulted level in which preparations for recovery may be initiated. Following that, recovery is extremely volatile (i.e. difficult!).

Soft recovery
Most notably, recovery is extremely slow. In this case the relaxation augmentation is 20%. The scale on the Interaction axis extends to 4000 interactions, showing that the recovery period (about 3000) is very large compared to the period needed for the shock to take effect (about 30). This recovery mode is very dependent on the relaxation augmentation parameter. If no augmentation applies, any change of state in the 'wrong' direction is ignored and all changes of state in the 'right' direction are applied with no further amendment. The result is an extremely slow recovery time. In practice, the value of the relaxation augmentation parameter would have to be determined by fitting data.

Hard recovery
The Hard Recovery model represents a concerted effort to move towards a target state. Agents are forced to take action so as to move in the 'right' direction. Section 3.6.2 has implementation details. The Red case in Fig. 11 is for a shock experienced by an agent with good shock protection, the Blue case is for poor shock protection and the Green case is for medium shock protection. The target state in all cases is the initial 'low risk' state. All show some similarity with the result of the Soft mode in Fig. 10, but there are clear differences. Recovery is faster and much less volatile. This is not surprising, as moving in the 'wrong' direction only occurs as a stochastic effect. However, the simulations show that recovery is not to the intended 'low risk' state. It is only part way there. This is an illustration of emergent behaviour.

Simulation results: general findings
The simulations show that: 1. If a single agent is hit by a shock there is always an effect, and its depth depends on the strength of the shock. Agents can protect themselves against such shocks, but such protection is only effective to a limited extent. 2. If a shock is delivered to only one member of a group of agents, the state of the group is largely unchanged. The difference between before and after the shock is an increase in volatility of the group position. That volatility usually diminishes with time. Effectively, a single agent is 'infected', and every time that agent interacts with another agent, the infection spreads a small amount. The spread is diluted because the affected agent does not behave like the deliverer of the shock, which has a much more significant effect. 3. As the number of agents affected by the initial shock increases, a change in state of the group (towards a defaulted state) is increasingly apparent. 4. In the case of systemic external shock (Sect. 4.5), in which agents pass on the full effect of a shock to other agents, contagion spreads much more rapidly. In that case it is only necessary to influence one agent initially. It takes about 15-20 interactions to change the state of all 10 agents if they are poorly protected. If they are well protected it takes 50-60 interactions before the state is changed for all agents. Even well protected agents cannot escape the systemic effect.

Examples of shock delivery: financial data
Volkswagen Emissions Scandal A recent example of an external shock delivered to a system is that of the Volkswagen Emissions Scandal in September 2015. US regulators found that software designed for diesel cars with Type EA 189 engines gave false emissions data. There was outrage when this was first widely reported in the press. Major coverage was on 21st September 2015, although there had been hints of the problem in the preceding year. The full story may be found in Bachmann et al. (2017), and also in numerous news reports by googling Volkswagen Emissions Scandal. The VW share price suffered greatly, as shown in Fig. 12. The share price shock is marked by the rapid fall in share price: trace BC, which took about 2 weeks. The recovery period is the trace CD. It took more than 2 years to recover the September 2015 price. The trace AB is pre-shock, and marks a period of falling share price in the 'system'competitor motor manufacturers. Interestingly, the Emissions shock was not systemic: other motor manufacturers were not affected by this shock. During the shock period, their share prices fell much less than Volkswagen's as part of a general trend.

Brexit
An example of an economic shock without recovery is that of the Brexit referendum on 23rd June 2017. Figure 13 shows the GBPEUR fx rate from September 2015 to June 2018. The reaction to the referendum result was an instantaneous fall in the exchange rate, shown by trace BC on the graph. This followed a gentle decline (trace AB), probably reflecting general unease pre-referendum. Post-referendum there has been no recovery (trace CD). Again, this shock affected the GBP fx rates, and is not systemic.

The Dot-Com Bubble
A stock price example where systemic risk is present-the Dot-Com bubble-is given by Quartz.com in Fig. 14. An account of the Dot-Com bubble may be found in DeLong and Magin (2006). Technology-based companies had been growing throughout the 1990s. With the growth of the internet towards the end of that period, many internet-based companies, known as 'dot-coms', were launched, but a significant number of them were highly overvalued. Consequent failure left investors with significant losses. The Nasdaq Composite Index peaked on 10th March 2000, before crashing when funding ceased. Figure 14 shows this peak and the shock that followed, which lasted for an extended period of about 2.5 years. The recovery period took about 8 years. An interpretation of the systemic effect is that contagion, in the form of funding withdrawal, spread as investors saw the value of their investments diminishing.

Systemic risk measures
Two sets of results are reported here: one for volatility before and after a shock, and one for the Contagion Index, defined in Sect. 3.7.1.

Contagion index results
Algorithms ALGO INDEX 1 and ALGO INDEX 2, described in Sect. 3.7.1, concentrate on deriving an expected value for the Contagion Index. Because those algorithms incorporate a Monte Carlo procedure, it is easy to derive an empirical   Table 2 gives summary statistics for those distributions. The statistics forK (equation 29) andĉ (Eq. 30) are based on 100 independent calculations of both. A histogram of those results (Fig. 17) shows an approximately Normal profile. The calculation ofK in table 2 is based on a total initial capital of 5771 (the sum of the representative capitals used in the simulation) and a sample size of 1000. The Contagion Index is the mean of the systemic losses divided by the total initial capital (from ALGO INDEX 1). The Interaction Count is the mean value of the counts.
The ratio of mean exposure to mean capital used in the calculation for the results in Table 2 was approximately 0.13. The ratio of mean exposure to mean capital loss is important because there is a significant dependence of the value of the contagion index,K , on that ratio. If the ratio is very small, very little capital is lost at each adverse interaction (where the net exposure is positive), so the total capital lost at any given Monte Carlo iteration is also small, and this produces a small Contagion Index. Larger exposures for given capital result in much higher losses at each adverse interaction. If the main exposure is approximately the same as the main capital, the contagion index is between 40 and 50%. Cont (in Cont et al. (2013)) does not emphasise this pointS. Also, note that the calculation ofK does not include capitals that are wiped out completely due to default. It only measures capital reduction up to the point of complete default.

Comparison with results from the Cont analysis
We now compare our results with those of the Cont model (Sect. 2.3.2). Cont used data for Brazilian financial institutions for the period June 2007 to November 2008. Significantly, Cont's Contagion Index shows that systemically important financial institutions can be responsible for up to fifteen times the loss of capital, because of contagion, compared to other financial institutions. These systemically important financial institutions tend to be clustered within the network, and the larger the cluster, the larger the systemic effect. Altogether they account for 7-10% of the total number of interactions. However, whether or not a financial institution is systematically important or not does not depend directly on balance sheet size (surprisingly!). The determining factors appear to be interbank liability, local network frailty and counterparty susceptibility.
Our Volatility index value (about 6.9%) is comparable to the lower end of the 7-10% range reported by Cont.

Contagion volatility results
Equation (31) gives an expression for the Volatility Ratio measure of systemic risk, V X ,T ,τ , for a shock at iteration T to a group of agents X, measuring volatility over a period τ . In a series of simulations, the calculation was done for groups of agents that have good, medium and poor protection against contagion. The designations 'good', 'medium' and 'poor' correspond to the Red, Green and Blue categories of Sect. 4. The mean volatilities in those cases are summarised in table 3. For the results in that table, with 500 interactions, the shock was delivered at the half-way stage, T = 250, with τ = 50.
It is clear that the Volatility Ratio increases with decreasing protection against debt default. Good protection mitigates the uncertainty post-shock, but only to a limited extent.

Recovery statistics
A comparison of the time taken for contagion to spread to all n agents with the time taken to recover provides a metric for the relative length of the recovery phase. The recovery criterion is the first time after shock for which 25 consecutive observations of the Group State are less than the pre-shock state. The following results refer to a typical shock period of length 40, tracking 1000 simulations for Soft Recovery and 1000 simulations for Hard Recovery.
For Soft Recovery the mean recovery period was 2036, with standard deviation 667. The relative 'recovery-to-shock ratio' is therefore 2036 40 ∼ 51, with corresponding relative standard deviation 667 √ 40 ∼ 105. Rounding then gives the approximate ratios mean ∼ 50 and standard deviation ∼ 100. The large standard deviation in this case is to be expected, given the volatility of the Soft Recovery process.
The equivalent results for Hard Recovery, were a mean recovery period of 684, with standard deviation 121. The relative 'recovery-to-shock ratio' is therefore 684 40 ∼ 17, with corresponding relative standard deviation 121 √ 40 ∼ 19. Rounding to the nearest 10, we conclude that the relative time to recover with Hard Recovery has approximate mean 20 and standard deviation 20.

Conclusion
The aim of this study was to provide a formal link between complexity and systemic risk by constructing a model of systemic risk based purely on key principles of complexity. The key principles addressed are pairwise agent interaction and undirected self-determination. The simulations presented show that the spread of debt default contagion can be very rapid, especially if there is an external influence which affects all of the agents within the system. However, if that external influence affects only one of the agents, the systemic affect is absent: the effect is then idiosyncratic. A systemic effect is limited if the external influence acts on most or all agents in the system. The essence of a 'true' systemic effect is that one agent is able to pass a contagion to another. In cases where such a systemic affect applies, recovery can be very slow, if it happens at all. The Contagion Index measures the over-all loss due to contagion, but we stress again that it is very dependent on the actual data used. Simulations can only give an indication of how the index may be calculated. In contrast to other studies (see Sect. 2), a formal network is not necessary. If a network structure is imposed, the effect would be to prevent certain interactions from happening, which might serve to mitigate a systemic effect.

Compliance with ethical standards
Conflict of interest The author declares that he has no conflict of interest.
Human participants This article does not contain any studies with human participants or animals performed by the author.
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecomm ons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.