*Article* **Macroprudential Policy in a Heterogeneous Environment—An Application of Agent-Based Approach in Systemic Risk Modelling**

#### **Jagoda Kaszowska-Mojsa 1,† and Mateusz Pipie ´n 2,\*,†**


Received: 29 December 2019; Accepted: 17 January 2020; Published: 21 January 2020

**Abstract:** Assessment of welfare effects of macroprudential policy seems the most important application of the Dynamic Stochastic General Equilibrium (DSGE) framework of macro-modelling. In particular, the DSGE-3D model, with three layers of default (3D), was developed and used by the European Systemic Risk Board and European Central Bank as a reference tool to formally model the financial cycle as well as to analyze effects of macroprudential policies. Despite the extreme importance of incorporating financial constraints in Real Business Cycle (RBC) models, the resulting DSGE-3D construct still embraces the *representative agent* idea, making serious analyses of diversity of economic entities impossible. In this paper, we present an alternative to DSGE modelling that seriously departs from the assumption of the representativeness of agents. Within an Agent Based Modelling (ABM) framework, we build an environment suitable for performing counterfactual simulations of the impact of macroprudential policy on the economy, financial system and society. We contribute to the existing literature by presenting an ABM model with broad insight into heterogeneity of agents. We show the stabilizing effects of macroprudential policies in the case of economic or financial distress.

**Keywords:** systemic risk; macroprudential policy; agent-based modelling; inequality; central-banking

#### **1. Introduction**

The new setting of financial supervision tailored after the global financial crisis of 2008–2009 has highlighted the need for research on the nature and measurement of risk in the financial system, also called systemic risk [1–4]. In response to the problems that occurred during the global financial crisis, the Basel III regulatory framework for financial institutions was adopted in 2010–2011. In the updated version of the Basel document the capital and liquidity requirements were established. In addition, the methods of conducting stress tests in the financial system have been subject to revision. Basel III was designed to strengthen the effects of banks' capital requirements by increasing the liquidity of the banking sector and reducing leverage undertaken by banks. In the European Union (EU), the implementing act of the Basel Agreements has been issued in the form of a new legislative package covering CRD IV/CRR (i.e., CRD IV Directive No. 2013/36/EU on access to the activity of credit institutions and the prudential supervision of credit institutions and investment firms and CRR Regulation No. 575/2013 on prudential requirements for credit institutions and investment firms).

The literature on selected macroprudential policy tools [5,6] presented in Basel II and III has been mainly focused on theoretical and empirical research on linkages between real sector and the financial system. According to International Monetary Fund, Financial Stability Board and Bank for International Settlements (IMF-FSB-BIS) [7], the assessment of the *effectiveness* of macroprudential policies includes: the assessment of the extent to which the macroprudential instrument increases the resilience of the macro-financial system; and the assessment of the extent to which the macroprudential instrument has impact on credit dynamics and asset prices (the impact on the cycle). The adoption of the new institutional framework for macroprudential supervision in the EU Member States took place in most countries during last three years. Therefore, the results of empirical studies on the effectiveness of macroprudential instruments are biased by substantial uncertainty. Alternatively one may carry out counterfactual analyses on the impact of a *combination* of macroprudential instruments on a stylised economy using the following simulation methods: dynamic stochastic general equilibrium models (DSGE) or non-equilibrium models (e.g., ABMs) [8]. Although from the presentation of ABM models in opposition to DSGE models, the conclusion can be drawn that the DSGE models are always less useful, it is important to remember that DSGE models are an extremely important tool used mainly in central banking. A defence of the legitimacy of using DSGE models even after the financial crisis can be found in Christiano et al. [9].

Analyses of the impact of macroprudential policies on the financial system and the real part of the economy have been primarily focused on capital requirements [10–13], countercyclical capital buffer [14–17] and leverage [18]. In the literature, we can also observe successive attempts to incorporate stylised macroeconomic and macroprudential policies in the form of financial frictions into Dynamic Stochastic General Equilibrium (DSGE) models [19–25]. The main goal of these attempts was to examine the effects of monetary policy or the general equilibrium welfare effects of capital requirements and leverage. Despite the role these studies played in formulating theoretical background to design of macroprudential policy, the assumptions of DSGE models are subject to critique [26,27]. DSGE models share the assumption of a perfectly rational representative agent that dynamically optimizes the use of resources. Failure to take into account the heterogeneity of agents in most DSGE models is particularly acute from the perspective of social welfare analysis performed within an equilibrium environment [28].

Both empirical and theoretical studies on the effects of the Basel III have led to the formulation of criticisms of the adopted regulatory framework. In particular, some researchers highlighted insufficient risk and uncertainty sensitivity of macroprudential tools, over-reliance on external rating regulations, improper tool calibration and lack of synchronization of adopted rules at institutional and national level. EU expert groups are still working to incorporate changes within these areas into the Basel IV framework. New research tools are required to examine the impact of regulatory changes on the economy, financial sector and society. The new setting should allow greater flexibility in modelling of risk-taking, risk aversion and decision-making under uncertainty. Consequently assumptions of macromodels should be more realistic to allow for a study of changes in welfare in heterogeneous economy beyond the social planner framework.

The aim of this paper is to analyse the impact of selected macroprudential policy tools on the economic and financial system using agent-based modelling (ABM). Modelling of interactions between agents within the ABM approach was confronted with the DSGE model with three layers of default ('3D') [21], which is currently used by experts within the European Systemic Risk Board (ESRB) and European Central Bank (ECB).

This paper contributes to the existing literature of agent-based modelling through detailed and relatively broad insight into heterogeneity of agents. In the approach taken, decision-making rules, preferences and behaviours may vary across units. In our model, all agents, ie banks, individuals, households, consumers, firms, establishments, industries, suppliers, properties, are heterogenous.

We conducted extended simulation experiments that were based on an ABM model that had been calibrated to reflect the features of a small open economy. Our choice was Poland as an exemplar case. The reason for calibrating the model relying on Polish data is that among the EU countries, the Polish economy is relatively small, open and strongly connected to the rest of the European Union countries. Moreover, the Polish banking system still remains strongly influenced by investors from the European Union, who treat Poland as a host country. Generally, the smaller Central and Eastern European (CEE) countries that host foreign financial institutions are exposed to various dimensions of systemic risks more strongly. At the same time, the degree of the development of financial intermediation is relatively low, which results in a rather weak credit channel, especially in the case of investments. Although the financial system in Poland generates limited systemic risk, it is more vulnerable to regulatory arbitrage and the propagation of the shocks that are caused by the activity of international financial groups.

Consequently, the CEE economies and other emerging economies may need to conduct a more active macroprudential policy because of the higher risks that stem from volatile capital flows or credit booms and so forth. These issues also relate to the Polish economy and its financial system. Hence, both the ABM model and the simulations presented in our paper are valuable for gaining a detailed insight into the effects of macroprudential policy, especially in the case of small emerging open economies.

In order to study the macroeconomic effects of macroprudential instruments and their interaction with monetary policy in the case of a hypothetical small open economy, Aoki et al. [29] applied a DSGE framework. The analysed model captured some critical features of the emerging market economies with macroprudential instruments that were defined as the capital requirements that were imposed on banks and a tax on foreign currency (FX) lending. However, there are some relevant aspects that were not taken into consideration in the Aoki et al. [29] model. For example, the possibility of the government or central bank intervening in the foreign exchange markets through the use of official foreign reserves is not discussed. Moreover, what is missing in the model is a more flexible specification of international capital flows (no equity flows or foreign direct investment) and the role of cross border gross flows, which could play a destabilizing role for financial stability. The ABM construct that is presented in our paper and the simulation study seem to be a step forward in addressing some of these issues but in particular in relaxing the assumption of the homogeneity of the economic units that interact in a system.

#### **2. Comparison of the ABM and DSGE-3D Model**

The use of DSGE models historically has been primarily focused on the analysis of technological changes and their impact on the real economy [30,31] as well as the impact of monetary policy on the business cycle [32,33]. The first DSGE models with financial frictions were not used for impact studies of macroprudential policies on the macro-financial system and social welfare. The research has been mainly focused on the formal explanation of the financial accelerator hypothesis [34,35] and the role of the net worth channel in credit supply [23,36]. In a few models, the impact of LTV changes and capital requirements on the economy was analysed explicitly [25].

After the global financial crisis, interest in systemic risk assessment and macroprudential policies increased [37–39]. Currently, one of the most important examples showing the use of DSGE models in research on macroprudential policies is the DSGE model with 3 layers of default ('3D' model) [21] developed in ECB. The main goal of the '3D' model was to create a framework for analysing positive and normative macroprudential policies. This model enables to set the optimal levels of capital requirements as well as to analyse welfare within the social planner framework. However, heterogeneity of agents within the model which seems more realistic would change the optimal values for capital requirements and would make the welfare analyses more meaningful.

The paper includes a comment on the '3D' model, due to its similarity to the prepared heterogeneous agent-based simulation. In both cases, the behaviour and decisions of major market players are taken into account. The insolvency of individuals (households), companies and banks describe formally sources of systemic risk. In the '3D' model and in the ABM model, stability of the financial sector is related to the default of agents. Nonetheless, the method of modelling agent's decisions differs between both approaches. More importantly definition of the insolvency also differs. In the '3D' model, individuals can deposit funds in banks and take loans for the purchase of real estate; entrepreneurs borrow from banks to accumulate capital. Business insolvency is associated with the occurrence of idiosyncratic and aggregate shocks. In the ABM model, the insolvency of agents is tied to internal market dynamics, driven by business and financial factors mainly the supply and investment finance policies of the banks and the demographic factors. The external shocks can be taken into account in the analyses but their significance is smaller than in the DSGE approach.

The '3D' model has been a novelty in the DSGE literature. Traditionally, in the DSGE models, due to appropriately formulated contracts, insolvency at steady state was impossible. Risk of insolvency itself was fully hedged in the model [35]. In a '3D' model, a borrower's insolvency implies changes in the lender's balance, which in turn affects his or her optimal behaviour in the market. Moreover, the bank's insolvency also entails costs to individuals and businesses, in spite of deposit insurance, which in turn strengthens the impact of bank insolvency.

In both approaches, the entire chain of interconnections between agents is formally modelled. Households save and deposit their funds in banks, while other households and companies borrow funds from the same banks. The ABM model departs from the stylised division into two dynasties: savers and borrowers. In an agent-based simulation, each household is made up of individuals with their own heterogeneous profiles in terms of savings, income, spending or additional financing. The way households make decisions depends on the interaction of an individual with family members and other agents in the model. In this way it is possible to trace the way of transferring the risk of insolvency between sectors. However, the transmission of default risk between sectors in DSGE models is accomplished by further optimisation of resources by a representative agent assuming appropriate restrictions and rational expectations. In the ABM model, insolvency transmission is accomplished not only through actual economic and balance-sheet relations and constraints but also the perception of risk and uncertainty of heterogeneous agents in the system [40–42]. DelliGatti [41] binds DSGE models with the financial accelerator hypothesis, while ABM models utilise the instability hypothesis of H. Minsky, which take into account not only the financial accelerator hypothesis but also Knightian uncertainty [43]. Additionally, the ABM model presented includes not only the transmission of risk of insolvency between the agents but also between industries.

In the '3D' model the attention is drawn to two types of distortions, which drive banks to excessive use of leverage and significant exposure to risk. They also explain the need for macroprudential policy. The first is related to the existence of deposit insurance agency. Banks run increased risk at the expense of an external agency, leading to higher credit supply and increased demand for deposits. The second distortion is related to the fact that the insolvency is expensive, not only for the lender but also for the borrowers. Occurrence of costly state verification [19] leads to lower demand for credit. The net effect of the two market distortions may be different for each sector. Consequently, the supply of credit for each sector may be lower or greater than the level that maximises the welfare of society.

According to the logic of the '3D' model, in a steady state, when the probability of bank insolvency is high, the risk premium is raised. We assume in the '3D' model that the risk premium is for the whole system and not for a given bank; therefore, banks are willing to take a higher risk because their funding cost is the result of decisions made by all participants within the market. These results seem obvious and a natural conclusion of homogeneity of individuals particularly banks. In the '3D' model, we assume a certain probability of bank default, which is characteristic of the state of equilibrium that we analyse. In financial markets, the decisions of a bank depend on its perception of counterparty risk and estimation of the way a bank is assessed by other units (the »perception of perception« of uncertainty). One of the dimensions of the heterogeneity of agents is related to differences in perception of reality, inter alia the perception of counterparty risk, overall uncertainty in the market and the state of the economy. Those elements are clearly omitted in the aforementioned DSGE '3D' model. General frameworks built upon an idea of equilibrium make it impossible to generalise existing DSGE models regarding the aforementioned issues. Also, assumption that a particular individual's decision may or may not lead to achieving equilibrium seems more realistic. The ABM approach

helps overcome these drawbacks. Analyses conducted only within the state of general equilibrium are departed from and the field of interest of non-equilibrium theories and the instability hypothesis is entered [44,45]. The ABM approach is therefore a step towards overcoming the DSGE modelling imperfections indicated by many authors [46,47]. According to empirical literature, the response of systems to the occurrence of shocks may be nonlinear and the financial system itself may be unstable. In addition, shock effects exhibit asymmetric nature. By design, mainly due to the use of log-linearisation, DSGE models are not able to accommodate non-linearity.

DSGE models with financial frictions [19,48], including the '3D' model, refer to the hypothesis of the financial accelerator system. At the same time, the system is characterised by market failures, including the asymmetric information and externalities. A number of researchers highlight the presence of pecuniary externalities [49–51]. Pecuniary externalities complement technological externalities and aggregate demand externalities [52]. After the recent financial crisis, one may observe an increased interest in explaining the impact of pecuniary externalities on the system and social welfare. Pecuniary externalities are incorporated mainly into the models by means of credit restrictions. An example of pecuniary externality may be the lack of internalisation of effects of investment decisions in housing and capital prices, which in turn affects the required collateral. In the '3D' model the level of leverage of households and firms is affected endogenously by prices, including real estate prices. At the same time, the direction and size of the impact of pecuniary externalities on allocation of resources are difficult to estimate using the '3D' model.

In agent-based models, it is possible to go one step further to include the premises of instability hypothesis in the analysis. The instability hypothesis is closely tied to financial accelerator hypothesis and it can assume existence of pecuniary externalities. Nonetheless, it goes far beyond it. DelliGatti [41] distinguishes two ways of presenting Minsky's hypothesis. The first does not refer explicitly to the heterogeneity of agents, and the second assumes the existence of three types of agents; hedging, speculative and Ponzi agents. According to the first explanation, the level of investment in the economy depends on the volume of internal finance and the difference between the market price of assets and the price of the final good. The market price of assets depends on long-term profit expectations. Final good price depends on the expected demand for that good. In the absence of heterogeneity of agents, the representative agent's investment level decisions are a function of internal financing, which in principle is consistent with the financial accelerator hypothesis. In practice, investment decisions are also made according to how the agents perceive risk. Hence, according to Delli Gatti, in order to fully understand the Minsky's hypothesis, we need to distinguish between three types of agents that have different attitudes towards external financing.

During the economic boom period, both the borrower and lender expect future cash flows to increase at a pace that will allow the borrower to repay their obligations. As the expectations develop, asset and product prices increase, stimulating investment growth. As a result, production, profits and employment in the economy increase. Banks increase the supply of credit, often requiring lower collateral. Companies are less cautious when they borrow money. Consequently, the proportion of speculative and Ponzi agents increase and the financial system resilience decreases. If the level of debt in relation to its service is perceived as too high on aggregate, the number of insolvency announcements in the system increases, leading to an eventual financial crisis.

Both the '3D' model and the ABM simulation are examples of stochastic dynamic systems that describe the evolution of basic components of the economy. However, while in the '3D' model the economic agents are homogeneous, fully rational and dynamically optimising, in the ABM simulation model, the agents are fully heterogeneous, bounded rational and they perform heuristic optimisation [53–56].

In order to include the conclusions of the Minsky's hypothesis in analyses, heterogeneity of agents was included in the agent-based simulation. The heterogeneity of the economy is understood here, however, more broadly than the differentiation of attitudes towards external financing. It is understood

as a differentiation of states, behaviour rules and expectations; this implies heterogeneous distributions of variables *ex ante* and *ex post*.

Both groups of researchers, working on the DSGE models and ABM models respectively have recognised the need to consider heterogeneity of the economy in order to analyse the optimality of policies as well as welfare implications. The heterogeneity of agents in the ABM approach is, however, understood differently than in DSGE models with heterogeneous agents [57–59]. In the DSGE models with heterogeneous agents, the discontinuation of the assumption of a representative agent is made primarily by allowing for idiosyncratic shocks and by removing the assumption of completeness of asset markets. In particular, such a definition of heterogeneity requires the redefinition of basic model and analyses elements, including the definition of steady state and equilibrium [58]. States of the economy are generally considered to be the realisation of a complex stochastic process with approximate properties to the Markov processes. Therefore, in such models, stationary equilibrium is considered, within which the stationary (ergodic) distribution exists. Within these model types, decision functions and price process realisations are approximated numerically. Some of these techniques were also adopted in the ABM approach [60–62].

The heterogeneity of agents in ABM is understood differently. This could be due to differentiation of attributes and states, differentiation of decision rules [63,64], attitudes towards risks or expectations [65–67]. In most ABM models with heterogeneous expectations, agents typically have adaptive expectations, as opposed to the rational expectations of representative agent within the DSGE approach. All these dimensions of heterogeneity appear in the simulation presented in the next section. Among others, the empirical distributions of basic economic categories such as income, expenses or credits were used to calibrate the states and the decision functions and procedures were selected after conducting the empirical research on the patterns of consumption and production on the market. The adaptive expectations were imposed as well on simulation design. A key difference between the presented simulation and other agent-based models is inclusion of varied attitudes towards risk and uncertainty in Knight's sense and the risk sensitivities.

The final distinguishing element of the ABM approach is the possibility to introduce more realistic assumptions in the model than in the DSGE approach. Good examples are the assumption of visibility and satiation. This visibility means that agent decisions take into account not only purely economic conditions and factors, such as the price of the product but also the proximity of the supplier in a spatial sense. In the case of analysis of financial system, the idea of visibility has an additional dimension. It does not come down to visibility in a geographic or spatial sense but rather to the perception of banks as relatively safe institutions. The perception of banks does not have to be reflected in economic foundations or stances [42]. Adopting the saturation principle leads to a departure from the global optimisation of underlying criteria with restrictions on the choice of local maxima.

The presented ABM model is based on the traditions of the EURACE [68,69], FP7 MOSIPS and the population dynamics model in the EU regions models [70] as well as FP7 CRISIS models. Our ABM model is also consistent with the stock-flow approach [71,72]. Impact studies of macroprudential policies on the economy within the ABM approach is relatively new. However, the topic refers to the tradition of agent-based models within financial markets [73–77] as well as literature on credit and financial markets from the agent-based perspective [72,78–97]. In the broader sense, the study also refers to the coevolution models successfully applied in [98,99] to explain the stylized fact of persistency in a time series. For more general reviews on complex network theory refer to References [100,101], while spatial interactions in agent-based modeling were discussed in Reference [102,103].

The purpose of the model is to bridge the gap in the literature on the role of macroprudential policies in systemic risk mitigation. In the following section, details of the ABM model, simulation results and an explanation of the logic behind robustness checks is provided. Comments on welfare analysis within the DSGE and ABM approach are also provided; hence a critical perspective on '3D' modelling results is presented.

#### **3. Model Description**

Presented within this section is an ABM model suitable for performing simulations that provide detailed insight into the nature of the relationship between the financial system and the real part of the economy. Due to the specifics of agent-based modelling, initially presented is the software environment in which simulations were developed. Next, attributes and activities of agents are presented. Also discussed is the method of sequential updating of the states within simulation modules. The form used to present the model and simulation is consistent with 'A Common Protocol for Agent-Based Social Simulations' [104].

#### *3.1. The Software*

The simulation was developed using object-oriented programming in Java-NetBeans and Eclipse environments. Statistical data to determine the attributes of system agents were grouped in a relational database (PostGreSQL-pgAdmin III). The simulation was linked to the database using Hibernate and SQL queries. According to the logic of object-oriented programming, initially agents and their attributes are described, and then the simulation workings from the perspective of individual agents and their activities are discussed. In the next subsection, a sequential update of agents' attributes in simulation modules is presented.

#### *3.2. Agents and Attributes*

In the macro-finance model, 9 agents are distinguished: *Banks*, *Individuals*, *Households*, *Consumers*, *Firms*, *Establishments*, *Suppliers*, *Properties* and *Industries*. All *Parameters* in a separate object are also defined. The relations between agents in the model are presented in the Figure 1. The attributes of the agents can be found in the Tables A1–A10 in the Appendix A.

**Figure 1.** Relations between agents in the model.

#### 3.2.1. Individuals, Households, Consumers & Properties

Individuals do not determine the behaviour of the system in the initial *Initialisation*, *Production*, *Supply chain* and *Public contracts* modules. Their significance is enhanced only in the *Households consumption, Households mobility* and *Individuals' records updating* modules. Nonetheless, individuals play a special role in the model because they determine the functioning of the program and the way data that describe agents' attributes is mapped in the relational database.

In the *Households consumption* module, the sum of the income of individual entities forming the given household is initially calculated. Total household income is not only equal to the sum of family member income but also includes additional income from rental property and alimony payments. After calculating total household income, resources are divided between consumption and savings. The program counts the number of household consumers and their total disposable income. Depending on the level of disposable income, household savings are determined to update household members' deposits. If a household consists of a couple (with or without children), then savings are distributed between them. Otherwise, if the household consists of a single adult or single parent, the savings are given to that adult. If the disposable income is exceptionally low, the scheme works similarly, with the common deposits used primarily to cover the basic needs. Decisions on the distribution of income between consumption and savings and the distribution of savings between household members are dynamic. For example, if the household changes as a result of divorce or death of the spouse, the states are updated.

Households represent different types of consumers in the model that determine the purchase of goods and services from a given industry. Households purchase products from suppliers according to the price offered by the supplier relative to the average industry price, quality of goods or services relative to average industry quality and depending on supplier's spatial location. Households of a certain consumer type seek suppliers sequentially further from their location. Ultimately, they seek suppliers globally, taking into account only the price and quality of the product or service.

Purchases of goods and services do not need to be financed solely by funds deposited in a bank account. Households with creditworthiness are eligible for consumer credit. In the model, loan maturity depends on the amount of the loan.

In the *Households mobility* module, households decide the place of residence and purchase or lease the property. If the household already owns the property, the model verifies whether the cost of repaying the mortgaged loan relative to the household income is too high. If repayment cost is too high, the property is designated for sale. If the property in the previous iteration has already been marked for sale, the price is reduced.

If a household leases a property, rent is equal to the sum of the property owners bank loan repayment obligations; rent is calculated as the ratio of property price to the number of families renting the property. If the rental cost is too high, the household seeks a new rental property. Preference is given to properties near the current place of residence. If household members are not working, further conditions are laid down for disposable income and burdens on household loans. If income after deductions is relatively low and the person is over 25 and not working, then the individual defaults. The banks which have granted the loans to this individual update the non-performing loans value. In this module, income from renting real estate property to other households is also updated. If the property is not leased, it is marked for sale. If it is not purchased, subsequent iterations reduce the desired property sale value.

One of the most important elements of this module is the ability to purchase real estate. Households with high savings buy property in cash with a given probability. Nonetheless, some households, despite their resources, decide to apply for a mortgage loan. Households that do not have sufficient savings, but meet the requirements, also take a loan. If the household is already the owner of one of the properties, it may additionally take a non-residential loan on the pledge of the first property. In practice, either the household takes a residential or non-residential loan, taking into account whether it is already a property owner. Probabilities of taking a residential and non-residential loan were estimated based on empirical data.

Attributes of individual entities change their values in the *Individuals' records updating* module. Depending on age and sex, the program determines the probability of death of an individual. If the probability is high, the person dies and the assets capital and deposits go to the heir. If the deceased person was the owner of a business, the heir can continue the business or forgo, depending on their previous income as an employee in one of the firms. Simultaneously, the division of capital in the economy changes. If the probability of individual's death is low, the program directs

the individual to the *Education* and *Pairing* modules. In the selected modules the consumer type of households is updated and in the final modules the remaining individuals' records are updated.

#### 3.2.2. Firms & Establishments

The role of *Firms* is highlighted primarily in the modules: *Firm demography, Mergers* & *Acquisitions* and *Firm growth*. An entrepreneur can open a new business according to a certain probability that depends on the experience of running the company, the age and level of education completed by the individual. When deciding to set up a new business, the entrepreneur takes into account the average profitability of individual industries in the economy, the ease of obtaining licenses for running a business in a given industry and the ability to raise additional funds for opening and running a business. In the case of small and medium-sized enterprises, these funds can be obtained from banks, while in the case of large companies, capital is obtained from many individuals, who are henceforth shareholders of this company. Obtaining funding from a bank requires a number of formal requirements to be met, including leverage, investment and industry risk, investment risk mitigation and a good credit history of the applicant. Implicitly, banks also take into account the cost of labour, equity and size of the enterprise relative to the average enterprise size in the industry.

As a result of the acquisition of another company or as a result of the company's strategic development, firms can increase the number of establishments they own. In the model, it is possible to obtain additional funds from banks for expansion. Firms can also cease their business activity.

In the simulation, companies announce insolvency when the level of indebtedness and the risk of business exceed the acceptable level. A low percentage of business that has been run in the low-profit sector at high operating costs defaults as well. In the event of a company's inactivity on the market for six quarters, the program automatically removes the company from the database and program. The adoption of such assumptions ensures adequate market dynamics in the simulation. Firms and establishments are auxiliary objects for the remaining agents in the model. In the final modules, other attributes of firms and establishments are updated.

#### 3.2.3. Establishments & Suppliers

Establishments in the simulation allow for the spatial location of businesses. In the *Initialisation* module, the maximum potential production of goods and services of the establishment is computed. The price of the goods produced by the establishments changes depending on the demand. In each period, the optimal number of products to be stored for future sales is calculated. In the next period, the facility will only produce the number of goods equal to the number of goods demanded minus the number of goods stored. In addition, the production process takes into account the manufacturing risk and the overall level of corporate debt, which should not exceed the level specified by prudential regulation and policies. For the production of final goods, the establishments purchase inputs from others acting as suppliers. The choice of supplier is designed in such a way as to take into account economic categories such as price or product quality but also supplier availability in a geographical or spatial sense.

The demand from the private sector is supplemented by the need for goods from the public sector. It was assumed that the ability to sign a contract in a public sector depends on the size of the establishments producing the given good and the price and quality of the product offered compared to the average values in the industry. The establishments then decide on the destination of the final goods. Establishments may allocate all products for sale in a given sector or export some of their products to another sector and other spatial units.

In addition, the establishments play an auxiliary role in other modules. Individuals seek buildings near the workplace, that is, in the territorial unit within which the establishments are located. At the time of setting up a new company, new establishments are also created. Similarly, when a new company is created as a result of an acquisition or merger, the affiliation of the company and the owner of the establishments change. The owners of establishments decide to increase or

decrease the workforce and firms with a strong market position increase the number of establishments. In addition, depending on the demand for work, the number of employees to be hired and fired in each establishment is calculated. In the final modules, firms pay salaries to establishments' employees and the remaining attributes of establishments are updated.

#### 3.2.4. Industries

The existence of major branches of the economy is assumed. The role of industries is crucial when calculating large exposures (LE) of banks to particular industries. *Industries* is an auxiliary object as well. Firms and establishments operate within the industries. The establishments may import and export goods between industries as part of the purchase of inputs for production. When firms apply for a loan, the total exposure to the industry is checked, which should not exceed the regulatory thresholds. The average values of variables for the industries are treated as a benchmark for business operations of firms and establishments. The main values calculated by the program are the number of units operating in the sector, average product price in the sector, average good quality, average firm size in the sector, average import and export, average industry earnings and average industry workforce. When entrepreneurs decide to run a business, first they attempt it in the relatively most profitable sector, and then in the next sectors.

#### 3.2.5. Banks & Macroprudential Policies

Banks provide loans to individuals, households and companies. In the case of individuals and households, we distinguish between consumer loans and mortgages for residential and non-residential purposes. Companies can apply for a loan to purchase inputs and increase sales and business development (investment loans). Banks analyse loans granted to each of the industries and examine the risks associated with high exposures to the industry. According to regulatory requirements, banks are not allowed to lend to specific industries above certain thresholds.

Individuals and establishments accumulate funds in a bank account. To each individual and establishment at least one bank is matched based on survey data. The model assumes the existence of network and reputation effects. According to the results of empirical research, individuals and households are not guided solely by price in the decision to allocate funds. With relatively high probability, the entity will decide to remain with the bank assigned to them. On the other hand, if they decide to change bank, they will take into account interest rates and additional transaction costs. In the case of consumer credit and the purchase of inputs, agents are more driven by the reputation of the bank than the interest rate. On the other hand, in the case of residential and non-residential loans as well as investment loans, households and firms are primarily guided by the long-term interest rates of banks.

In the module *Banks Supply side & regulatory requirements*, banks set the supply of different types of loans. Banks compete with each other in terms of price, offering different interest rates on deposits and loans, as well as in terms of creditworthiness criteria. Risk-taking banks provide loans to individuals, households or companies with a lower credit history or lower creditworthiness (income or equity respectively). In the absence of macroprudential policy solutions, banks could be willing to lend to more risk-prone entities, which would jeopardise the stability of the financial sector. Thus, the model takes into account the examples of macroprudential policy tools. Firstly, the existence of capital requirements (CAR) and recommendations of the financial supervision authority regarding the capital maintained by banks were taken into account. The model then included the large exposures (LE) and exposures of risk to the industries. Banks cannot lend to a given industry over a specified amount and will not choose to lend to a company that runs risk-prone business without sufficient collateral. By providing housing and non-residential loans, banks pay attention to the following indicators: debt to assets (DTA), debt service to income (DSTI) and loan to value ratios (LTV). Moreover, the liquidity ratio (LCR) and leverage ratio (LR) have been taken into account as well.

From the supervisor's point of view, it is extremely important to analyse the value of these indicators on aggregate for the economy. The survey data allows only for a static description of the level of these ratios for a given period. The simulation allows for the investigation of changes that occur in the indicator values as a result of dynamic interactions between fully heterogeneous agents. Similarly, for companies and premises leverage requirements (LR) are analysed.

Individuals, households, firms and establishments make decisions about depositing funds and obtaining a loan based on interest rates. In the system it is possible to introduce interest rates offered by banks. In this case, after taking into account the network and reputation effects, banks compete on interest rates. It is possible to take into account counterparty risk indicators and indicators of »perception of perception« in the analysis. It is then possible to integrate a macro-financial model into a financial model that simulates the role of risk perception and uncertainty in generating systemic risk in the interbank market [42].

#### **4. Sequential Updating of States in the Model**

The graphical representation of sequential updating of states in the model is presented in Appendix B.

#### *Module 0: Initialisation Sector Profitability (M.1)*

In the *Initialisation* module, we calculate the average profit (that is *π<sup>s</sup> <sup>t</sup>*) of the *<sup>N</sup>firms <sup>t</sup>* firms doing business in the *<sup>S</sup>* industries (*s*, where *<sup>s</sup>* <sup>∈</sup> {1, 2 . . . *<sup>S</sup>*} , *<sup>S</sup>* <sup>∈</sup> <sup>N</sup>) at time *<sup>t</sup>*. The procedure classifies sectors according to their average profitability. Information on average profitability is used by individuals when they decide to establish a new firm in a given industry. Each firm in the sector *s* generates profits (Π*firms <sup>t</sup>* ).

$$\overline{m}\_t^s = \sum\_{firm\_s = 1}^N \frac{\prod\_t^{firm\_s}}{N\_t^{firm\_s}}.\tag{1}$$

In this module, the model also stores the initial supply of different credit types (for each bank *b*): consumer loans *Sl*.*Cind <sup>t</sup>* , residential *<sup>S</sup>l*.*Hind <sup>t</sup>* and non-residential loans (*SNHind <sup>t</sup>* ), firm investment loans (*Sl*.*Iest <sup>t</sup>* ) and short-term loans for firms (*Sl*.*SHest <sup>t</sup>* ) as temporal variables. This information is used later in module (M.55) to determine how much supply was used during this iteration by different agents.

#### *Module 1: Production Price Updating (M.2)*

In the *Price updating* submodule, the price (*Pest <sup>t</sup>* ) is updated according to the demand *Qdest t* for a given good or service in relation to the expected demand (*E Qdest t* ) and the level of production *Yest t* relative to the maximum potential production of each establishment (*Yt s max*). In this sub-module, the values of variables determining the number of employees to be hired *LH Iest t* and fired *LF Iest t* in the current period in each establishment are set to zero.

The maximum production of premises in a given sector is then calculated according to the Cobb and Douglas production function:

$$Y\_{t\max}^{s} = \pi\_{1.s} (L\_t^{\text{est}} + 1)^{a\_{2.s}} (K\_t^{\text{est}})^{a\_{3.s}} \left( \frac{(Ql)\_t^{\text{est}}}{(Ql)\_t^s} \right)^{a\_{4.s}} (A\_t^{\text{est}})^{a\_{5.s}},\tag{2}$$

where *Lest <sup>t</sup>* is the labour force, *Kest <sup>t</sup>* is the capital, *Aest <sup>t</sup>* is technology and (*Ql*) *est <sup>t</sup>* /(*Ql*) *s <sup>t</sup>* represents the relative quality of the establishment's product (or service) with respect to the average quality of product and services in the sector (industry). The value of parameters *α*1.*<sup>s</sup> α*2.*<sup>s</sup> α*3.*<sup>s</sup> α*4.*<sup>s</sup> α*5.*<sup>s</sup>* are specific to each industry. When initialising the system, the price is defined based on the initial

conditions in the database. In subsequent iterations, the price of the previous period is assumed to be the initial value of the good (*Pest <sup>t</sup>* = *Pest <sup>t</sup>*−1). This price may change depending on the demand relative to expected demand and production in comparison to the maximum capacity, that is to say the maximum potential production. If the demand for good produced by a given facility is greater than the expected demand for that good and production is greater than the specified part *α*<sup>6</sup> of maximum production, then the price increases in proportion to the given parameter *α*7.*s*. The *α*7.*s*. parameter is industry-specific. If the demand for a good is less than the part *α* <sup>8</sup> of expected demand for this good and output is less than the specified *α*<sup>9</sup> part of maximum output, the price drops by the percentage given by the parameter *α*10.*s*. The *α*10.*<sup>s</sup>* parameter is industry-specific. This procedure is consistent with the adoption of adaptive expectations in the model.

#### *Module 1: Production Expected Demand Updating (M.3)*

In this sub-module, we update the expected demand for the next iteration (*E*(*Qdest <sup>t</sup>* )). The formula of the expected demand for a good depends on the production experience of the establishment. If the premises have been operating on the market for at least a quarter, the expected demand for its good is calculated according to the following formula:

$$E\left(Q\_t^{d\_{\text{ref}}}\right) \\
\quad = \left[a\_{11.s}\left(\frac{P\_t^{\text{sct}}}{P\_t^{\text{s}}}\right) + a\_{12.s}\left(\frac{P\_{t-1}^{\text{sct}}}{P\_{t-1}^{\text{s}}}\right) + a\_{13.s}\left(\frac{(Ql)\_t^{\text{sct}}}{(Ql)\_t^{\text{s}}}\right) + a\_{14.s}\left(\frac{(Ql)\_{t-1}^{\text{sct}}}{(Ql)\_{t-1}^{\text{s}}}\right)\right] \times Q\_{t-1}^{d\_{\text{ref}}}.\tag{3}$$

The expected demand depends on the price of the product relative to the average price in the industry within the periods *t* and *t* − 1, product quality relative to the average quality in the industry within the periods *t* and *t* − 1, given parameter values, and demand for the goods up to date. The parameters *α*11.*s*, *α*12.*<sup>s</sup> α*13.*<sup>s</sup>* and *α*14.*<sup>s</sup>* are industry-specific.

However, if the establishment is new, then the expected demand is calculated to take into account the workforce in the newly-created establishment and the average sales per worker in the industry (*Sl*) *s <sup>t</sup>* within which it operates.

$$E\left(Q\_{l}^{d\_{\text{ref}}}\right) \\ \quad = \left[a\_{11s}\left(\frac{P\_{l}^{\text{ref}}}{P\_{l}^{s}}\right) + a\_{12s}\left(\frac{P\_{l-1}^{\text{ref}}}{P\_{l-1}^{s}}\right) + a\_{13s}\left(\frac{(Ql)\_{l}^{\text{ref}}}{(Ql)\_{l}^{s}}\right) + a\_{14s}\left(\frac{(Ql)\_{l-1}^{\text{ref}}}{(Ql)\_{l-1}^{s}}\right)\right] \\ \times \\ \left(L\_{l}^{\text{alt}} + 1\right) \times (Sl)\_{l}^{s}.\tag{4}$$

#### *Module 1: Production Expected Stock Updating (M.4)*

If the establishment is new ((*New*) *est <sup>t</sup>* = 1), we calculate the optimal level of stock (*Invest optt* ) as part of the expected demand, specified by the parameter *α*15. If the establishment is already established, the optimum stock level is calculated to take into account the expected demand for the good, the ratio of expected revenue from the sale of goods (*Pest <sup>t</sup>* × *E Qdest t* ) to the costs of producing that good in the current period (*TCest <sup>t</sup>* ), and the ratio of sales revenue in the current period (*Pest <sup>t</sup>* × (*Sl*) *est <sup>t</sup>* ) to the total costs incurred in the previous period (*TCest <sup>t</sup>*−1).

$$\ln \boldsymbol{\upsilon}\_{opt\_t}^{\text{est}} = \mathfrak{a}\_{15} \times E\left(Q\_t^{d\_{\text{st}}}\right) + \mathfrak{a}\_{16} \times \left(\frac{P\_t^{\text{est}} \times E\left(Q\_t^{d\_{\text{st}}}\right)}{T\mathbf{C}\_t^{\text{est}}}\right) + \mathfrak{a}\_{17} \times \left(\frac{P\_t^{\text{est}} \times \left(Sl\right)\_t^{\text{est}}}{T\mathbf{C}\_{t-1}^{\text{est}}}\right). \tag{5}$$

#### *Module 1: Production Production Decision Making (M.5)*

If the optimum stock of products (*Invest optt* ) is less than or equal to the actual stock (*Invest <sup>t</sup>* ), the establishment will not produce goods in the current period. However, if the optimal stock is greater than the stored number of goods, the establishment should produce the difference between the optimum level and the current stock.

$$Y\_t^{\text{est}} = \min(Y\_{t\text{max}}^{\text{est}}; \, Inv\_{opt\_t}^{\text{est}} - Inv\_t^{\text{est}}).\tag{6}$$

Nonetheless, these establishments will produce goods only when the level of leverage and financial risk associated with the debt of the establishments does not exceed the levels specified by the parameters *α*<sup>18</sup> and *α*19. If the establishment meets the conditions to produce goods, the production is equal to the lower value of either maximum production of the establishment or the difference between the optimum stock and the actual stock (inventory) of goods.

#### *Module 2: Supply Chain Quantity of Inputs, Import & Export (M.6)*

In this module, establishments buy inputs and decide on the import and export of goods between industries. In order to minimise costs, they choose a supplier from the nearest spatially located area, thus limiting the cost of transport. In addition, the adopted mechanism allows the modelling of continuation of transaction relationships between suppliers and recipients of goods. Each company is located spatially in the form of establishments. Each establishment is a supplier for another establishment. For each establishment in all sectors, the initial value of inputs ((*Inp*) *est <sup>t</sup>* ), profits from sales ((*Sl*) *est <sup>t</sup>* ) and demand for goods (*Qdest <sup>t</sup>* ) are set to zero. Next, the amount of inputs (*q est*.*buy*.(*sup*)(.*s*) *<sup>t</sup>* ) (provided by suppliers from sectors *s*) necessary to ensure continuity of production, taking into account import and export of inputs between industries is calculated. If the facility imports or exports semi-finished products, the amount of inputs that the establishment is going to purchase is obtained using the following formula:

$$q\_t^{\text{est.huy.}(sup)(s)} = a\_{20.s-buy.s} \times \Upsilon\_t^{\text{est}} \times a\_{21.s-buy.s}.\tag{7}$$

In the model there are 2 × *s* values for parameters *α*20.*s*−*buy*.*<sup>s</sup>* and *α*21.*s*−*buy*.*<sup>s</sup>* (*Cf.* Calibration for the explanation how the values of parameters were obtained). For each establishment in the industry, the value of the parameter is the same but the values vary between sectors (industries). If the establishment does not import goods then the quantity of purchased goods is equal to the part of production specified by parameter *α*20.*s*−*buy*.*s*:

$$q\_t^{est.huy.(sup)(.s)} = a\_{20.s-
hy y.s} \times Y\_t^{est}.\tag{8}$$

The total quantity of inputs is the sum of inputs purchased from all suppliers in all sectors (*q est*.*buy <sup>t</sup>* ).

#### *Module 2: Supply Chain Supplier Selection (M.7)*

When searching for a supplier, the establishment takes into account the amount of goods stored by the supplier (*Invest*(.sup) *<sup>t</sup>* > *q est*.*buy*(.*s*) *<sup>t</sup>* ), and compares the ratio of quality to price of a supplier (establishment in the sector *s*) with the average ratio within the industry (sector):

$$\frac{a\_{22.s-\text{cst}} \times \left(Ql\right)\_t^{\text{cst}(.s)}}{a\_{23.s-\text{cst}} \times P\_t^{\text{cst}(.s)}} > \frac{a\_{24.s-\text{cst}} \times \left(Ql\right)\_t^s}{a\_{25.s-\text{cst}} \times P\_t^s}.\tag{9}$$

In addition, it also takes into account supplier location (i.e., compares the spatial codes at NUTS 1-4 levels: *ϑ est*<sup>1</sup> *<sup>t</sup>* , *<sup>ϑ</sup> est*<sup>2</sup> *<sup>t</sup>* , *<sup>ϑ</sup> est*<sup>3</sup> *<sup>t</sup>* , *<sup>ϑ</sup> est*<sup>4</sup> *<sup>t</sup>* ). If the current supplier has a sufficient number of inputs for sale, and the quality and price of the good are acceptable in relation to the average price and quality in the sector, then the establishment can buy inputs from the supplier. The model consolidates the network effects developed during the cooperation of businesses. If the supplier does not meet the requirements, the establishments seek a new supplier locally in increasingly distant locations and then globally. The parameter values from *α*22.*s*−*est* at time *t* to *α*25.*s*−*est* are specific to the supplier's sector.

#### *Module 2: Supply Chain Inputs Purchase (M.8)*

After selecting a supplier, the establishment purchases inputs. To purchase inputs, the establishment must have sufficient liquid assets to cover the wages and the cost of buying the inputs: (*LA*) *est*.*buy <sup>t</sup>* <sup>−</sup> *<sup>W</sup>est*.*buy <sup>t</sup>* <sup>≥</sup> (<sup>1</sup> <sup>+</sup> *<sup>α</sup>*26.*s*−*sup* <sup>×</sup> ) <sup>×</sup> *<sup>P</sup>est*(.*sup*)(.*s*) *<sup>t</sup>* × *q est*.*buy*(.*s*) *<sup>t</sup>* , where is the binary variable expressing whether the cost of transportation should be added. If it has sufficient liquid assets, it can finance the purchase of inputs from accumulated funds. Therefore, in the model, with the probability *pr*<sup>1</sup> the establishment will not apply for a loan. In that case, for the establishment-buyer inputs ((*Inp*) *est*.*buy <sup>t</sup>* ) and liquid assets ((*LA*) *est*.*buy <sup>t</sup>* ) are updated to. The signs "+=" shall be interpreted as the incrementation of the value of the variable by the amount quantified by the formula given on the right-hand side. Respectively, "-=", shall be interpreted as a decrease in the value.

$$(Input)\_t^{\text{est.h.up}} + = (1 + \mathfrak{a}\_{26.s-\text{sup}} \times \sigma) \times P\_t^{\text{est.(sup)},(s)} \times q\_t^{\text{est.h.up},(s)}\tag{10}$$

$$(LA)^{\text{est.h.u}}\_t - = (1 + \pi\_{2\delta s - \sup} \times \mathcal{O}) \times P\_t^{\text{est(sup)}(s)} \times q\_t^{\text{est.h.u}}.\tag{11}$$

While for all establishments-suppliers from each sector, the sales expressed in monetary terms ((*Sl*) *est*.(*sup*)(.*s*) *<sup>t</sup>* ), demand for goods (*Q dest*(.*sup*).(*s*) *<sup>t</sup>* ), liquid assets ((*LA*) *est*.(*sup*)(.*s*) *<sup>t</sup>* ) and stock ((*Inv*) *est*.(*sup*)(.*s*) *<sup>t</sup>* ) are updated.

$$\left( \left( Sl \right)\_{t}^{\text{est.} (sup)(.s)} + = P\_{t}^{\text{est.} (sup).(s)} \times q\_{t}^{\text{est.} huy(.s)} \tag{12}$$

$$(LA)^{\text{est.} (sup) \text{(.s)}}\_{t} + = P\_{t}^{\text{est (.sup)} \text{.} (s)} \times q\_{t}^{\text{est.} huy \text{(.s)}} \tag{13}$$

$$\mathcal{Q}\_t^{d\_{est.(sup),(s)}} + = q\_t^{est.buy(s)} \tag{14}$$

$$(Inv)^{\text{est.}(sup)(.s)}\_t - = q^{\text{est.} buy(.s)}\_t. \tag{15}$$

In particular cases, with the probability of 1 − *pr*1, despite sufficient liquid assets, the establishment may apply for a loan to purchase additional inputs that will allow the facility to increase its production capacity and sales. If the establishment applies for a loan, the applicant's creditworthiness is checked even if its accumulated funds are sufficient to cover the purchase. In the submodule *Bank credit admissibility 1* (M.9), conditions in addition to liquidity funds are checked. In accordance to the market dynamics of short-term loans, some of the applicants will not obtain a loan from the bank due to lack of creditworthiness. The possibility of establishments applying for a short-term loan in the case of temporary liquidity problems has also been included in the model (i.e., (*LA*) *est*.*buy <sup>t</sup>* <sup>&</sup>lt;(1<sup>+</sup> *<sup>α</sup>*26.*s*−*sup* <sup>×</sup> )×*Pest*(.sup)(.s) *<sup>t</sup>* ×*q est*.*buy*(.*s*) *<sup>t</sup>* ). If, in spite of short-term liquidity problems, the establishment has not completely lost its creditworthiness, the bank may grant him credit for the purchase of inputs in the submodule *Bank credit admissibility 2* (M.10). If the establishment has no creditworthiness, it has to *adjust* the quantity to buy (*q*˜ *est*.*buy <sup>t</sup>* ):

$$\tilde{q}\_t^{\text{est.buy}(s)} = round \left( \frac{((LA)\_t^{\text{est.buy}} - \mathcal{W}\_t^{\text{est.buy}}) \times a\_{20.s-buy.s}}{P\_t^{\text{est.usup}(\,\,(s))} \times (1 + a\_{26.s-\text{sup}} \times \mathcal{o})} \right). \tag{16}$$

After the purchase, the value of inputs ((*Inp*) *est <sup>t</sup>* ) and liquid assets of establishment-buyer ((*LA*) *est*.*buy <sup>t</sup>* ) are updated.

$$(Input)\_t^{est.buy} + = \tilde{\eta}\_t^{est.buy.(s)} \times P\_t^{est.sup(s)} \times (1 + a\_{26.s-sup} \times \mathcal{O}) \tag{17}$$

$$\left( \left( LA \right)\_{t}^{\text{est.huy}} - \right) = \overline{q}\_{t}^{\text{est.huy}.\left(s\right)} \times P\_{t}^{\text{est.sup}\left(s\right)} \times \left( 1 + \mathfrak{a}\_{26.s-\text{sup}} \times \mathfrak{o} \right) \tag{18}$$

At the same time, we update the values of sales ((*Sl*) *est*.(*sup*) *<sup>t</sup>* ), demand for a good (*Q dest*.(*sup*) *<sup>t</sup>* ), liquid assets ((*LA*) *est*.*buy <sup>t</sup>* ) and stock of suppliers from all sectors that provided inputs to establishments (*Invest*.*sup <sup>t</sup>* ) are updated:

$$(SI)\_t^{\text{est1.} (sup)} + = P\_t^{\text{est.sup}(s)} \times Inv\_t^{\text{est1.sup}} \tag{19}$$

$$(\text{Sl})^{\text{est2}.(\text{sup})}\_t + = P\_t^{\text{est.sup}(\text{s})} \times (\vec{q}\_t^{\text{est.buy.}(\text{s})} - \text{Inv}\_t^{\text{est1.sup}}) \tag{20}$$

$$Q\_t^{d\_{est1.(sup)}} + \ = Inv\_t^{est1.sup} \tag{21}$$

$$Q\_t^{d\_{est2,sup}} + \ = \overline{q}\_t^{est.buy.(s)} - Inv\_t^{est1.sup} \tag{22}$$

$$(LA)\_t^{\text{est1.buy}} + = P\_t^{\text{est.sup.}(s)} \times Inv\_t^{\text{est1.sup}} \tag{23}$$

$$(LA)\_t^{\text{est2.(sup)}} + = P\_t^{\text{est.sup.(s)}} \times (\vec{q}\_t^{\text{est.buy.(s)}} - Inv\_t^{\text{est1.sup}}) \tag{24}$$

$$Inv\_t^{\varepsilon st2\sup} - = (\vec{q}\_t^{\varepsilon st.buy.(s)} - Inv\_t^{\varepsilon st1.sup})\tag{25}$$

$$Inv\_t^{\text{est1.sup}} = 0 \tag{26}$$

where *q*˜ *est*.*buy*.(*s*) *<sup>t</sup>* is the quantity of inputs that has been selected according to the adaptive algorithm.

#### *Module 2: Supply Chain Short Term Credit Admissibility 1 (M.9)*

In this submodule we analyse the case of an establishment without liquidity problems. The requested amount is given by the formula:

$$d\_t^{SH^{\rm est}} + = a\_{27} \times \left( (LA)\_t^{\rm est.huy} - W\_t^{\rm est.huy} - P\_t^{\rm est(\,supp)(.s)} \times q\_t^{\rm est.huy(.s)} \right) \tag{27}$$

In the future, the model could also recognize different business types, similarly to the consumer types in the model, however at this stage, access to such disaggregated data was unavailable. Firstly, it is checked whether the matched bank in the database is able to loan this quantity (*Sl*.*SHest <sup>t</sup>* ≥ *l SHest <sup>t</sup>* **)**, as is the creditworthiness of the applicant. The values of ROA, ROE and leverage ratios as well as the value of average financial risk associated with the establishment operating in a given sector and its default history are checked. If the loan is granted, then the values of loans (*l SHest <sup>t</sup>* ), quarterly payments (*l SHest q <sup>t</sup>* ), interest to be paid (in total) (*RSHind <sup>t</sup>* ) and quarterly (*R SHind q <sup>t</sup>* ), inputs ((*Inp*) *est <sup>t</sup>* ) and liquidity assets ((*LA*) *est <sup>t</sup>* ) are updated (for the establishment-buyer).

$$\begin{split} &R\_{t}^{\text{SH}^{\text{ind}}} + = \frac{1}{\kappa} \times \left[ \text{az} \gamma \times \left( \left( \text{LA} \right)\_{t}^{\text{est.h.py}} - \text{W}\_{t}^{\text{est.h.py}} - \text{P}\_{t}^{\text{est.h.py}} \right) \times \left( \text{q}\_{t}^{\text{est.h.py}(s)} \right) \times \left( 1 + 0.25 \times \text{i}\_{\text{f}^{\text{SH}}} \right)^{\text{M}^{\text{stH}^{\text{st}}}} + \\ & - \text{a}\_{\text{\textdegree}} \times \left( \left( \left( \text{LA} \right)\_{t}^{\text{est.h.py}} - \text{W}\_{t}^{\text{est.h.py}} - \text{P}\_{t}^{\text{est.h.py}(.s)} \times \text{q}\_{t}^{\text{est.h.py}(.s)} \right) \right) \end{split} \tag{28}$$

$$R\_t^{SH\_q^{\text{cut}}} = \frac{R\_t^{SH^{\text{ret}}}}{\mathbf{M}^{SH^{\text{cut}}}} \text{ (29)}$$

$$I\_t^{SH\_q^{\text{ext}}} = \frac{I\_t^{SH^{\text{ext}}}}{\mathsf{M}^{SH^{\text{ext}}}} \text{ (30)}.$$

$$(Input)\_t^{est.buy} + \ = P\_t^{est(sup)(.s)} \times q\_t^{est.buy(.s)} \tag{31}$$

$$(LA)\_t^{\text{est.h.u}} - = P\_t^{\text{est.(sup)}(.s)} \times q\_t^{\text{est.h.u}(.s)} - a\_{27} \times \left( (LA)\_t^{\text{est.h.u}} - \mathcal{W}\_t^{\text{est.h.u}} - P\_t^{\text{est.h.u}} \times q\_t^{\text{est.h.u}(.s)} \right) \tag{32}$$

At the same time, the revenue of banks ((*RevlSH* ) *b <sup>t</sup>*) and supply of short-term credit for firms (*Sl*.*SHest <sup>t</sup>* ) are updates as well as sales ((*Sl*) *est <sup>t</sup>* ), demand (*Qdest <sup>t</sup>* ), liquidity assets ((*LA*) *est <sup>t</sup>* ) and stock of all establishments from sectors ((*Inv*) *est <sup>t</sup>* ) that provided inputs to establishments (buyers).

$$(\operatorname{Re}\upsilon\_{I^{SH}})^b\_t + = \operatorname{R}^{SH^{est}\_q}\_t \tag{33}$$

$$S\_t^{l.SH^{\text{set}}} - = \mathfrak{a}\_{\mathcal{D}} \times \left( (LA)\_t^{\text{est.h.u}} - \mathsf{W}\_t^{\text{est.h.u}} - \mathsf{P}\_t^{\text{est.(sup.)}} \times \mathsf{q}\_t^{\text{est.h.u}} \right) \tag{34}$$

$$(Sl)\_t^{\text{est}(.sup)} + = P\_t^{\text{est}(.sup)(.s)} \times q\_t^{\text{est.buy}(.s)}\tag{35}$$

$$\mathbf{Q}\_t^{d\_{\rm est}} + = q\_t^{\rm est.buy(.s)} \tag{36}$$

$$(LA)^{\rm est(\,sup)}\_t + = P^{\rm est(\,sup)(\,.s)}\_t \times q^{\rm est.bny(\,.s)}\_t \tag{37}$$

$$(Inv)^{est(sup)}\_t - = q^{est.buy(.s)}\_t.\tag{38}$$

Short-term loans make it possible to guarantee the solvency of establishments in everyday business transactions. Restrictions to funding provision could result in an establishment's loss of liquidity and production capacity. If the matched bank does not agree to grant credit, the same conditions are checked with other banks in the market. Firstly, the conditions are checked in the bank that offers the lowest interest rate. If none will grant the loan, the establishment needs to adjust the quantity of inputs to be purchased (*q*˜ *est*.*buy <sup>t</sup>* ).

*Module 2: Supply Chain Short Term Credit Admissibility 2 (M.10)*

The requested amount is given by the formula:

$$\eta\_t^{\text{SH}^{\text{tot}}} = \eta\_t^{\text{est.huy}(.s)} \times P\_t^{\text{est}(.sup)(.s)} \times (1 + a\_{26.s-\text{sup}} \times \mathcal{o}) - ((\text{LA})\_t^{\text{est.huy}} - \mathcal{W}\_t^{\text{est.huy}}).\tag{39}$$

Similar to the submodule 9, the supply conditions and creditworthiness are checked. In this case, the conditions for granting credit are also tightened, hence the differences in the parameters in the sub-modules *Bank credit admissibility 1* (M.9) and *Bank credit admissibility 2* (M.10). If a loan is not granted by a given bank, the establishment tries to obtain a loan from another bank. If there is no bank that is willing to supply a loan, the establishment is only able to purchase a portion of the planned amount of inputs. The logic of adaptive algorithms is used here. The values of variables are updated in the similar way as in the previous module (M.9). Purchases by establishments from the suppliers are supplemented by the purchases of consumers and the governmental sector.

#### *Module 3: Household consumption - Individuals & households income (M.11) & (M.12)*

Firstly, in the module, the individuals' and households' incomes (respectively *yind <sup>t</sup>* and *yHH <sup>t</sup>* ) are computed. Individual income includes income from various sources: wages, business activity, dividends, public pensions, pension benefits, pre-retirement benefits and training allowances. The model distinguishes three main categories: wage (*wind <sup>t</sup>* ), subsidy ((*sub*) *ind <sup>t</sup>* ) and interest from bank savings (deposits) (*id* × *<sup>d</sup>ind <sup>t</sup>* ). An individual's income is expressed by the following formula:

$$y\_t^{ind} = w\_t^{ind} + (sub)\_t^{ind} + \ i\_d \times \ d\_t^{ind}.\tag{40}$$

Household income includes the sum of individual incomes, supplemental security income, alimony, donations, property rental income, interest and dividends from savings accounts, bonds, investment funds and income earned from participation in companies in which family members were investors or

inactive partners. All items have been grouped into categories at the database level. The total income of the household (composed of *Nind*.*HH* individuals) is given by:

$$y\_t^{HH} = \sum\_{i=1}^{N^{ind.HH}} y\_{it}^{ind} + (Don)\_t^{HH} + (Rent)\_{RE\_{t'}}^{HH} \tag{41}$$

where (*Don*) *HH <sup>t</sup>* are donations and (*Rent*) *HH REt* is an additional income from renting apartments.

At the beginning of the cycle, at least two banks are assigned to each individual; the bank to which the individual entrusted their savings (*Idbank*.(*ind*) *dt* ) and the bank that may grant consumer loans to the individual (*Idbank*.(*ind*) *l C t* ). In the model, it is assumed that individuals are less prone to change the bank to which they entrusted their saving and current account funds than to change the 'bank-lender.' If they decide to change bank, when looking for a new bank, they take into account the offered interest rates on deposits and transaction costs, that is, the costs of changing the bank and opening a new bank account. The likelihood of a bank changing in the case of a consumer loan is higher than in the case of deposits. In the case of deposits, psychological factors such as habit formation or the perception of a bank as a reputable institution, which reinforce network effects, play a greater role. In the case of mortgages, households primarily rely on the interest rate on the loan.

#### *Module 3: Households Consumption Net Savings (M.13)*

After calculating household income, savings (*s HH <sup>t</sup>* ) are calculated. Disposable income is the household income after deducting the cost of living (*hHH <sup>t</sup>* ), which includes the cost of renting or repaying the mortgage. If the disposable income is higher than the specified income per person in the household, where the per person income is given by the parameter *α*41, then the savings are computed according to the following formula:

$$s\_t^{HH} = \max\left\{0; \frac{\sqrt{\left(Age\right)\_t^{\text{eldest.ind}}}}{a\_{42}} \times \left(y\_t^{HH} - h\_t^{HH} - a\_{41} \times N\_t^{\text{ind.HH}}\right)\right\},\tag{42}$$

where *α*<sup>41</sup> is the minimum cost of food per person in the household according to Central Statistical Office statistics, *Nind*.*HH <sup>t</sup>* counts the number of individuals in the household.

However, if disposable income is lower than the specified parameter *α*<sup>38</sup> (income per capita) multiplied by the number of consumers in the household (*Nind*.*HH <sup>t</sup>* ), two possibilities are considered. First, when the disposable income is positive, the savings are calculated according to the following formula:

$$s\_t^{HH} = \max\left\{0; \frac{\sqrt{(Age)\_t^{\text{eldest.ind}}}}{3 \times a\_{42}} \times \left(y\_t^{HH} - h\_t^{HH} - a\_{41} \times N\_t^{ind.HH}\right)\right\}.\tag{43}$$

Household savings are redistributed between the accounts of adult household members. If the household is a single person, then all savings are transferred to his or her account. If the household is a couple or an extended one (more than two adults in the family), then the corresponding parts of the savings are transferred to the adults' bank accounts.

$$d\_t^{HHH} + = \frac{1}{N\_t^{ind.HH}} \times s\_t^{HH}.\tag{44}$$

Second, if the disposable income is negative, household members spend their savings and current deposits on consumption and try to sell the properties on the real estate market. The algorithm looks for households which have sufficient funds after deducting the debt burden to pay for the property:

$$\sum\_{i=1}^{N^{ind}} d\_{it}^{ind} - \sum\_{i=1}^{N^{ind}} \left( l\_{it}^{\mathbb{C}\_q^{ind}} + R\_{it}^{\mathbb{C}\_q^{ind}} + l\_{it}^{H\_q^{ind}} + R\_{it}^{H\_q^{ind}} + l\_{it}^{NH\_q^{ind}} + R\_{it}^{NH\_q^{ind}} \right) \ge P\_t^{prop}. \tag{45}$$

If this kind of household is found, then the values of deposits of buyers and sellers are updated as well as the status of the ownership of buyers ((*Own*) *HH <sup>t</sup>* = 1).

$$d\_{it}^{ind.seller} + = \frac{1}{N^{ind}} P\_t^{prop} \tag{46}$$

$$d\_{it}^{ind.buy} - = \frac{1}{N^{ind}} P\_t^{prop}.\tag{47}$$

If the household does not receive additional resources, this can eventually lead to default (*PDind <sup>t</sup>* + +) and the household is removed from the database. The program updates the value of non-performing loans ((*NPLlI*) *b <sup>t</sup>* , (*NPLlC* ) *b <sup>t</sup>* , (*NPLlH* ) *b <sup>t</sup>* , (*NPLlNH* ) *b <sup>t</sup>* ). The probability of default of the bank increases.

$$(NPL\_{l^l})\_t^b + = (pl)\_t^{l^{ind}} \tag{48}$$

$$(NPL\_{l^\complement})^b\_t + = (pl)^{\complement}\_t \tag{49}$$

$$(NPL\_{l^H})^b\_t + = (pl)^{H^{ind}}\_t \tag{50}$$

$$(NPL\_{l^{NH}})\_t^b + = (pl)\_t^{NH^{ind}} \, , \tag{51}$$

where (*pl*) *Iind <sup>t</sup>* is the sum of liabilities to the bank for outstanding investment loans that have to be repaid in the given iteration, (*pl*) *Cind <sup>t</sup>* is the sum of liabilities to the bank for outstanding consumer loans, (*pl*) *Hind <sup>t</sup>* is the sum of liabilities to the bank for outstanding housing loans and (*pl*) *NHind <sup>t</sup>* is the sum of liabilities to the bank for outstanding non-housing loans.

The bank may become a new temporary owner of the property if the household was removed from the database after the default. The property is marked for sale. After selling, we update the value of bank's revenues:

$$(Rev\_{l^{H}})^{b}\_{t} + = P^{prop}\_{t}.\tag{52}$$

*Module 3: Households Consumption Consumer Loans Update (M.14)*

In this submodule, the desired consumption of goods in the current period in a particular industry by the household is determined. Households can finance their consumption entirely by their own means or apply for consumer credit. The basic amount of good purchased from the industry (*QHH*.(*cons*) *basic* ) is given by:

$$Q\_{\rm basic}^{HHI,(cons)} = \pi\_{43.4c.s} \times \frac{\sum\_{i=1}^{\text{jind.HH}} d\_{\text{it}}^{\text{ind}} - \sum\_{i=1}^{\text{jind.HH}} \left( l\_{\text{it}}^{\text{C}\_{\text{q}}^{\text{ind}}} + R\_{\text{it}}^{\text{C}\_{\text{q}}^{\text{ind}}} + l\_{\text{it}}^{\text{I}\_{\text{q}}^{\text{ind}}} + R\_{\text{it}}^{\text{I}\_{\text{q}}^{\text{ind}}} + l\_{\text{it}}^{\text{NH}\_{\text{q}}^{\text{ind}}} + R\_{\text{it}}^{\text{NH}\_{\text{q}}^{\text{ind}}} \right)}{P\_{\text{t}}^{\text{s}} \times \left( 1 + l\_{\text{VAT}}^{\text{e}} \right)},\tag{53}$$

where parameter value *α*43.*tc*.*<sup>s</sup>* is specific to industry and customer type. The parameter expresses the percentage of total consumption that is, household purchases from all industries. When buying from several industries, we assume ∑*<sup>S</sup> <sup>s</sup>*=<sup>1</sup> *α*43.*tc*.*<sup>s</sup>* = 1, where *S* is the number of industries. If the household consume only the quantity *QHH*.(*cons*) *<sup>t</sup>* = *<sup>Q</sup>HH*.(*cons*)*basic* we proceed to the *Supplier searching module*.

*Entropy* **2020**, *22*, 129

In the case of taking a loan, consumption funds are increased by the amount of the loan less debt burden and service. The loan can only be granted if the following basic condition is met:

$$\left\{ y\_t^{HH} - h\_t^{HH} - \sum\_{i=1}^{N^{indHH}} \left( l\_{it}^{\mathbb{C}\_q^{ind}} + R\_{it}^{\mathbb{C}\_q^{ind}} + l\_{it}^{H\_q^{ind}} + R\_{it}^{H\_q^{ind}} + l\_{it}^{NH\_q^{ind}} + R\_{it}^{NH\_q^{ind}} \right) \right\} \ge a\_{44} \times N\_t^{ind.HH}. \tag{54}$$

In this case the quantity of loans is given by the formula:

$$\mathcal{H}\_{temp}^{ind} = \mathbf{a}\_{45.t:z} \times \left\{ \mathbf{y}\_t^{HH} - h\_t^{HH} - \sum\_{i=1}^{N^{ind.HH}} \left( l\_{it}^{\mathbb{C}\_q^{ind}} + \mathcal{R}\_{it}^{\mathbb{C}\_q^{ind}} + l\_{it}^{H\_q^{ind}} + \mathcal{R}\_{it}^{H\_q^{ind}} + l\_{it}^{NH\_q^{ind}} + \mathcal{R}\_{it}^{H\_q^{ind}} \right) \right\} + \mathbf{a}\_{46.s.} \tag{55}$$

The parameter value *α*45.*tc*.*<sup>s</sup>* is specific to industry and customer type, while *α*46.*<sup>s</sup>* is industry-specific. With a certain probability (*pr*2), an individual tries to obtain the quantity in the matched bank in the database (*Idbank*.(*ind*) *l C t* ). In this case, the supply from the bank and creditworthiness are checked in the *Supply side checking 1* (M.15) and *Consumer credit admissibility 1* (M.17). The individual can also try to obtain the loan from other banks. In such cases, interest rates are compared, and *Supply side checking 2* (M.16) and *Consumer credit admissibility 2* (M.18) are proceeded to.

#### *Module 3: Households Consumption Supply Side Checking1&2 (M.15) & (M.16)*

In the *Supply side checking 1* (M.15) submodule it is checked whether the bank assigned to the household has sufficient funds to grant the loan (*Sl*.*Cind <sup>t</sup>* ≥ *l Cind <sup>t</sup>* ), whether the bank's policy will allow another loan to be granted, and whether the regulatory requirement for sectoral exposures is met (*l Cind <sup>t</sup>* < *α*47). In the *Supply side checking 2* (M.16) submodule, we check whether any bank selected from the list of banks offering consumer loans at a specified interest rate has sufficient credit supply and that the regulatory requirements for sectoral exposures are met. If none is able to give this amount, the amount of loan is adjusted using adaptive algorithm (˜ *l Cind <sup>t</sup>* ).

#### *Module 3: Households Consumption Consumer Credit Admissibility1&2 (M.17) & (M.18)*

In submodules M.17 & M.18, household creditworthiness is checked with the bank assigned to the household or other bank (from the list of banks) selected in the *Supply side checking 2* (M.18) submodule. The first condition relates to the level of income per person after deduction of repayments of other loans. This level is specific to each bank:

$$\left\{ y\_t^{HH} - h\_t^{HH} - \left( \sum\_{i=1}^{N^{indHH}} \left( l\_{it}^{\mathbb{C}\_q^{ind}} + R\_{it}^{\mathbb{C}\_q^{ind}} + l\_{it}^{H\_q^{ind}} + R\_{it}^{H\_q^{ind}} + l\_{it}^{NH\_q^{ind}} + R\_{it}^{NH\_q^{ind}} \right) \right) \right\} \ge a\_{50,b} \times N\_t^{ind, HH} . \text{ (56)}$$

The next conditions relate to credit history of the household (the probability of default of members of the family) ((*PD*) *ind*.*HH <sup>t</sup>* ≤ *α*49.*b*), and the maximum number of loans that can be granted to one household. If all conditions are met, the loan can be granted. For all loans granted to individuals and households, the applicant age ((*Age*) *ind <sup>t</sup>* ≥ <sup>18</sup>) and status of the labour market (Ξ*ind <sup>t</sup>* = {3||5}) are also checked. It is also possible to include a variable which counts the elapsed time since the last change in status on the labour market. If the individual works less than 4 quarters and is under 30, it is assumed that they have a fixed-term contract and no creditworthiness.

*Module 3: Households Consumption Consumer Credit and Purchase After Passing Supply Side Conditions and Credit Admissibility (M.19)*

In this submodule, maturity is assigned to the loan (M*Cind* ) depending on the amount of loan granted. Next, the value of debt service is updated, taking into account the civil status of the household members.

$$l\_t^{\mathbb{C}^{ind}} = \frac{1}{N\_t^{advalls.HH}} \times l\_{temp}^{\mathbb{C}^{ind}} \tag{57}$$

$$I\_t^{\mathbb{C}\_q^{ind}} = \frac{1}{N\_t^{advults.HH}} \times \frac{I\_{temp}^{\mathbb{C}^{nd}}}{\mathbf{M}^{\mathbb{C}^{ind}}} \tag{58}$$

$$R\_t^{\text{ind}} + = \frac{1}{N\_t^{\text{adults.HH}}} \times l\_{temp}^{\text{cin}} \times \left(1 + i\_{l^\circ}\right)^{\text{M}^{\text{ind}}} - l\_{temp}^{\text{id}} \tag{59}$$

$$R\_t^{C\_q^{ind}} = \frac{R\_t^{C^{und}}}{\mathbf{M}^{C^{ind}}}.\tag{60}$$

The amount of credit granted by the bank, the supply of the credit and the revenues of the bank in the given period are also increased.

$$S\_t^{l, \mathbb{C}^{ind}} - = l\_{temp}^{\mathbb{C}^{ind}} \tag{61}$$

$$(Rev\_{l^{\mathbb{C}}})^b\_t + = \mathcal{R}^{\mathbb{C}^{ind}\_q}\_t. \tag{62}$$

Finally, the amount of consumer goods to be purchased from different industries is computed.

$$Q\_t^{HH.(cons)} = Q\_{busic}^{HH.(cons)} + \frac{a\_{43.t:s} \times l\_t^{C^{md}}}{\mathbf{M}^{\mathbb{C}^{md}} \times \left\{P\_t^s \times (1 + t\_{VAT})\right\}}.\tag{63}$$

*Module 3: Households Consumption Supplier Searching & Purchase.hh (M.20)*

The household next chooses the supplier. If the current supplier has sufficient stock of good (*Invest*.(*sup*) *<sup>t</sup>* ) and the ratio of quality to price is higher than average ratio in the sector, then the household purchases the goods (*QHH*.(*cons*) *<sup>t</sup>* ) from this supplier.

$$\ln \upsilon\_t^{\text{est.(sup)}} \ge Q\_t^{\text{HH.(cons)}} \text{ &\*\*&} \frac{a\_{22.s-\sup} \times \left(Ql\right)\_t^{\text{est.(sup)}}}{a\_{23.s-\sup} \times P\_t^{\text{est.(sup)}}} > \frac{a\_{24.s-\sup} \times \left(Ql\right)\_t^s}{a\_{25.s-\sup} \times P\_t^s}.\tag{64}$$

Otherwise, the household seeks a new supplier from incrementally more distant spatial locations. The requirements for the same spatial codes are loosened sequentially. Later, in the Purchase.hhs submodule, the profits from sales ((*Sl*) *est*.(*sup*) *<sup>t</sup>* ), demand (*Q dest*.(*sup*) *<sup>t</sup>* ), stock (*Invest*.(*sup*) *<sup>t</sup>* ), liquid assets ((*LA*) *est*.(*sup*) *<sup>t</sup>* ) of suppliers are updated. In addition, deposits of consumers are updated.

$$\left(\left(Sl\right)\_{t}^{\text{est.(sup)}} + = P\_{t}^{\text{est.(sup)}} \times Q\_{t}^{\text{HH.(cons)}}\right) \tag{65}$$

$$\mathcal{Q}\_t^{d\_{\text{tot.}(sup)}} + \ = \mathcal{Q}\_t^{H\\H.(cons)} \tag{66}$$

$$Inv\_t^{\text{est.(sup)}} - \ = Q\_t^{HH.(\text{cons})} \tag{67}$$

$$(LA)\_t^{\text{est.(sup)}} + = P\_t^{\text{est.(sup)}} \times Q\_t^{HH.(\text{cons})} \tag{68}$$

$$d\_{it}^{ind} - = \frac{1}{N\_t^{advults.HH}} P\_t^{st(sup)} \times Q\_t^{HH.(cons)}.\tag{69}$$

#### *Module 4: Public Contracts (M.21)*

In this module, we complement the demand of the private sector with demand from the public sector. Public contracts are usually signed by large companies. A public contract is awarded when the product price is lower than the average price of the product in the sector (*Pest <sup>t</sup>* ≤ *<sup>P</sup><sup>s</sup> <sup>t</sup>* ). In addition, the probability of signing contracts increases with the size of the business and the quality of the product. If the terms of the contract are met, the value of the stored goods (*Invest <sup>t</sup>* ), the demand for good (*Q dest*.(*sup*) *<sup>t</sup>* ), liquid assets of the supplier (*LA*) *est <sup>t</sup>* and the value of sales (*Sl*) *est <sup>t</sup>* are updated. The stock cannot be lower than the minimum fraction of production (*Yest <sup>t</sup>* ) given by the parameter *α*57.

$$Inv\_t^{\text{est.(sup)}} - = \max\{0; \min\left(Inv\_t^{\text{est.(sup)}}, a\mathfrak{s}\tau \times Y\_t^{\text{est.(sup)}}\right)\}\tag{70}$$

$$\mathcal{Q}\_t^{d\_{\text{est.(sup)}}} + = \min \left( \text{Inv}\_t^{\text{est.(sup)}}, \mathfrak{a} \mathfrak{z} \gamma \times \mathcal{Y}\_t^{\text{est.(sup)}} \right) \tag{71}$$

$$(LA)\_t^{\text{est.(sup)}} + = \mathfrak{a}\_{\mathfrak{F}8} \times \min\left(Inv\_t^{\text{est.(sup)}}, \ a\_{\mathfrak{F}7} \times Y\_t^{\text{est.(sup)}}\right) \tag{72}$$

$$(Sl)\_t^{\text{est.}(sup)} + = \mathfrak{a}\_{58} \times \min\left(\text{Inv}\_t^{\text{est.}(sup)}, \ a\_{57} \times \chi\_t^{\text{est.}(sup)}\right). \tag{73}$$

#### *Module 5: Households Mobility Accommodation Cost and Housing Stress (M.22)*

The term property refers to the value of apartment or houses, with or without land. Households live in properties they own ((*Own*) *HH <sup>t</sup>* = 1) or rent property from other households ((*Own*) *HH <sup>t</sup>* = 0). The household may own more than one property. Real estate may be subject to residential *l Hind t* and non-residential loans (*l NHind <sup>t</sup>* ). If the household lives in their own property, then the cost of living is equal to the sum of the financial obligations of the owners of the building, that is, the adult individuals forming the household who bought the property:

$$h\_t^{HH} = \beta\_0 + \beta\_1 \times \left\{ \sum\_{i=1}^{N^{ind.HH}} (l\_t^{H\_q^{ind.HH}} + R\_t^{H\_q^{ind}}) \right\},\tag{74}$$

where parameters *β*<sup>0</sup> and *β*<sup>1</sup> adjust the fixed and the variable parts of accommodation cost.

The cost of renting is calculated as a part *β*<sup>1</sup> of the sum of liabilities to the bank (loans) and the part *β*<sup>4</sup> of the cost of rent, calculated as the ratio of the price of the property to the number of households that rent this property.

$$h\_t^{HH} = \beta\_1 \times \left\{ \sum\_{i=1}^{N^{indHH}} \left( I\_t^{H\_q^{indHH}} + R\_t^{H\_q^{ind}} \right) \right\} + \beta\_4 \times \frac{P\_t^{prop}}{\left( \# \text{Rent} \right)\_t^{prop}} \tag{75}$$

In the first case of ownership, if the rental cost is greater than the specified parameter *β*<sup>2</sup> (part of the income *yHH <sup>t</sup>* ), the household decides to sell the property. If the property was already marked for sale ((*ForSale*) *prop <sup>t</sup>* <sup>=</sup> 1), then the price (*Pprop <sup>t</sup>* ) has to be decreased by a percentage *β*3. In practice, the parameter *β*<sup>3</sup> reflects how much the price has to be lowered in order to sell the property in next iteration. In the second case, if a household rents a property and the cost of rent is too high, it will start looking for a new home. The household looks for another building considering the status on the labour market (Ξ*int <sup>t</sup>* = {3||5}) and the age of the household members ((*Age*) *ind <sup>t</sup>* ≥ 18). If two adults in the household are working, the program randomly selects one of them and searches for a building near the person's workplace (the algorithm checks and compares the spatial codes: *<sup>ϑ</sup> prop*<sup>1</sup> *<sup>t</sup>* , *<sup>ϑ</sup> prop*<sup>2</sup> *<sup>t</sup>* , *<sup>ϑ</sup> prop*<sup>3</sup> *<sup>t</sup>* , *<sup>ϑ</sup> prop*<sup>4</sup> *<sup>t</sup>* , *<sup>ϑ</sup> est*<sup>1</sup> *<sup>t</sup>* , *<sup>ϑ</sup> est*<sup>2</sup> *<sup>t</sup>* , *<sup>ϑ</sup> est*<sup>3</sup> *<sup>t</sup>* , *<sup>ϑ</sup> est*<sup>4</sup> *<sup>t</sup>* ). In addition to property locations, households take into account the price of the property from the appropriate price range and whether the building is for sale. If more than one property meets the criteria, one is selected at random and the spatial codes attributing the individual to the respective spatial units are updated.

*Entropy* **2020**, *22*, 129

If two adults are not working (Ξ*int <sup>t</sup>* = {1||2}) and the difference between the sum of individual deposits and the sum of the individual liabilities of family members is less than the subsistence level expressed by the parameter *β*7, then the individuals are removed from the database, the household is removed from the database, and the corresponding records from the object *Consumers* are deleted as well.

$$\sum\_{i=1}^{N^{ind.HH}} d\_{it}^{ind.HH} - \sum\_{i=1}^{N^{ind.HH}} (I\_t^{H\_q^{ind}} + R\_t^{H\_q^{ind}}) \rangle + \beta\_4 \times \frac{P\_t^{prop}}{\left(\#\text{Rent}\right)\_t^{prop}} < \beta\_7 \tag{76}$$

The exception is a situation in which an adult is under 25. Then the assumption applies that they are still living with their parents. If individuals and households are removed from the database, all records related to insolvency are updated. Consequently, the non-performing loans for a given bank and sectors are increased. The probability of bank's default increases as well. Especially,

$$(NPL\_{l^l})\_t^b + = (pl)\_t^{l^{ind}} \tag{77}$$

$$(NPL\_{l^\mathbb{C}})\_t^b + = (pl)\_t^{\mathbb{C}^{ind}} \tag{78}$$

$$(NPL\_{l^H})\_t^b + = (pl)\_t^{H^{ind}} \tag{79}$$

$$(NPL\_{l^{NH}})\_t^b + = (pl)\_t^{NH^{ind}} \tag{80}$$

where (*pl*)*<sup>t</sup>* is the sum of liabilities to the bank for outstanding (respectively investment, consumer, housing and non-housing) loans that have to be repaid in the given iteration.

#### *Module 5: Households Mobility Profits from Rent (Accommodation & Housing Stress) (M.23)*

In this module, property attributes are updated if the household obtains profits from renting the property. The algorithm checks all household properties. The primary property ((*PH*) *prop <sup>t</sup>* = 1) cannot be sublet to another household. If the household has a second property ((*PH*) *prop <sup>t</sup>* = 0), the number of households that live in the house is checked. If none live there, it is marked for sale ((*ForSale*) *prop <sup>t</sup>* = 1). If it was previously marked for sale ((*ForSale*) *prop <sup>t</sup>*−<sup>1</sup> <sup>=</sup> 1), its price is reduced by a certain percentage of the value that is specified by the parameter *β*3.

$$P\_t^{prop} = \beta\_3 \times P\_{t-1}^{prop}.\tag{81}$$

Revenues from renting second property ((*Rent*) *HH REt* ) are updated according to:

$$(Rent)\_{RE\_t}^{HH} + = \beta\_4 \times P\_t^{prop}.\tag{82}$$

#### *Module 5: Households Mobility - Decisions About Funding Housing and Non-Housing Purchase (M.24)*

In this sub-module the household decides how to finance the purchase of houses and other non-housing purchases. If the current funds and savings in the bank account are greater than the price of the cheapest property on the market that has already been marked for sale ((*ForSale*) *prop <sup>t</sup>*−<sup>1</sup> <sup>=</sup> 1), it can potentially buy a property in cash.

$$\sum\_{i=1}^{N^{ind.HH}} d\_{it}^{ind.HH} - \sum\_{i=1}^{N^{ind.HH}} \left( l\_t^{H\_q^{ind}} + R\_t^{H\_q^{ind}} \right) \rangle > P\_{min\_l}^{prop}. \tag{83}$$

In practice, we assume that a household buys a property in cash, only with a given probability (*pr*3) in the model. If a member of the household is an individual who owns the firm ((*Entr*) *ind <sup>t</sup>* = 1) or is unemployed (Ξ*ind <sup>t</sup>* = 2) with a high entrepreneurial spirit ((*EntrS*) *ind <sup>t</sup>* > 0.5), then the funds will be first invested in the firm rather than housing or non-housing purchases. We update the status of

individual as an entrepreneur ((*Entr*) *ind <sup>t</sup>* = 1). If a household does not have enough resources to buy a property in cash, it will apply for a loan and the sub-module *Macroprudential ratios* is moved to.

#### *Module 5: Households Mobility Macroprudential Ratios (M.25)*

In this submodule, macroprudential ratios are computed. In addition, the total indebtedness, debt servicing and total assets held by the household are computed as a temporal variables. The following macroprudential ratios were included in the system for residential and non-residential loans: total debt to assets ratio, debt to income ratio, debt service to income ratio, loan-to-value ratio.

$$(IndcbbtQ)\_{temp}^{HH} = \sum\_{i=1}^{N^{ind.HH}} (I\_{it}^{\mathbb{C}\_q^{ind}} + I\_{it}^{H\_q^{ind}} + I\_{it}^{NH\_q^{ind}} + I\_{it}^{I\_q^{ind}}) \tag{84}$$

$$(DServiceQ)\_{temp}^{HH} = \sum\_{i=1}^{N^{ind.HH}} (R\_{it}^{C^{ind}\_q} + R\_{it}^{H^{ind}\_q} + R\_{it}^{NH^{ind}\_q} + R\_{it}^{I^{ind}\_q}) \tag{85}$$

$$(AssetsQ)\_{temp}^{HH} = \sum\_{i=1}^{N^{ind.HH}} d\_{it}^{ind.HH} \tag{86}$$

$$(DTA)\_t^{HH} = \frac{(Indcbt \,\mathrm{Q})\_{temp}^{HH}}{(Assets \,\mathrm{Q})\_{temp}^{HH}} \tag{87}$$

$$(DTI)\_t^{HH} = \frac{(Indcbt \,\mathrm{Q})\_{temp}^{HH}}{y\_t^{HH}} \tag{88}$$

$$(DSTI)\_t^{HH} = \frac{(DServic \, Q)\_{temp}^{HH}}{y\_t^{HH}} \tag{89}$$

$$(LTV)^{HH}\_t = \frac{\sum\_{i=1}^{N^{ind.HH}} l^{H^{ind}}\_{it}}{P^{prop}\_t} \ . \tag{90}$$

#### *Module 5: Households Mobility Housing and Non-Housing Loans (M.26)*

In this sub-module, the household's creditworthiness and supply side conditions are checked. Firstly, basic requirements are checked. If the household debt ratios exceed regulatory requirements, the household lacks creditworthiness ((*DSTI*) *HH <sup>t</sup>* > *β*8.*b*|| (*DTI*) *HH <sup>t</sup>* > *β*9.*b*|| (*DTA*) *HH <sup>t</sup>* > *β*10.*b*). Likewise, if all household members study, they are inactive on the labour market or are living on social benefits (Ξ*ind <sup>t</sup>* = {1| |2| |4}). The model also takes into account the situation of people under the age of 30 who work less than 1 year in a company that also do not have creditworthiness ((Ξ*ind <sup>t</sup>* = 3 && (*Age*) *ind <sup>t</sup>* < 30 && <sup>Ψ</sup>*ind <sup>t</sup>* <sup>≤</sup> <sup>4</sup>) || (<sup>Λ</sup> *ind <sup>t</sup>* = 2 && Ξ*ind <sup>t</sup>* = (<sup>1</sup> ||2|| <sup>4</sup>) && <sup>Ξ</sup>*ind <sup>t</sup>* = 3 && (*Age*) *ind <sup>t</sup>* < 30 && <sup>Ψ</sup>*ind <sup>t</sup>* ≤ 4 )). Then the value of collateral is estimated. For the all properties that the household owns, the property prices are summed up ((*Collat*) *max temp*+ = *<sup>P</sup>prop <sup>t</sup>* ). Households may apply for a residential or non-residential loan under a pledge of real estate. If the household owns at least one property, it will apply for a residential loan with a given probability, and for a non-residential loan with one minus that probability. On the other hand, if a household has rented a property (i.e., is not an owner), it will first apply for a residential loan. In most cases, the first property is bought in cash. The value of the mortgage loan is equal to the difference between the price of the cheapest real estate on the market, and the savings (less the charges for other loans); this is according to the following equation:

$$d\_{temp}^{H^{HH}} = P\_{min\_l}^{prop} - \beta\_{15} \times \left(\sum\_{i=1}^{N^{ind.HH}} d\_{it}^{ind.HH} - (Debt)\_{temp}^{HH} - (DebtServ)\_{temp}^{HH}\right) \tag{91}$$

where (*Debt*) *HH temp*, (*DebtServ*) *HH temp* are given by the expressions:

$$(Debt)\_{temp}^{HH} = \sum\_{i=1}^{N^{ind.HH}} \left( (pl)\_{it}^{C\_q^{ind}} + (pl)\_{it}^{H\_q^{ind}} + (pl)\_{it}^{NH\_q^{ind}} + (pl)\_{it}^{l^{ind}\_q} \right) \tag{92}$$

$$(DebtServ)\_{temp}^{HH} = \sum\_{i=1}^{N^{ind.HH}} \left( R\_{it}^{\mathbb{C}\_q^{ind}} + R\_{it}^{H\_q^{ind}} + R\_{it}^{NH\_q^{ind}} + R\_{it}^{I\_q^{ind}} \right) \tag{93}$$

Households choose a bank with which to apply for a loan, taking into account the interest rate. At the same time, the bank must have sufficient funds and be willing to accept the LTV ratio of applicant (*LTVHH temp* = ((*l Hind <sup>t</sup>* + *l NHind <sup>t</sup>* )/*Pprop <sup>t</sup>* )). If the household does not obtain credit in the bank that offers the lowest interest rate, it resubmits the request to another bank on the list that requires a higher interest rate. After receiving the loan, the household buys the property. The value of housing loans granted by the bank is also updated. The value of the household loans obtained is then updated. If the household consists of a marriage, the value of granted loans is halved. If the property is the main residence, the cost of accommodation is also updated. In the case of non-residential loans, the scheme works in an analogous way, with the value of the residential loan being equal to:

$$d\_{temp}^{NHH^{HH}} = \beta\_{13.te} \times \left\{ P\_{min\_l}^{prop} - \beta\_{15} \times \left( \sum\_{i=1}^{N^{ind.HH}} d\_{it}^{ind.HH} - (Debt)\_{temp}^{HH} - (DebtServ)\_{temp}^{HH} \right) \right\}. \tag{94}$$

After checking the creditworthiness and credit supply of the selected bank, the value of non-residential loans obtained are updated, taking into account the civil status of household members.

#### *Module 6: Individuals' Records Updating*

Individuals' records updating module ensures the maintenance of demographic trends observed empirically in the simulation. The heterogeneity of individuals has been taken into account, as has population dynamics.

#### *Module 6: Individuals' Records Updating Inheritor or Life (M.27)*

In the first sub-module the individuals may die with probabilities (*ρage*.*gender*) depending on age ((*Age*) *ind <sup>t</sup>* ) and gender (*Gind* = {0||1}). If a person dies, after the submodules *Inheritor* (M.28) and *Inheritance* (M.29 & M.30) have been applied, the individual is deleted from the database. This insolvency has a direct impact on the banks in the form of an increase in non-performing loans. In the case of survival of an individual, the program increases the age of the person ((*Age*) *ind <sup>t</sup>* + +) and the period since the last change of status on the labour market (Ψ*ind <sup>t</sup>* + +) and continues in the sub-module *Updating consumer type* (M.31).

#### *Module 6: Individuals' Records Updating Inheritor (M.28)*

In this submodule, the heir in the event of death of an individual is determined. First, the age of the deceased person is checked. If the deceased person was an adult ((*Age*) *ind <sup>t</sup>* ≥ 18), inheritance may be considered. Then, all members of the households and adults in the households are counted. If an adult over the age of 18 has died, who does not have family, the labor status of this individual is checked (Ξ*ind <sup>t</sup>* ). If this individual was an entrepreneur (Ξ*ind <sup>t</sup>* <sup>=</sup> 5), the number of employees (L*firm <sup>t</sup>* ), in the company is checked. If it was a sole proprietorship, then the firm is for sale ((*ForSale*) *firm <sup>t</sup>* = 1). Otherwise, one of workers in their company who earned the highest wage in the previous period is selected. If the deceased person was not an entrepreneur, then the algorithm selects an inheritor at random from the group of working adults (Ξ*ind t* = 1 && (*Age*) *ind <sup>t</sup>* ≥ 18). If a child dies ((*Age*) *ind t* ≤ 18), they do not leave material property, rather the consumer type of the child's parents changes. If the parents have no more children and if all household members are over 67 years old then we update

the consumer type ((*ConsT*) *cons <sup>t</sup>* = 3). If both parents were under 67, they are also updated to another consumer type ((*ConsT*) *cons <sup>t</sup>* = 4). If the family consists of more than two adults then the consumer type is also updated ((*ConsT*) *cons <sup>t</sup>* = 6). If the deceased adult person has a family, then two cases must be differentiated. If they had children, the eldest person in the family is the inheritor and the consumer type does not change ((*ConsT*) *cons <sup>t</sup>* = {5||6}). If there were no children, then the spouse is the inheritor and the consumer type changes depending on the age of the spouse ((*ConsT*) *cons <sup>t</sup>* = {1||2}). If the deceased adult was a single parent, then the adoption of a child is considered in the model in the module *Adoption*. The algorithm looks for a new couple or a single individual to be a parent and sum up deposits, ownership of properties and firms. If they own more than two properties, they are designated for sale ((*ForSale*) *firm <sup>t</sup>* = 1). We remove the deceased person from the database. We continue to the *Inheritance* modules (M.29 & M.30).

#### *Module 6: Individuals' Records Updating Inheritance: Deposits & Firms (M.29)*

In this submodule, we pass the deposits and firms to the inheritor. Firstly, savings after deductions of housing loans pending to be paid are given to the inheritor. If these savings are greater than zero (*ddec*.*ind <sup>t</sup>* − (*pl*) *Hind <sup>t</sup>* + (*pl*) *NHind t* > 0), then the deposits of the heir are updated.

$$d\_t^{\text{hirl},iind} + = (1 - t\_{\text{inh}}) \times \left( d\_t^{\text{dcc.},iind} - \left( pl \right)\_t^{H^{ind}} - \left( pl \right)\_t^{NH^{ind}} \right) \tag{95}$$

The parameter *tinh* stands for taxes that must be paid. In the model we assumed that consumer loans are not inherited and hence the inflow of non-performing loans of banks ((*NPLlC* ) *b <sup>t</sup>* ) and the probability of default of bank ((*PD*) *b <sup>t</sup>* ) are updated.

$$\left(NPL\_{l^C}\right)\_t^b + = \left(pl\right)\_t^{C^{nd}}\tag{96}$$

If individual debts are greater than savings, then the variables are updated separately. In this way it is possible for the heir to inherit the debt from the loan taken in the past.

$$d\_t^{hir.ind} + = (1 - t\_{inh}) \times d\_t^{dec.ind} \tag{97}$$

$$l\_t^{H^{
hir,
ind}} + = (pl)^{H^{
hat,
und}}\_t \tag{98}$$

$$\left(\left(pl\right)\_{t}^{H^{pair}ind}\right.\tag{9}$$

$$l\_t^{H\_q^{
bar{
ind}}} + = l\_t^{H\_q^{
dot{
ind}}} \tag{100}$$

$$R\_t^{H^{
bar{
ind}}} + = R\_t^{H^{
dot{
ind}}} \tag{101}$$

$$R\_t^{H\_q^{
bar,
ind}} + = R\_t^{H\_q^{
dot,
ind}} \tag{102}$$

$$l\_t^{NH^{bir,ind}} + = (pl)\_t^{NH^{del,ind}} \tag{103}$$

$$(pl)\_t^{NH^{hir, ind}} + = (pl)\_t^{NH^{hir, ind}} \tag{104}$$

$$l\_t^{NH\_q^{hor,ind}} + = l\_t^{NH\_q^{der,ind}} \tag{105}$$

$$R\_t^{NH^{hrr,md}} + = R\_t^{NH^{hcc,md}} \tag{106}$$

$$R\_t^{NH\_q^{harm,md}} + = R\_t^{NH\_q^{doc,md}} \tag{107}$$

$$(NPL\_{l^C})\_t^b + = (pl)^{C^{nd}}\_t.\tag{108}$$

As the non-performing consumer loans increase, the probability of default of bank ((*PD*) *b <sup>t</sup>* ) increases as well. If the deceased person was not the owner of the firm, then we update savings (deposits) only. Otherwise, the inheritor may or may not run the business in the future. The decision on running a business depends on their previous earnings relative to the potential income from business activity.

$$w\_t^{\text{inh.ind}} + (sub)\_t^{\text{inh.ind}} < rndm(0, 1) \times w\_t^{\text{dc.ind}} \tag{109}$$

If the inheritor decides to run the business, the status of entrepreneur ((*Entr*) *ind <sup>t</sup>* = 1), the labor status (Ξ*ind <sup>t</sup>* = 5) and the number of periods since the last change in labor status (Ψ*ind <sup>t</sup>* = 0) are updated. The public assistance is ceased ((*sub*) *ind <sup>t</sup>* = 0). The inheritor is responsible for paying back the investment loans.

$$\left.l\_t^{I^{hor,ind}} + = (pl)^{I^{dec,ind}}\_t\right. \tag{110}$$

$$\left(\left(pl\right)\_{t}^{I^{dir,ind}} + = \left(pl\right)\_{t}^{I^{dc,ind}}\tag{111}$$

$$l\_t^{l\_q^{pair,ind}} + = l\_t^{l\_q^{dac,ind}} \tag{112}$$

$$R\_t^{I^{hor,ind}} + = R\_t^{I^{doc,ind}} \tag{113}$$

$$R\_t^{I\_q^{bar,ind}} + = R\_t^{I\_q^{dac,ind}} \tag{114}$$

If the inheritor decides to sell, the company is marked for sale ((*ForSale*) *firm <sup>t</sup>* = 1). The inflow of non-performing loans is increased by the amount of investment loans that will not be paid. The probability of default of bank ((*PD*) *b <sup>t</sup>* ) is also increased in that case.

$$(NPL\_{l^l})^b\_t + = (pl)^{l^{ind}}\_t.\tag{115}$$

*Module 6: Individuals' Records Updating Inheritance: Properties (M.30)*

In this module, the number of adults who were in the household of deceased person is checked, as is whether the deceased person rented ((*Own*) *HH <sup>t</sup>* = 0) or owned their residence ((*Own*) *HH <sup>t</sup>* = 1). If the the deceased individual rented his residence, then the number of households that rents this property needs to decrease ((#*Rent*) *prop <sup>t</sup>* − −). If the deceased person owned their residence and had no mortgage, then the property is marked for sale ((*ForSale*) *firm <sup>t</sup>* = 1). However, if the deceased person had a housing loan to buy the property, the bank receives the property and attempts to sell it ((*ForSale*) *firm <sup>t</sup>* <sup>=</sup> 1). The bank looks for any household which sum of deposits (∑*Nind*.*HH <sup>i</sup>*=<sup>1</sup> *<sup>d</sup>ind*.*HH it* ) is greater than the property price (*Pprop <sup>t</sup>* ). If it is found, then the bank updates the inflow of non-performing loans ((*NPLlH* ) *b <sup>t</sup>* , (*NPLlNH* ) *b <sup>t</sup>*) and the revenue from selling the property ((*RevlH* ) *b t* ).

$$(NPL\_{l^H})^b\_t + = (pl)^{H^{dec.ind}}\_t \tag{116}$$

$$(NPL\_{l^{NH}})\_t^b \leftarrow = (pl)\_t^{NH^{dcc, ind}} \tag{117}$$

$$(Rev\_{l^{H}})\_{t}^{b} + = (1 - \beta \mathbf{2} \mathbf{2}) \times P\_{t}^{prop} \tag{118}$$

where *β*<sup>22</sup> expresses the transaction costs.

The new owners of the property proportionally update the deposits (*dind*.*HH <sup>t</sup>* ) after the purchase.

$$d\_t^{ind.HH} - = \frac{1}{N^{ind.HH}} \times (1 - \beta\_{22}) \times P\_t^{prop} \tag{119}$$

If the bank is not able to sell the property, the price (*Pprop <sup>t</sup>* ) is lowered gradually:

$$P\_t^{prop} = 0.95 \times P\_{t-1}^{prop}.\tag{120}$$

#### *Module 6: Individuals' Records Updating Updating Consumer Type (M.31)*

In this module the consumer type of the household is updated. If the individual reaches the age of 67, then the consumer type of the household the individual belongs to is updated (ie. (*ConsT*) *cons <sup>t</sup>* =1 if the individual was single, while (*ConsT*) *cons <sup>t</sup>* = 3 if was married). If the individual become an adult ((*Age*) *ind <sup>t</sup>* = 18), then a new household is created. The individual continues to live in the same property. The accommodation cost and the income are computed according to the formulas expressed in the previous modules (M.11, M.12 & M.22).

#### *Module 6: Individuals' Records Updating Education Level (M.32)*

In this submodule the level of education is updated. If an individual continues to study ((*EducP*) *ind <sup>t</sup>* + +) and exceeds the number of periods that is needed to complete a particular level of education (i.e., primary school, secondary school, college, university degree, doctoral school), then a variable describing their education level ((*Educ*) *ind <sup>t</sup>* + +) is updated.

#### *Module 6: Individuals' Records Updating Continue Education (M.33)*

The individuals continue education with a probability depending on age and gender (*prage*.*gender*). According to this probability, the completed level of education ((*Educ*) *ind <sup>t</sup>* ), labour market status (Ξ*ind <sup>t</sup>* ) of an individual and the number of periods that have passed since the last change of status in the labour market (Ψ*ind <sup>t</sup>* + +) are updated. In this module the labor status of individuals that continue education is set to one (Ξ*ind <sup>t</sup>* =1).

#### *Module 6: Individuals' Records Updating Divorces (M.34)*

In this submodule, individuals may divorce. The algorithm checks the civil status of individuals (Λ *ind <sup>t</sup>* ). The probability of divorce depends on the age of the spouses (*pr*40.*age*). After the divorce, a new household is created for ex-husband and the consumer types ((*ConsT*) *cons <sup>t</sup>* ) are adjusted. In the case of divorce, children always stay with the mother. The ex-husband pays the alimony ((*Don*) (*husb*).*HH <sup>t</sup>* ) which depends on his earnings (*wind <sup>t</sup>* ) and the number of children ((#*child*)*temp*).

$$(Dom)^{(wif \varepsilon).HH}\_t + = \beta\_{39} \times w^{ind}\_t \times (\#child)\_{temp} \tag{121}$$

$$(Dom)^{(luub),HH}\_t - = \beta\_{39} \times w^{ind}\_t \times (\#child)\_{temp} \tag{122}$$

Both adults remain in the same property hence they both contribute to rent to cover the accommodation cost. The ex-wife is the owner, while the ex-husband lives there temporary. If the marriage had more than two properties, then each of them stays in one of them and the rest is for sale ((*ForSale*) *prop <sup>t</sup>* = 1). Their status of the owner ((*Own*) *HH <sup>t</sup>* = 1), the variable principal housing ((*PH*) *prop <sup>t</sup>* = 1) and the number of families that rent the property ((#*Rent*) *prop <sup>t</sup>* −−) are updated. If the property was purchased by credit, then the amount of loans pending to be paid by ex-wife has to be updated as well.

$$l\_t^{H^{(wfe),ind}} + = l\_t^{H^{(hwb),ind}}, \; l\_t^{H^{(hwb),ind}} = 0 \tag{123}$$

$$(pl)^{H^{(
uftc),ind}\_t}\_t = (pl)^{H^{(
uob),ind}\_t}\_t (pl)^{H^{(
uub),ind}\_t}\_t = 0\tag{124}$$

$$l\_t^{H\_q^{(
u
i f e),
i 
i d}} + = l\_t^{H\_q^{(
u
u 
b),
i 
i d}}, \\ l\_t^{H\_q^{(
u 
u 
b),
i 
i d}} = 0 \tag{125}$$

$$R\_t^{H^{(wfe),ind}} + = R\_t^{H^{(hwb),ind}}, \ R\_t^{H^{(hwb),ind}} = 0 \tag{126}$$

$$\mathcal{R}\_t^{H\_q^{(uv/t), \text{ind}}} + = \mathcal{R}\_t^{H\_q^{(hubb), \text{ind}}}, \mathcal{R}\_t^{H\_q^{(hubb), \text{ind}}} = 0 \tag{127}$$

$$l\_t^{NH^{(ufw),ind}} + = l\_t^{NH^{(busb),ind}}, \\ l\_t^{NH^{(busb),ind}} = 0 \tag{128}$$

$$l\_t^{NH^{(wfe),ind}} + = l\_t^{NH^{(hwb),ind}}, \\ l\_t^{NH^{(hwb),ind}} = 0 \tag{129}$$

$$(pl)^{NH^{(wi/t),ind}\_t}\_t = (pl)^{NH^{(hubb),ind}\_t}\_{t \ \ldots \ \ldots \ \ldots \ \ldots} (pl)^{NH^{(hubb),ind}\_t}\_{t \ \ldots \ \ldots \ \ldots} = 0 \tag{130}$$

$$l\_t^{NH\_q^{(wfe),ind}} + = l\_t^{NH\_q^{(hwsb),ind}}, \\ l\_t^{NH\_q^{(hwsb),ind}} = 0 \tag{131}$$

$$R\_t^{NH^{(wi\dagger c),ind}} + = R\_t^{NH^{(hubb),ind}}, \; R\_t^{NH^{(hubb),ind}} = 0 \tag{132}$$

$$R\_t^{NH\_q^{(wif),ind}} + = R\_t^{NH\_q^{(hub),ind}}, \ R\_t^{NH\_q^{(hub),ind}} = 0. \tag{133}$$

#### *Module 6: Individuals' Records Updating Marriages (M.35) & Births (M.36)*

*l*

Each single adult can get married in the model. The probability of getting married depends on civil status, age and gender (*prciv*.*st*.*age*.*gend*). In the model, the age difference between partners should not exceed 10 years (|(*Age*) *ind*1 *<sup>t</sup>* − (*Age*) *ind*2 *<sup>t</sup>* | < 10 && *<sup>G</sup>ind*<sup>1</sup> = *Gind*<sup>2</sup> && (*Age*) *ind*1 *<sup>t</sup>* ,(*Age*) *ind*2 *<sup>t</sup>* > 18, <sup>Λ</sup> *ind t* = 2). In the case of marriage, the marital status of individuals (Λ *ind <sup>t</sup>* = 2) as well as the codes identifying the households **(**(*Id*) *HH*) are updated. In addition, the total number of properties and their ownership ((*Own*) *HH <sup>t</sup>* ) are updated. One of properties is marked as the principal residence ((*PH*) *prop <sup>t</sup>* = 1). If the marriage owns more than two properties, they are marked for sale ((*ForSale*) *prop <sup>t</sup>* = 1). The algorithm looks for a household-buyer who has sufficient deposits to pay for the property.

$$\sum\_{i=1}^{N^{ind.HH}} d\_{it}^{ind.HH} - \sum\_{i=1}^{N^{ind.HH}} (l\_t^{H\_q^{ind.HH}} + R\_t^{H\_q^{ind}}) > P\_t^{prop}. \tag{134}$$

When the buyer is found, then deposits are reduced by the amount equal to the sum of prices of *J* properties.

$$d\_{it}^{buy.ind.HH} - = \frac{1}{\mathcal{N}^{ind.HH}} \times \sum\_{j=1}^{\mathcal{J}} P\_{jt}^{prop} \tag{135}$$

If the buyer is not found, the price is decreased by 10%. After selling the properties, the marriage can pay back the housing and non-housing loans. If housing loans pending to be paid are greater than the revenue from selling the properties, then the algorithm decrease the amount of housing loans to be paid.

$$(pl)^{H^{pollr,ind}}\_t - = \frac{1}{N^{ind,HH}} \times \sum\_{j=1}^{J} P^{prop}\_{jt}.\tag{136}$$

Otherwise, we check whether the individual could also pay back the non-housing loans. In that case, if the non-housing loans pending to be paid are greater than the difference between the revenue from selling the properties and housing loans pending to be paid, then the non-housing loans are decreased.

$$(pl)\_t^{NH^{wellor, ind}} - = \frac{1}{N^{ind.HH}} \times \sum\_{j=1}^{J} P\_{jt}^{prop} - (pl)\_t^{H^{eller, ind}}.\tag{137}$$

Then, housing loans pending to be paid are set to zero. If the price for which the properties were sold was greater than the sum of all liabilities then, deposits are updated.

$$d\_{it}^{\text{selfer.ind.}HI} + \ = \frac{1}{N^{\text{ind.}H\text{H}}} \times \sum\_{j=1}^{J} P\_{jt}^{prop} - \left(pl\right)\_{t}^{H^{sollr.ind}} - \left(pl\right)\_{t}^{NH^{sollr.ind}} \,. \tag{138}$$

If the wife had children from a previous marriage, then the consumer type does not change. Otherwise, the model checks the age of the individuals. If at least one member of the household is over 67, the consumer type is updated ((*ConsT*) *cons <sup>t</sup>* = 3). In the *Births* sub-module, children are born with the probability depending on age and civil status of the mother (*prage*.*st*.*civil*). All necessary records are created for a newborn in submodule (M.36).

#### *Module 6: Individuals' Records Updating Updating Entrepreneurs (M.37)*

In this module, decisions are made on whether an adult individual ((*Age*) *ind <sup>t</sup>* > 18) becomes an entrepreneur. If the individual is already an entrepreneur ((*Entr*) *ind <sup>t</sup>* = 1), then the program skips this module and continues in the *Probability of opening a new firm* module (M.38). For the individuals unemployed (Ξ*ind <sup>t</sup>* = 2), employed in private sector (Ξ*ind <sup>t</sup>* = 3), inactive (Ξ*ind <sup>t</sup>* = 4), or employed in the public sector (Ξ*ind <sup>t</sup>* = 5), the probability of becoming an entrepreneur is computed. The probability depends on the experience in running a business ((*EntrP*) *ind <sup>t</sup>* = 1), gender (*Gind*), age ((*Age*) *ind <sup>t</sup>* ), level of education ((*Educ*) *ind <sup>t</sup>* ) and the period that has passed since the last change of status on the labour market (Ψ*ind <sup>t</sup>* )

$$\begin{split} \left( \left( \operatorname{Entr} \mathbf{S} \right)\_{t}^{\operatorname{ind}} = \left| \left( \operatorname{max} \left\{ \operatorname{Entr} \mathbf{S} \right\}\_{t-1}^{\operatorname{ind}} \times \right. \right. \\ \left. \times \left( \left\{ \mathfrak{f}\_{G} \mathbf{G}^{\operatorname{ind}} + \mathfrak{f}\_{\operatorname{End}} \left( \operatorname{Entr} \right)\_{t}^{\operatorname{ind}} + \mathfrak{f}\_{\operatorname{Entr} \mathbf{P}} \left( \operatorname{Entr} \mathbf{P} \right)\_{t}^{\operatorname{ind}} + \mathfrak{f}\_{\operatorname{Agv}} \left( \operatorname{Age} \right)\_{t}^{\operatorname{ind}} + \mathfrak{f}\_{\mathbf{V}} \mathbf{V}\_{t}^{\operatorname{ind}} \right) \right) , \ \mathfrak{f}\_{\operatorname{Entr} \mathbf{S}\_{\operatorname{aux}}} \left( \right) \right]. \end{split} \tag{139}$$

If the entrepreneur spirit is high enough, the individual becomes an entrepreneur ((*Entr*) *ind <sup>t</sup>* = 1). Otherwise, the program moves to module *Updating individual labour status* (M.47).

#### *Module 7: Firm Demography Probability of Opening a New Firm (M.38)*

In the *Firm demography* module, we analyse the possibility of entrepreneurs opening new companies in the system. As a part of the first *Probability of opening a new firm* submodule, the probability of opening a firm in a given industry is determined. This probability depends on previous experience in the industry ((*EntrP*) *ind <sup>t</sup>* ), level of education ((*Educ*) *ind <sup>t</sup>* ) and age of the entrepreneur ((*Age*) *ind <sup>t</sup>* ). Firstly, temporary variables are calculated that are required to calculate the probability of creating a new company in a given sector.

$$temp\_1 = \gamma\_2 + \gamma\_3 \times \left(\text{EntrP}\right)\_t^{\text{ind}} + \gamma\_4 \times \left(\text{Educ}\right)\_t^{\text{ind}} + \gamma\_5 \times \left(\left(\text{Age}\right)\_t^{\text{ind}} + \gamma\_6\right) \tag{140}$$

$$temp\_2 = \gamma\_7 + \gamma\_8 \times (EntrP)\_t^{ind} + \gamma\_9 \times (Educ)\_t^{ind} + \gamma\_{10} \times ((Age)\_t^{ind} + \gamma\_{11}) \tag{141}$$

According to a given probability, the entrepreneur will open a new company in the most profitable sector (if *pr* < *temp*1) and then in the second most profitable sector (if *pr* < *temp*2). In this module we use information from the *Initialisation* module (M.1). If the entrepreneur cannot open up activity in these two sectors, they will start operating in a randomly selected industry.

#### *Module 7: Firm Demography New License (M.39)*

A number of criteria must be met to create a new business. First and foremost, it is necessary to obtain a license. The likelihood of obtaining a license depends on the size of the company compared to the average firm size in the industry and industry-specific parameters. The company's initial size (*Size*)*temp* is drawn from the normal distribution with the expected value ((*AL*) *s <sup>t</sup>*) and the standard deviation of the size of firms (empirically determined) ((*SD*) *s t*).

$$(Size)\_{temp} \text{ was drawn from } \mathcal{N}((AL)^{s}\_{t'}(SD)^{s}\_{t}) \tag{142}$$

$$(InitSize)\_{temp}^{firm} = \max\{\min\left(\gamma\_{12} \times (AL)\_{t\prime}^s \ (Size)\_{temp}\right), 0\}.\tag{143}$$

#### *Module 7: Firm Demography Funding New Firm Creation (M.40)*

This module analyses the possibility of opening a company from funds held by the entrepreneur or co-financing the opening of the company from external sources. Large companies can be co-financed by various individuals. In this case, the initial capital of the company is equal to the sum of the contributions of the individuals. The amount depends on the type of household to which the individual belongs. These individuals hold shares in the company. According to the algorithm, the cost of setting up a company depends on the size of the company measured by the number of employees ((*InitSize*) *firm temp*), average salaries in the industry *<sup>W</sup><sup>s</sup> <sup>t</sup>*, and industry-specific fixed costs specified by the parameter *γ* 17.*s*:

$$(CostNew)\_{temp}^{firm} = (InitSize)\_{temp}^{firm} \times \overline{W}\_t^\* \times \gamma\_{16} + \gamma\_{17.s} \tag{144}$$

The value of the individual's savings after deducting the charges for other repayments of loans is then calculated. If these funds are greater than the cost of establishing a business, the entrepreneur will allocate funds to set up a business. Consequently, the amount of savings in the entrepreneur's account is updated. Otherwise, depending on the size of the business, the entrepreneur can apply for bank credit (*Bank firm creation funding* (M.41.1.) & *New firm creation* (M.41.1.1)) or look for co-shareholders (*Shares* (M.41.2)).

#### *Module 7: Firm Demography Bank Firm Creation Funding (M.41.1)*

The entrepreneur seeks a bank which is both willing to lend funds and that offers a lower interest rate than other banks (*ilI* ). In addition, the sectoral exposure requirements are checked (*CostNew*) *firm temp* <sup>≤</sup> *<sup>γ</sup> sect*.*exp*). If the selected bank has the requested funds (*Sl*.*Iest <sup>t</sup>* ≥ (*CostNew*) *firm temp*), creditworthiness is checked. In order to obtain the loan, the following criteria are to be fulfilled:

(1) the leverage ratio needs to be acceptable:

$$\frac{(CostNew)^{firm}\_{temp}}{\mathbb{K}^{firm}\_{init}} < \gamma\_{LR.b\*} \tag{145}$$

where *Kfirm init* is a sum of funds (deposits) that the owners or shareholders provided to fund the capital of the company.

(2) the financial risk of the business has to be relatively low in comparison to the sectorial risk

$$((Risk)\_t^{firm} < \gamma\_{Risk.b} \text{ \& } (Risk)\_t^{firm} < \overline{(Risk)\_t^s}),\tag{146}$$

(3) the size of the company has to be at least average for the industry (*Lfirm <sup>t</sup>* /*L s <sup>t</sup>*) and credit history has to be good ((*PD*) *firm <sup>t</sup> < γ cred*.*h*.*b*).

Banks may set their own thresholds for the proposed criteria. In this way banks compete not only on interest rates but also creditworthiness criteria. Thresholds are an expression of their degree of risk aversion and the adopted strategy of a bank's activity. If the trader does not get the requested amount in a given bank, they try again to apply for a loan in another bank, starting with the bank that offers the lowest interest rate. In extreme cases, the amount of funding obtained from the bank is reduced, gradually up to the limit below which it would not be possible to open a business in the sector. In the *New firm creation* (41.1.1) sub-module, records are created for the new firm, and the firm loans of the individual are updated. Maturity of the loan (M*Iind* ) is assigned depending on the amount of loan taken.

$$l\_t^{l^{ind}} + = (CostNew)\_{temp}^{firm} \tag{147}$$

$$(pl)^{l^{ind}}\_t = (CostNew)^{firm}\_{temp} \tag{148}$$

$$l\_t^{I\_g^{ind}} + = \frac{(\text{CostNew})\_{temp}^{firm}}{\mathbf{M}^{I^{ind}}} \tag{149}$$

$$R\_t^{\text{ind}} + = \frac{1}{\kappa\_4} \times \left( (\text{CostNew})\_{temp}^{\text{firm}} \times (1 + 0.25 \times i\_{l^l})^{\text{M}^{\text{ind}}} - (\text{CostNew})\_{temp}^{\text{firm}} \right) \tag{150}$$

$$R\_t^{I\_q^{ind}} + \ = \frac{R\_t^{I^{ind}}}{\mathbf{M}^{I^{ind}}} \tag{151}$$

The bank's revenues are updated as well.

$$(Rev\_{l^l})^b\_t + = R\_t^{l^{ind}\_q}.\tag{152}$$

#### *Module 7: Firm Demography Shares (M.41.2)*

For large companies, their initial capital is the sum of the contributions of the individuals. The share of each individual is determined by the consumer type of the household to which this individual belongs and the deposits. The algorithm looks for *M* individuals which shares will fund the cost of setting up the firm ((*CostNew*) *firm temp*). For all individuals we update the values of shares (*ψind <sup>t</sup>* ) and deposits (*dind <sup>t</sup>* ). Large companies can apply for short-term loans but are funded by their shares. In the case of short-term loans, mechanisms are analogous to the one presented for small and medium-sized businesses but different credit ratings are adopted.

#### *Module 8: Mergers & Acquisitions Updating Firm Market Value (M.42)*

The *Mergers & Acquisitions* module analyses the possibility of one company buying another. First, the value of the company on the market ((*MV*) *firm <sup>t</sup>* ) is updated, depending on the company's generated profits relative to average firm profits in the sector ((*RelPro f*) *firm temp* <sup>=</sup> <sup>Π</sup>*firm <sup>t</sup>* /(*π*) *s <sup>t</sup>*) and the company's financial risk relative to the average risk in the industry ((*RelRisk*) *firm tem* = (*Risk*) *firm <sup>t</sup>* /(*Risk*) *s t*). The market value of a company is correlated with the likelihood of bankruptcy of a particular company. By default, the maximum value of this variable is 1. The closer this value is to 1, the higher the probability of bankruptcy. If the variable is close to 1, then the probability of the business declaring insolvency increases.

#### *Module 8: Mergers & Acquisitions Mergers (M.43)*

If the business debt ((*Debt*) *firm <sup>t</sup>* ) is lower than that specified by the parameter *γ <sup>π</sup>* part of the firm's profits (Π*firm <sup>t</sup>* **)**, the firm was not marked as for sale ((*ForSale*) *firm <sup>t</sup>* = 0), the firm debt is lower than that determined by the parameter *γ LA*\_*<sup>K</sup>* part of liquid assets ((*LA*) *firm <sup>t</sup>* ) and capital (*Kfirm <sup>t</sup>* ), the firm value ((*MV*) *firm <sup>t</sup>* ) is greater than that specified by the parameter *γ MV* , a percentage *γ merg*<sup>1</sup> of firms in the sector is searched for. The company will merge with one of these firms. The company to be merged with must meet several requirements. First, the sum of liquid assets of the firm and the fixed capital of this firm need to be lower than that of the second company.

$$((LA)\_t^{\text{marged.}, \text{firm}} + K\_t^{\text{marged.}, \text{firm}}) < ((LA)\_t^{\text{firm}} + K\_t^{\text{firm}}).\tag{153}$$

Secondly, it should be a smaller company, in a sense that the work force of this firm is smaller than the work force of the second company (*Lmerged*. *firm <sup>t</sup>* <sup>&</sup>lt; *<sup>L</sup>firm <sup>t</sup>* ). Next, the market value of the firm should be acceptable ((*MV*) *merged*. *firm <sup>t</sup>* > *γ MV* × (*MV*) *firm <sup>t</sup>* ) and this firm should not be marked for sale ((*ForSale*) *firm <sup>t</sup>* = 0). If the merger occurs, then the attributes of the firm and the entrepreneur are updated.

$$(Debt)\_t^{firm} + = (Debt)\_t^{mrygel.firm} + (MV)\_t^{mrygal.firm} \times ((LA)\_t^{mrygel.firm} + K\_t^{mrygal.firm}) \tag{154}$$

$$(\mathcal{N}\_{est})\_t^{firm} + = (\mathcal{N}\_{est})\_t^{mTr\otimes cl.firm} \tag{155}$$

$$((LA)^{firm}\_t + = (LA)^{firm}\_t \tag{156}$$

$$((LA)\_t^{\\\\\prime\cdots\cdots}+\\\\\cdots)\_{\nu\,\\\\\widetilde{\,}rm\,\,}^{\ldots\cdots\cdots}\tag{156}$$

*Kfirm <sup>t</sup>* + = *<sup>K</sup>firm <sup>t</sup>* . (157)

The owner of the firm changes and the corresponding variables such as labor status ( Ξ*ind <sup>t</sup>* = 5**)**, entrepreneurship ((*Entr*) *ind <sup>t</sup>* = 1), entrepreneurship in the past ((*EducP*) *ind <sup>t</sup>* = 1), periods since the last change on the labor market (Ψ*ind <sup>t</sup>* = 0) and the deposits are updated as well.

$$d\_t^{\text{super,ind}} = \gamma\_{53} \times (MV)\_t^{\text{mergcd,firm}} \times ((LA)\_t^{\text{mergcd,firm}} + K\_t^{\text{mergcd,firm}}).\tag{158}$$

If the firm wants to merge but there is no company to merge within the set *γ merg*<sup>1</sup> of firms, the procedure is repeated in the broader set specified by *γ merg*2.

#### *Module 8: Mergers & Acquisitions Acquisitions (M.44)*

If a company is successful and its financial risk is below average risk in the industry ((*Risk*) *firm <sup>t</sup>* ≤ (*Risk*) *s <sup>t</sup>*) and the firm is not marked for sale ((*ForSale*) *firm <sup>t</sup>* = 0), then it seeks to acquire another firm. In practice, this company should be relatively small (*Lest <sup>t</sup>* < *<sup>γ</sup>* <sup>55</sup> × *<sup>L</sup>est <sup>t</sup>* ), debt should be lower than the one expressed by debt percentage of the firm before acquisition ((*Debt*) *firm <sup>t</sup>* < *γ* <sup>56</sup> × (*Debt*) *firm <sup>t</sup>* ), and this company should be marked for sale ((*ForSale*) *firm <sup>t</sup>* = 1). If a company to acquire is found, then the attributes of the firms and the entrepreneur are updated. The entrepreneur is now the co-owner of the firm.

$$\begin{split} \left( \left( Debt \right)\_{t}^{firm} + \left( Debt \right)\_{t}^{acq, firm} + \left( MV \right)\_{t}^{acq, firm} \times \left( \left( LA \right)\_{t}^{acq, firm} + \mathbb{K}\_{t}^{acq, firm} + \mathbb{K}\_{t}^{acq, firm} + \mathbb{K}\_{t}^{acq, firm} \right) \right) \\ - \left( Debt \right)\_{t}^{acq, firm} \times \sqrt{rndm(0, 1)} \end{split} \tag{159}$$

$$\mathcal{K}\_t^{firm} + = \mathcal{K}\_t^{acq.firm} \tag{160}$$

$$(\mathbf{N}\_{\rm est})^{firm}\_{t} + = (\mathbf{N}\_{\rm est})^{acq.firm}\_{t} \tag{161}$$

$$(LA)^{firm}\_t + = (LA)^{acq.firm}\_t \tag{162}$$

$$L\_t^{firm} + = L\_t^{acq.firm}.\tag{163}$$

*Module 9: Firm Growth Individuals Records Updating When Firm Closes (M.45)*

This module deals with the opening and closure of companies. If the company was registered more than 1.5 years ago ((#*Oper*) *firm <sup>t</sup>* > 6) and the number of employees is 0, then the company is removed from the system. If the entrepreneur does not own other firms, the value of variables which describe the experience of being an entrepreneur ((*Entr*) *ind <sup>t</sup>* = 0, (*EntrP*) *ind <sup>t</sup>* = 1), status on

the labour market (Ξ*ind t* = 5) and the period since the last change of status on the labour market (Ψ*ind <sup>t</sup>* = 0) are updated. If the company qualifies for closure, all employees will be first fired, and then the establishments will be closed.

#### *Module 9: Firm Growth New Establishment Creation (M.46)*

In this sub-module, firms with a strong position can also increase the number of establishments they own. If the company's financial risk is lower than the average risk in the sector ((*Risk*) *firm <sup>t</sup>* < (*Risk*) *s <sup>t</sup>*) and the profit per employee <sup>Π</sup>*firm t* (*Lfirm <sup>t</sup>* <sup>+</sup>1) is higher than the percentage of the average profit per employee in the sector *<sup>υ</sup>*<sup>2</sup> <sup>×</sup> *<sup>π</sup><sup>s</sup> t* (*<sup>N</sup> firms <sup>t</sup>* <sup>×</sup>(*<sup>L</sup> s t*+1)), then the company can create new establishments.

#### *Module 10: Labour Market Updating Individual Labour Status (M.47)*

Within the framework of the model, a stylized labour market has been designed. In the model the parameters *α*57.*age*.*gender*−62.*age*.*gender* depend on age and gender. In the module the status on the labour market of all individuals (Ξ*ind <sup>t</sup>* ) and the time since the last change of status on the labor market (Ψ*ind <sup>t</sup>* ) are updated. If the individual is a woman over the age of 55, employed in the private or public sector, she is likely to be unemployed with the probability *α*57.*age*. If the individual is a man over the age of 55, employed in the private or public sector, he is likely to be unemployed with the probability *α*58.*age*. If the individual is a woman, who is unemployed for more than 2 years, then she becomes inactive with probability *α*59.*age*. If the individual is a man who is unemployed for more than 2 years, then he becomes inactive with probability *α*62.*age*. If a person is inactive on the labour market and is under the age of 55 and their total family income is less than the established threshold, then this person will be registered as an active job seeker, even if only for the purpose of receiving social benefits.

#### *Module 10: Labour Market Workers Skills (M.48)*

This sub-module updates the variable describing employee skills. These skills depend on age, gender, time elapsed since the last change of status on the labour market and completed education.

$$\boldsymbol{\Theta}\_{t}^{\text{ind}} = \max\{0; \boldsymbol{\gamma}\_{\text{F}} \times \boldsymbol{\Psi}\_{t}^{\text{ind}} + \boldsymbol{\gamma}\_{\text{Endc}} \times (\text{Endc})\_{t}^{\text{ind}} + \boldsymbol{\gamma}\_{\text{G}} \times \boldsymbol{G}^{\text{ind}} + \boldsymbol{\gamma}\_{\text{E}} \times \boldsymbol{\Xi}\_{t}^{\text{ind}} + \boldsymbol{\gamma}\_{\text{Age}} \times (\text{Age})\_{t}^{\text{ind}}\}. \tag{164}$$

#### *Module 10: Labour Market Hiring & Firing in Establishments (M.49)*

This sub-module carries one from the *Firm growth* module. In this sub-module a decision is made to reduce or increase the number of employees. First, the number of employees to be fired (*LF Iest <sup>t</sup>* ) and hired in the establishment (*LH Iest <sup>t</sup>* ) is compared. Employees with the lowest working skills are fired. If the number of employees to be hired is greater than the number of employees to be fired, then employees are searched for according to their location (using NUTS1-4 codes: *ϑ ind*<sup>1</sup> *<sup>t</sup>* , *<sup>ϑ</sup> ind*<sup>2</sup> *<sup>t</sup>* , *<sup>ϑ</sup> ind*<sup>3</sup> *<sup>t</sup>* , *<sup>ϑ</sup> ind*<sup>4</sup> *<sup>t</sup>* ). The model assumes that employees living closer to the firm are beneficial to the company.

#### *Module 11: Cycle Ends*

The final module updates the remaining agent records that have not been updated in previous modules. Loans and deposits of individuals, households, companies and, above all, banks are settled. Non-performing loans in the period are also counted.

#### *Module 11: Cycle Ends Labor Status & Wage & Subsidy Updating (M.50)*

Individuals from the *Labor market* modules (M.47–M.49) are carried on into this sub-module. If individuals have just become unemployed (Ξ*ind <sup>t</sup>* = 2 && Ψ*ind <sup>t</sup>* = 0), they receive unemployment benefits ((*sub*) *ind <sup>t</sup>* = *<sup>δ</sup>* <sup>1</sup>) and their earnings from previous employment (*wind <sup>t</sup>* = 0) are equal to zero. If individuals have become unemployed more than one quarter ago (Ξ*ind <sup>t</sup>* = 2 && Ψ*ind <sup>t</sup>* > 1), then they

*t*

receive lower benefits ((*sub*) *ind <sup>t</sup>* = *<sup>δ</sup>* <sup>2</sup>, *<sup>δ</sup>* <sup>2</sup> < *<sup>δ</sup>* 1). If a person is employed in the private sector (Ξ*ind <sup>t</sup>* = 3), then no social benefits are to be paid ((*sub*) *ind <sup>t</sup>* = 0) and the earnings are calculated according to the formula that depends on age ((*Age*) *ind <sup>t</sup>* ), gender (*Gind*), average wage per employee in the sector *Ws t L s* and a random factor.

$$w\_t^{ind} = \frac{\overline{W}\_t^s}{\overline{L}\_t^s} \times (\delta\_\cdot + \delta\_\cdot \times G^{ind}) \times (\delta\_\cdot + \delta\_\cdot \times (Age)\_t^{ind}) \times (rndm(0.04, 0.06)). \tag{165}$$

If the person is 67 years old and the subsidy was equal to 0, then the subsidy depending on average wage in the sector, gender and values of parameters is computed. If the person is inactive, then the gender and age of the individual are checked. If individuals are older than 55 (*Gind* = 1 && (*Age*) *ind <sup>t</sup>* > 55), and had positive wage (*wind <sup>t</sup>* > 0), they may retire early. The subsidy depending on gender and previous wage is computed, and the wage is set to zero (*wind <sup>t</sup>* = 0, (*sub*) *ind <sup>t</sup>* = *<sup>δ</sup>* <sup>2</sup> × *<sup>w</sup>ind <sup>t</sup>* for women and (*sub*) *ind <sup>t</sup>* = *<sup>δ</sup>* <sup>2</sup> × *<sup>w</sup>ind <sup>t</sup>* for man). If the person in question runs a business and the profits of the firm are positive (Π*firm <sup>t</sup>* > 0), then for each of the companies they run, the portion of the profit paid to dividends is calculated; this is equal to the remuneration of the owner(s).

$$(Divid)\_{temp} + = \Pi\_t^{firm} \times \delta\_{14} \times rndm(0,0.02) \tag{166}$$

$$w\_t^{ind} + = (Divid)\_{t 
cup p} \tag{167}$$

$$(sub)\_t^{ind} = 0\tag{168}$$

$$(Debt)\_{t}^{firm} + = (Divid)\_{temp}.\tag{169}$$

If the total family income is below the subsistence level (below *δ* 3), the public assistance is provided ((*sub*) *ind <sup>t</sup>* = *δ* 4)

#### *Module 11: Cycle Ends Establishments & Firms Records Updating (M.51) & (M.52)*

The submodules *Updating establishment & firm records* first change the status of new establishments to experienced ones ((*New*) *est <sup>t</sup>* − −) and wages of these establishments are rested from the liquidity assets ((*LA*) *est <sup>t</sup>* − = *<sup>W</sup>est <sup>t</sup>* ) and then set to zero (*West <sup>t</sup>* = 0). Then we compute the cost of wages (*West <sup>t</sup>* +=*wind <sup>t</sup>* ) and the total costs of the establishments.

$$\left( \left( T \Box \right)\_{t}^{nt} + \left( \delta \times \left( Im \right)\_{t}^{nt} + \delta \times \left( \left( \mathbf{Debt} \right)\_{t}^{firm} / \left( \theta \mathbf{Opr} \right)\_{t}^{firm} \right) + t\_{p\tau} + \delta \,\_{18,s} \times Y\_{t}^{nt} + \delta \,\_{19,s} \times L\_{t}^{nt} + \delta \,\_{20} \times W\_{t}^{nt} \tag{170} \right) \left( \left( \mathbf{G} \right)\_{t}^{nt} + \delta \,\_{21,s} \times W\_{t}^{nt} \right) + \left( \mathbf{G} \right)\_{t}^{nt} + \delta \,\_{22} \times W\_{t}^{nt} + \delta \,\_{23} \times W\_{t}^{nt} + \delta \,\_{24} \times W\_{t}^{nt} + \delta \,\_{25} \times W\_{t}^{nt} + \delta \,\_{26} \times W\_{t}^{nt} \right) + \left( \mathbf{G} \right)\_{t}^{nt} + \delta \,\_{25} \times W\_{t}^{nt} + \delta \,\_{26} \times W\_{t}^{nt} + \delta \,\_{27} \times W\_{t}^{nt} + \delta \,\_{28} \times W\_{t}^{nt} + \delta \,\_{29} \times W\_{t}^{nt} + \delta \,\_{29} \times W\_{t}^{nt} + \delta \,\_{29} \times W\_{t}^{nt} \right) $$

Then the costs are paid from the liquid assets. If the liquid assets of the firm are negative ((*LA*) *est <sup>t</sup>* < 0), the establishment has liquidity shortage. We first check whether the firm is able to move sources from one establishment to the other one. If the firm owns more than one establishment and the liquidity of the firm and establishment are positive ((*Nest*) *firm <sup>t</sup>* > 1 && ((*LA*) *est <sup>t</sup>* + (*LA*) *firm <sup>t</sup>* ) > 0), one of the establishments is closed ((*Nest*) *firm <sup>t</sup>* − −) and liquidity debts of this establishment are paid ((*LA*) *firm <sup>t</sup>* − = (*LA*) *est <sup>t</sup>* ), and the value of default is updated ((*PD*) *est <sup>t</sup>* + + ). The firm is at risk of default, but still has not defaulted ((*PD*) *firm <sup>t</sup>* increases). Otherwise, if the firm consists of only one establishment that has serious liquidity shortage, the firm defaults ((*PD*) *firm <sup>t</sup>* = 1). The non-performing loans are updated ((*NPLlI*) *b <sup>t</sup>* +=(*pl*) *Iind <sup>t</sup>* ). If the owner of this firm does not own any other firm, then the status on the labor market (Ξ*ind <sup>t</sup>* = 2), the periods since the last change of the status on the labor market (Ψ*ind <sup>t</sup>* = 0) and the variable expressing experience in being an entrepreneur ((*Entr*) *ind <sup>t</sup>* = 0, (*EntrP*) *ind <sup>t</sup>* = 1) are updated. In this sub-module, the sales per employee are computed ((*SE*) *est <sup>t</sup>* <sup>=</sup> (*SE*) *est t Lest t* ) and the liquidity assets and fixed capital are updated according to generated profits

(or loses). If the profits per employee are sufficiently high (i.e., if <sup>Π</sup>*firm t* (*Lfirm <sup>t</sup>* +1) > *δ* 21), then the liquid assets and the fixed capital are updated.

$$(LA)\_t^{firm} + = (\delta\_{22} + \delta\_{23}) \times K\_t^{firm} \tag{171}$$

$$K\_t^{firm} = (1 + \delta\_{22} - \delta\_{23}) \times K\_t^{firm} \tag{172}$$

Otherwise, only fixed capital is updated.

$$K\_t^{firm} = (1 - \delta\_{23}) \times K\_t^{firm} \tag{173}$$

If the liquid assets per employee are sufficiently high (i.e., if (*LA*) *firm t* (*Lfirm <sup>t</sup>* +1)>*δ* <sup>25</sup> ), then part of liquid assets can be used to pay back the debts. If the firm's debt is higher than the liquid assets, then the firm's debt and liquid assets are updated.

$$(Debt)\_t^{firm} - = (LA)\_t^{firm} - (L\_t^{firm} + 1) \times \delta\_{25} \tag{174}$$

$$(LA)^{firm}\_t = (L^{firm}\_t + 1) \times \delta\_{25} \tag{175}$$

Otherwise, the debt is paid in full.

$$(LA)^{firm}\_t - = (Debt)^{firm}\_t \tag{176}$$

$$(Debt)^{
rm}\_t = 0.\tag{177}$$

In the worst case scenario, the firm is accumulating debt and the corresponding variables are updated.

$$(Debt)\_t^{firm} + = \left(L\_t^{firm} + 1\right) \times \delta\_{2\delta} - (LA)\_t^{firm} \tag{178}$$

$$(LA)^{firm}\_t = (L^{firm}\_t + 1) \times \delta\_{26}.\tag{179}$$

At the end of this sub-module, lump sum property tax is updated (*tpr*). In the *Updating firm records* sub-module, the age of the firm ((#*Oper*) *firm <sup>t</sup>* + +) and the financial risk are updated.

$$(\text{Risk})\_t^{firm} = \delta\_{\mathcal{D}.s} + \delta\_{\mathcal{R}0} \times \left(\frac{1}{L\_t^{firm} + 1}\right) + \delta\_{\mathcal{R}0} \times \left(\frac{L\_t^{firm}}{(Dcbt)\_t^{firm}}\right). \tag{180}$$

The values of a firm's fixed capital, liquidity assets, work force, firm profit and tax to be paid are the sum of respective values of variables of firms' establishments.

#### *Module 11: Cycle Ends Updating Industries (Sectors) (M.53)*

This module recalculates average values for sectors that become benchmarks for agents' decisions. The values of the quality and average price of each sector are updated ((*Ql*) *s <sup>t</sup>*−<sup>1</sup> = (*Ql*) *s t* , *P<sup>s</sup> <sup>t</sup>*−<sup>1</sup> <sup>=</sup> *<sup>P</sup><sup>s</sup> t* ). Then, the profit in the sector and number of firms in the sector are computed as a sum of firms' profits and the sum of firms. The average financial risk is computed as well. Then, the values of average sales in the sector, price in the sector, quality, average work force of the establishments in the sector, percentage of establishments that import and export as well as average wage in the sector are updated.

#### *Module 11: Cycle Ends Paying Back of Loans (M.54)*

This submodule computes how much has already been paid back from the loan, how much is due and how much interest was paid and is due. This is performed for all types of credit: consumer loans (*l Cind <sup>t</sup>* − = *l Cind q <sup>t</sup>* , (*pl*) *Cind <sup>t</sup>* − = *l Cind q <sup>t</sup>* , *<sup>R</sup>Cind <sup>t</sup>* − = *R Cind q <sup>t</sup>* ), real estate housing (*l Hind <sup>t</sup>* − = *l Hind q <sup>t</sup>* , (*pl*) *Hind <sup>t</sup>* − = *l Hind q <sup>t</sup>* , *<sup>R</sup>Hind <sup>t</sup>* <sup>−</sup> <sup>=</sup> *<sup>R</sup>Hind q <sup>t</sup>* ) and non-housing loans (*l NHind <sup>t</sup>* − = *l NHind q <sup>t</sup>* , (*pl*) *NHind <sup>t</sup>* − = *l NHind q <sup>t</sup>* , *RNHind <sup>t</sup>* <sup>−</sup> <sup>=</sup> *<sup>R</sup>NHind q <sup>t</sup>* ), and firm investment loans (*lIind <sup>t</sup>* − = *l Iind q <sup>t</sup>* , (*pl*) *Iind <sup>t</sup>* − = *l Iind q <sup>t</sup>* , *<sup>R</sup>Iind <sup>t</sup>* <sup>−</sup> <sup>=</sup> *<sup>R</sup>Iind q <sup>t</sup>* ). The same is computed for establishments paying back short-term loans (*l SHest <sup>t</sup>* − = *l SHest q <sup>t</sup>* , (*pl*) *SHest <sup>t</sup>* − = *l SHest q <sup>t</sup>* , *<sup>R</sup>SHest <sup>t</sup>* − = *R SHest q <sup>t</sup>* ).

*Module 11: Cycle Ends Bank's Balance Sheet Positions With Non-Financial Sector Updating (M.55)*

This submodule computes how much supply was used to give new credits in this iteration. For this purpose, the value of supply from the *Initialisation module* (M.1) and the value of supply after all updates (module M.55) is used. The amount of loans of each type which have been granted is computed.

$$I\_{temp}^{C, \text{generated}.b} = S\_{temp}^{l.C^{ind}} - S\_t^{l.C^{ind}} \qquad \text{(181)}$$

$$I\_{temp}^{H.\text{granted.b}} = S\_{temp}^{l.H^{\text{int}}} - S\_t^{l.H^{\text{int}}} \qquad \text{(182)}$$

$$S\_{temp}^{NHI, \text{gravitational}, b} = S\_{temp}^{I, NHI^{ind}} - S\_t^{NHI^{ind}} \tag{183}$$

$$d\_{temp}^{I, \text{generated}.b} = S\_{temp}^{I, I^{ind}} - S\_t^{I, I^{est}} \qquad (184)$$

$$I\_{temp}^{SH,graph,b} = S\_{temp}^{l,SH^{ind}} - S\_t^{l,SH^{est}} \tag{185}$$

*l sum*.*granted*.*b temp* = *l C*.*granted*.*b temp* + *l H*.*granted*.*b temp* + *l NH*.*granted*.*b temp* + *l I*.*granted*.*b temp* + *l SH*.*granted*.*b temp* (186)

*l*

$$(pl)\_{tmpp}^{\mathbb{C}, \text{generated}} + = (pl)\_{t \atop \dots \dots}^{\text{C}^{ind}} \quad (187)$$

$$(pl)\_{temp}^{H.\text{greated}} + = (pl)\_{t}^{H^{ind}} \quad \text{(188)}$$

$$(pl)\_{tump}^{NH\_3rmated} + = (pl)\_t^{NH^{md}} \quad \text{(189)}$$

$$(pl)^{I.\text{granted}}\_{temp} + = (pl)^{I^{ml}}\_{t} \quad \text{(190)}$$

$$(\text{ul})^{I.\text{granted}}\_{t} = (\text{ul})^{SH^{st}}\_{t} \quad \text{(191)}$$

$$(pl)^{\text{l.g.rm.md}}\_{\text{term}} + = (pl)^{\text{SH}}\_{\text{t.d.d.}} \quad \text{(191)}$$

$$(\text{pl})\_{\text{temp}}^{\text{sum}, \text{grntted}} = (\text{pl})\_{\text{temp}}^{\text{C.grmtted}} + (\text{pl})\_{\text{temp}}^{\text{H.grmtted}} + (\text{pl})\_{\text{temp}}^{\text{NH.grntated}} + (\text{pl})\_{\text{temp}}^{\text{I}, \text{grntated}} + (\text{pl})\_{\text{temp}}^{\text{SH.grntated}} \quad \text{(192)}$$

$$(NPL)\_{tmpp}^{\text{sum}} = \left(NPL\_{l^\complement}\right)\_t^b + \left(NPL\_{l^\complement}\right)\_t^b + \left(NPL\_{l^\complement}\right)\_t^b + \left(NPL\_{l^\complement}\right)\_t^b + \left(NPL\_{l^\complement}\right)\_t^b \tag{193}$$

$$(NPL)^{ratio}\_{temp} = \frac{(NPL)^{sum}\_{temp}}{(pl)^{sum, \text{\textquotedblleft}Tentcl\textquotedblright}} \qquad (194)$$

$$(NPL)^{ratio, l^C}\_{temp} = \frac{(NPL\_{l^C})^b\_t}{(pl)^{sum, \text{ $\gamma$ }T}\_{temp}} \qquad (195)$$

$$(NPL)^{ratio^{NH}\_{temp}}\_{temp} = \frac{\left(\left(NPL\_{l^H}\right)^b\_t\right)}{\left(pl\right)^{sum, \text{g} \text{rand} \, \text{cd}}} \qquad (196)$$

$$(NPL)^{ratio\,l^{NH}}\_{temp} = \frac{(NPL\_{lNH})^b\_t}{(pl)^{sum\,\text{g}}\_{temp}} \qquad (197)$$

$$(NPL)^{ratio\,I}\_{temp} = \frac{(NPL\_{l^l})^b\_t}{(pl)^{sum\,\text{g}
\text{rand}}} \qquad (198)$$

$$(NPL)^{ratio\,l^{SH}}\_{temp} = \frac{\left(NPL\_{lSH}\right)^b\_t}{(pl)^{sum\,\text{g}}\_{temp}}\qquad(199)$$

$$d\_{temp}^{ind} + = d\_t^{ind} \qquad \text{(200)}$$

$$d\_{temp}^{firm} + = (LA)\_t^{est} \tag{201}$$

$$d\_t^b = d\_{temp}^{ind} + d\_{temp}^{firm}.\tag{202}$$

Equity is updated in the next module, after computing the profits and costs of banks' activity.

#### *Module 11: Cycle Ends Updating Banks' Profits & Costs & Equity (M.56)*

This submodule updates the equity by adding the profits generated in this period and subtracting costs associated with the banks' activity.

$$(Rev^b)^{\text{sum}}\_{temp} = (Rev\_{l^C})^b\_t + (Rev\_{l^H})^b\_t + (Rev\_{l^{NH}})^b\_t + (Rev\_{l^I})^b\_t + (Rev\_{l^{SH}})^b\_t \tag{203}$$

$$(\text{Cost})\_{temp}^b \,\, draw \,\, from \,\, N((Av\mathbb{C})\_{t'}^b (Sd\mathbb{C})\_t^b) \tag{204}$$

$$E\_t^b + = (\mathcal{Re}\boldsymbol{\upsilon}^b)\_{temp}^{sum} - (\mathcal{Cost})\_{temp}^b - i\_d \times d\_t^b \tag{205}$$

Also considered is the possibility of the banks' default. If the following value of temporal variable is below zero, the bank defaults. In practice, the bank can default when it has not enough equity or in the case of withdrawal of deposits or accumulation of non-performing loans.

$$(Default)^{b}\_{temp} = E^{b}\_{l} + d^{b}\_{l} + (Rev^{b})^{sum}\_{temp} - i\_{d} \times d^{b}\_{l} - (NPL)^{sum}\_{temp}.\tag{206}$$

#### *Module 11: Cycle Ends Supply Side Decisions for T+1 and Regulatory Requirements (M.57)*

This submodule analyses the regulatory requirements and the supply side decisions. Definitions of macroprudential ratios have been adapted from Popoyan et al. (2017). Firstly, the value of most liquid assets held by the bank (cash) as a percentage of all loans granted to the entities in the model is approximated.

$$(Appr.\text{Cash})^b\_{temp} = \varphi\_1 \times l^{sum,\text{g}}\_{temp}\tag{207}$$

We also compute the quantity of loans less the most liquid assets held.

$$\Theta\_{temp}^{b} = l\_{temp}^{sum, \text{g} \text{rentad.b}} - \left(Appr.\text{Cash}\right)\_{temp}^{b} \tag{208}$$

Next, the quantity of liquid assets demanded from the central bank is approximated.

$$\left(\text{LiqDem\!C}\right)\_{\text{temp}} = \left.\varphi\_{\text{LCR.min}} \times d\_t^b - B\_t^b - \left(\text{Res}\right)\_t^b - \left.\varphi\_3 \times \left(A\,\text{prr.Classh}\right)\_{\text{temp}}^b\right|\tag{209}$$

The liquid assets from the central bank are only demanded when LCR is lower than *ϕLCR*.*min*. The computation of risk weighted assets and the approximation of TIER 1 equity allows the value of capital adequacy ratio according to Basel III to be obtained.

$$(RWA)\_{temp} = (pl)\_{temp}^{sum,prodcd} \times \delta\_{RW} \tag{210}$$

$$(E\_{T1}^b)\_{temp} = E\_t^b \times \delta\_{T1} \tag{211}$$

$$(CAR^b)\_{temp} = \frac{(E\_{T1}^b)\_{temp}}{(RWA)\_{temp}} \tag{212}$$

The model also computes the value of bank leverage ratio, as a ratio of equity TIER 1 and total assets, as well as high quality liquid assets, expected cash inflow and outflow to be able to compute the liquidity coverage ratio.

$$(LR^b)\_{temp} = \frac{(E\_{T1}^b)\_{temp}}{(l\_{temp}^{sum,crystal.b} + B\_t^b + (Res)\_t^b + q\_3 \times (Appr.cash)\_{temp}^b} \tag{213}$$

$$(HQLA^b)\_{tmpp} = \left(\text{Res}\right)^b\_t + \left(Appr.\text{Cash}\right)^b\_{tmpp} + \min\{0.85; 0.75 \times \left(\left(R\text{cs}\right)^b\_t + \left(Appr.\text{Cash}\right)^b\_{tmpp}\right)\}\tag{214}$$

$$(E(\text{CashOutflow})^\circ)\_{temp} = \varrho\_4 + \varrho\_5 \times d\_t^b + \varrho\_6 \times (LiqDem\!CB)\_{temp} \tag{215}$$

$$(\text{E}\left(\text{CashInflow}\right)^{\text{b}})\_{\text{temp}} = \mathfrak{q}\_7 - \mathfrak{q}\_8 + \mathfrak{q}\_9 \times (\text{Aprr.Cash})^{\text{b}}\_{\text{temp}} + \mathfrak{q}\_{10} \times B^b\_t + \mathfrak{q}\_{11} \times (\text{Rcs})^{\text{b}}\_t \tag{216}$$

$$(\text{(NCOF}^b)\_{temp} = (\text{E(CashOutflow)}^b)\_{temp} - (\text{E(CashInflow)}^b)\_{temp} \tag{217}$$

$$\left(LCR^b\right)\_{temp} = \frac{\left(HQLA^b\right)\_{temp}}{\left(NCOF^b\right)\_{temp}} \quad \text{(218)}$$

Then, the decisions about the supply of credit are made:

$$(S^b)\_{temp} = \frac{E^{b\_l}}{\varphi\_{min.req}} - (pl)\_{temp}^{sum,grant} \tag{219}$$

If the capital requirements are not met, the supply is set to zero ((*Sb*)*temp* = 0) and the value of variable ((*PD*) *b <sup>t</sup>* = 0.5) is updated to emphasise that this bank is at threat of default and the riskiness of the bank's activity increases. Next, it is checked if the liquidity requirement is met. If so, the bank does not have to recur to the central bank. Otherwise *LCR<sup>b</sup> temp* < *<sup>ϕ</sup>min*.*LCR* × *<sup>d</sup><sup>b</sup> t* , bank deposits are increased by the resources obtained from the central bank.

$$d\_t^\circ + \ = \left( \mathit{LiqDemCB} \right)\_{temp} \tag{220}$$

Finally, the leverage ratio requirement is checked. If the leverage ratio is lower than the value specified by the parameter ((*LRb*)*temp* <sup>≤</sup> *<sup>ϕ</sup>*13), the supply is set to zero ((*Sb*)*temp* <sup>=</sup> 0) and the value of the variable expressing the probability of default ((*PD*) *b <sup>t</sup>* = 0.5) is updated to emphasise that this bank is at threat of default and the riskiness of the bank's activity increases.

Next, each bank needs to compute the supply of each type of loan to the market, taking into account the profitability of each and the non-performing loans ratios. There are two procedures that can be initiated in the system. The first one is initiated if the values of parameters *μ*1, *μ*2, *μ*3, *μ*4, *μ*5, are not equal to zero. It is implicitly assumed that the banks are committed to providing a supply of credit of each type and all banks are universal. In the consequence of application of the first strategy, groups of banks that pursue similar strategies on the market are obtained.

At the beginning, the following auxiliary variables are computed:

$$(SumForRatio)\_{temp}^{l.C^{ind}} = S\_{temp}^{l.C^{ind}} + (Rev\_{l^C})\_t^b - (NPL\_{l^C})\_t^b \tag{221}$$

$$(SumForRatio)^{l.H^{ind}}\_{temp} = S^{l.H^{ind}}\_{temp} + (Rev\_{l^H})^b\_t - (NPL\_{l^H})^b\_t \tag{222}$$

$$(SumForRatio)^{l.NH^{ind}}\_{temp} = S^{l.NH^{ind}}\_{temp} + (Recv\_{l^{NH}})^b\_t - (NPL\_{l^{NH}})^b\_t \tag{223}$$

$$(SumForRatio)^{l.l}\_{temp} = S^{l.l^{ind}}\_{temp} + (Rev\_{l^l})^b\_t - (NPL\_{l^l})^b\_t \tag{224}$$

$$(SumForRatio)\_{temp}^{l.SH^{pt}} = S\_{temp}^{l.SH^{pt}} + (Rev\_{l^SH})\_t^b - (NPL\_{l^SH})\_t^b \tag{225}$$

These auxiliary variables help us to understand how much has been earned and lost from the granted loans of each type. Then, the following ratios are computed:

$$(Sum1ForRatio)\_{tmpp}^{l.C^{ind}} = \frac{(SumForRatio)\_{tmpp}^{l.C^{ind}}}{S\_t^{l.C^{ind}}} \tag{226}$$

$$(Sum1ForRatio)\_{temp}^{l.H^{ind}} = \frac{(SumForRatio)\_{temp}^{l.H^{ind}}}{S\_t^{l.H^{ind}}} \tag{227}$$

$$(Sum1ForRatio)\_{temp}^{l,NH^{ind}} = \frac{(SumForRatio)\_{temp}^{l,NH^{ind}}}{S\_t^{NH^{ind}}} \tag{228}$$

$$(Sum1ForRatio)\_{temp}^{l.l^{ind}} = \frac{(SumForRatio)\_{temp}^{l.l^{unt}}}{S\_t^{l.l^{ent}}} \tag{229}$$

$$(Sum1ForRatio)\_{temp}^{l.SH^{pt}} = \frac{(SumForRatio)\_{temp}^{l.SH^{pt}}}{S\_t^{l.SH^{pt}}} \tag{230}$$

The ratios are ordered from highest to the lowest. According to the ratios, it is possible to indicate the most profitable and less profitable types of loans. In the first procedure, it is assumed that the regulator introduced the maximum sectorial exposures, that is, *μ*1, *μ*2, *μ*3, *μ*4, *μ*5, are fixed by the regulator. In practice, banks invest the maximum allowed by the regulator in the most profitable type of loans according to them. In the second procedure, it is assumed that the regulator introduced only one recommendation; that the exposure to any loan cannot be higher than 35%, that is *μ<sup>i</sup>* ≤ 0.35 for *i* ∈ {1, 2, 3, 4, 5}. The auxiliary assumption needed states that all weights have to sum up to 1: *μ*1+ *μ*2+ *μ*3+ *μ*4+ *μ*<sup>5</sup> = 1.

In this method, *μ*<sup>1</sup> corresponds always to the first ratio, *μ*<sup>2</sup> corresponds always to the second ratio, *μ*<sup>3</sup> corresponds always to the third ratio, *μ*<sup>4</sup> corresponds always to the fourth ratio and, *μ*<sup>5</sup> corresponds always to the fifth ratio. The highest ratio is checked, and then the value of *μi*, is drawn from the corresponding interval of the highest allowed values, *μ<sup>i</sup>* ∈ (0:30; 0:35]. Then, the second best, *μ<sup>j</sup>* is drawn from the interval *μ<sup>j</sup>* ∈ (*μ<sup>i</sup>* − 0.06; *μi*). Analogically, the third and the fourth best, ie. *μ<sup>k</sup>* is drawn from the interval *<sup>μ</sup><sup>k</sup>* <sup>∈</sup> *μ<sup>j</sup>* − 0.06; *μ<sup>j</sup>* , *μ<sup>l</sup>* ∈ (*μ<sup>k</sup>* − 0.06; *μk*). The fifth one is computed from the restriction that states that all weights have to sum up to one. In this procedure, each bank has a different ordering of ratios and in addition weights are obtained in a stochastic procedure.

#### *Module 11: Cycle Ends Interest Rates (M.58)*

This sub-module computes the value of interest rates for next iteration. If the values of perception indicators are equal to zero then the same empirical interest rates from the database in the cycle can be used. Otherwise, the indicators of perception to change the values of interest rates in the first iteration are used and then random values of perception indicators from the distribution are used. The perception of risk is different on the ON (*ς ind*<sup>1</sup> ) and longer-maturity markets (SW, 1M, 3M) (respectively *ς ind*<sup>2</sup> , *ς ind*<sup>3</sup> ,*ς ind*<sup>4</sup> ). The parameter *ζ ind <sup>t</sup>* expresses the value of perception of uncertainty indicator.

$$
\boldsymbol{\varepsilon}\_{t}^{\text{ind}^{4}} = 0 \text{ \textbf{\&\&}} \,\boldsymbol{\varepsilon}\_{t}^{\text{ind}^{2}} = 0 \text{ \textbf{\&\&}} \,\boldsymbol{\varepsilon}\_{t}^{\text{ind}^{3}} = 0 \text{ \textbf{\&\&}} \,\boldsymbol{\varepsilon}\_{t}^{\text{ind}^{4}} = 0 \text{ \textbf{\&\&}} \,\boldsymbol{\varepsilon}\_{t}^{\text{ind}^{4}} = 0 \text{ \textbf{\&\&}} \,\boldsymbol{\varepsilon}\_{t}^{\text{ind}} = 0. \tag{231}
$$

#### **5. Inequality Measures and Distributional Effects**

#### *5.1. Income Distribution, Inequality and Concentration Measures*

At *t* = 0, the simulation uses empirical data. In Figure 2 the household income according to the percentile has been presented as well as the approximation of wealth has been shown.

**Figure 2.** Household income by percentile (on the left) & Household wealth by percentile (on the right).

Based on empirical data, it is possible to calculate the approximation of the degree of income and wealth inequality in the sample at *t* = 0, which has been compared with results of simulations of wealth and income distributions in counterfactual scenarios (at *t* > 0).

#### *5.2. Gini Coefficient and Measures of Asymmetry*

Typically, the degree of inequality is calculated based on the Gini coefficient [105,106], and the Lorenz curve [107]. This section presents the results of the calculation of the basic Gini coefficient and the further studies on income and wealth inequality. Based on the sample, both the Lorenz curve and the income Gini coefficient were determined from the data on a quarterly and annual basis. The Gini coefficient for income distribution calculated on the basis of the quarterly sample data is equal to 0.3943179 (39.43%). In the case of calculations on annual figures, the coefficient value is slightly different, 0.3945987 (39.46%). If we include the corrections for unbiasedness, the value is 0.3947129 (39.37%).

These values differ slightly from the Gini coefficient for income distributions reported in the 2008 Report on Household Wealth and Debt, 39.4% versus 38.4%. This is due to the adoption of a different procedure of over-sampling of most affluent households. In addition, Grejcz and Zołkiewski [ ˙ 108] present the coefficient as 39.2%. At the same time, the authors emphasise that the procedure of oversampling of the most affluent households makes the value of Gini coefficient higher in comparison to the ones published by OECD, 35.5% or World Bank in 2014, 32.08%. In literature, other values of Gini coefficients for income distributions, computed using different samples, have been presented: 32.6% [109], 30.7% [110], 28.5% [111]. Accordingly, the Gini coefficient for wealth is equal to 0.6004731 (60.04%). The obtained results are relatively similar to the ones presented in the NBP [112] report 57.9%, and Grejcz and Zołkiewski [ ˙ 108] 58.7%.

According to Eurostat, Gini coefficient for income distribution in Poland in 2014 and 2015, were respectively 30.8% and 30.6%. The average Gini coefficient in the European Union for 28 countries was 30.9% in 2014 and 31% in 2015. A similar Gini coefficient for income distribution, suggesting a similar level of inequality, was reported in countries such as Croatia, 30.2% in 2014 and 2015, Ireland, 31.1% in 2014 and 29.8% in 2015, Germany, 30.7% in 2014 and 30.1% in 2015, and Great Britain, 31.6% in 2014 and 32.4% in 2015. The reported value of Gini coefficient of wealth for euro area by Grejcz and Zołkiewski [ ˙ 108] was 68.6%. In the case of the Gini coefficient for wealth distribution, similar results to the one for Poland were obtained in countries such as Malta, Belgium and Italy [113,114]. Interestingly, Gini coefficients for income and wealth of countries geographically and socially closer to Poland differ significantly from values reported for Poland.

However, as Chen [105] notes, "not all inequality curves yielding the same Gini coefficient are unequal in the same way". This observation is important not only for comparisons between countries but also for monitoring changes in inequalities in a given country when applying or analysing policies in a particular counterfactual scenario. Using agent-based simulation, we can analyse how the Gini coefficients change between iterations as a consequence of the introduction of specific policies. Furthermore, we can also describe changes in inequalities using more accurate measures of asymmetry and measures of spatial inequality.

Among the most useful measures in identifying patterns of inequality are the Lorenz asymmetry coefficient [115–117], and radial triangular measures derived from the Lorenz asymmetry coefficient expressed in polar coordinates. The Lorenz asymmetry coefficient (LAC; abbrev. *S*) is defined as:

$$S = F(\mu) + L(\mu) \tag{232}$$

where the functions *F* and *L* are defined as for the Lorenz curve, and *μ* is the mean. Based on an ordered set of data (*x*1, *x*2, ...*xm*, *xm*+1, ..., *xn*), we can compute statistics *S* in the following way

$$\delta = \frac{\mu - \mathbf{x}\_m}{\mathbf{x}\_{m+1} - \mathbf{x}\_m} \tag{233}$$

$$F(\mu) = \frac{m + \delta}{n} \tag{234}$$

$$L(\mu) = \frac{L\_m + \delta \ge\_{m+1}}{L\_m}.\tag{235}$$

Damgaard and Weiner [115] show that Lorenz's asymmetry coefficient allows us to notice that although two Lorenz curves allow in practice the same Gini coefficient to be obtained, their shapes are different, which translates into other patterns of inequality. If the LAC is less than one, the inequality is related to the presence of relatively much poorer units. If the LAC is greater than one then the inequality is related to the existence of extremely rich individual entities. For the purposes of further discussion, the point at which the first derivative of the Lorenz curve is equal to 1 in the interval (0, 1), it can be denoted, similarly to Chen [105], [*μ*, *f*(*μ*)].

When calculating Lorenz's asymmetry coefficient for income distribution based on quarterly data, a result of 0.9790896 is obtained. For annual data, this is 0.9788734. Similarly, for wealth distribution it is 0.942073944. Intuitively, if the value of the Lorenz coefficient is less than 1, the point [*μ*, *f*(*μ*)] is below and to the left of the symmetry axis. In fact, this case describes the situation in Poland, although the value does not differ significantly from the value of 1 corresponding to the point on the axis of symmetry. For the income distribution, the point [*μ*, *f*(*μ*)] = (0.63; 0.35). This deals with the first of the two discussed situations. The income inequality in Poland is related to the relatively large number of poor agents. For wealth distribution, the point is equal (0.68; 0.26) which is for the first case. Indeed, the wealth inequality is Poland is related to the relatively much poorer units.

The lack of access to disaggregated income and wealth data for countries such as Croatia, Ireland, Germany or Great Britain makes it impossible to compare patterns of inequality in these countries. However, it is still possible to compute Gini coefficients for Poland in different counterfactual scenarios. In the case of subtle changes in inequality in one country, it may be helpful not only to calculate the LAC but also to describe Lorenz's asymmetry with polar coordinates and to calculate the additional measure of adjusted azimuthal asymmetry (AAA) (*cf.* Chen [105]).

In this new approach the location of a point [*μ*, *f*(*μ*)] relative to the point ( <sup>1</sup> 2 , 1 <sup>2</sup> ), a point dividing the line of equality in half can be described. In fact, [*μ*, *f*(*μ*)] can be designated according to its radial distance from ( <sup>1</sup> 2 , 1 <sup>2</sup> ) and according to the azimuthal angle formed by that radius, relative to the line of symmetry. According to convention, they can be denoted accordingly *ρ* and *θ*. For the graphical explanation of *ρ* and *θ* based on Chen [105], see: Figure 3. Both enhance the interpretation of Lorenz asymmetry coefficient. The maximum radial distance of [*μ*, *f*(*μ*)] from ( <sup>1</sup> 2 , 1 <sup>2</sup> ) is <sup>√</sup><sup>1</sup> <sup>2</sup> and the azimuthal angle formed by the axis of symmetry and the line segment connecting ( <sup>1</sup> 2 , 1 <sup>2</sup> ) to [*μ*, *f*(*μ*)] falls within the range of +/−*<sup>π</sup>* 2 .

**Figure 3.** Lorenz curve (on the left) and the radial interpretation of *ρ* and *θ* (in the middle and on the right).

The radial distance *ρ* measures the concavity of the Lorenz curve and it is expressed by the formula:

$$
\rho = \sqrt{(\mu - \frac{1}{2})^2 + (f(\mu) - \frac{1}{2})^2}.\tag{236}
$$

Azimuthal angle *θ* measures the distance of [*μ*, *f*(*μ*)] from the axis of symmetry in precise angular terms. It is expressed by the formula:

$$\theta = \arcsin(\frac{S-1}{\rho\sqrt{2}}).\tag{237}$$

It adds precision and intuitive geometric appreciation to the Lorenz asymmetry coefficient. "Whereas the primary use of *S* has been binary negative values lie to the left of the axis of symmetry, while positive uses lie to the right *θ* locates [*μ*, *f*(*μ*)] with precision within the unit triangle" [105] Note that *S*, *ρ* and *θ* are constrained by the Gini coefficient. In practice, for a given value *G*, we have specified boundaries on the values *S*, *ρ* and *θ* . For any Gini coefficient *G*, the minimum value of *S* is *G* itself. The maximum value is 2 − *G*.

For *t* = 0 during the simulation, the following results are obtained for income distribution:

$$
\rho = 0.19908, \theta = -0.07434, t = \frac{\theta}{\pi/2} = -0.04733. \tag{238}
$$

The distance from ( <sup>1</sup> 2 , 1 <sup>2</sup> ) to the orthogonal intercept along the line of symmetry is 0.19886. The maximum *θ* given the value of Gini coefficient for quarterly data is equal to 0.99369. The adjusted azimuthal asymmetry coefficient for *t* = 0 is equal to:

$$AAA = \frac{\theta}{\theta\_{\text{max}}} = -0.07481. \tag{239}$$

Accordingly, for the wealth distribution, the following is obtained:

$$
\rho = 0.30767, \theta = -0.13353, t = \frac{\theta}{\pi/2} = -0.08500. \tag{240}
$$

The distance from ( <sup>1</sup> 2 , 1 <sup>2</sup> ) to the orthogonal intercept along the line of symmetry is 0.3049. The maximum *θ* given the value of Gini coefficient for quarterly data is equal to 0.5880. The adjusted azimuthal asymmetry coefficient for *t* = 0 is equal to:

$$AAA = \frac{\theta}{\theta\_{\text{max}}} = -0.22783. \tag{241}$$

As Chen [105] states, "adjusted azimuthal asymmetry promises a two-fold advantage over the unadorned Lorenz asymmetry coefficient. First, the asymmetry is more intuitively and more accurately expressed in angular terms than as the sum of two Cartesian coordinates. Second, because adjusted azimuthal asymmetry accounts for the maximum angular distance from the axis of symmetry for a particular value of *G*, it expresses a sense of proportionality that raw *θ*, to say nothing of *S*, cannot".

#### *5.3. Spatial Dimensions of Inequality and Inequality Aversion*

Although the spatial analysis is based on basic Theil index (TI), the generalised entropy index (that the Theil index is a special case of) can be started at. The generalised entropy index is defined as:

$$GE(a) = \begin{cases} \frac{1}{\text{Na}(a-1)} \sum\_{i=1}^{N} \left[ (\frac{y\_i}{\overline{y}})^a - 1 \right] & a \neq 0, 1 \\\frac{1}{N} \sum\_{i=1}^{N} \frac{y\_i}{\overline{y}} \ln \frac{y\_i}{\overline{y}} & a = 1 \\\ -\frac{1}{N} \sum\_{i=1}^{N} \ln \frac{y\_i}{\overline{y}} & a = 0 \end{cases} \tag{242}$$

where *N* is the number of individuals or households, *yi* is the income of entity *i*, *α* is the weight given to distances between incomes at different parts of the income distribution. The generalised entropy index has been proposed as a better measure of income inequality with regard to Gini coefficient due to the fact that it is an additively decomposable inequality measure [118].

If it is assumed that *α* = 1, that is *GE*(1), the TI is obtained. One of the advantages of the TI is that it is a weighted average of inequality within subgroups, plus inequality between those subgroups. For example, inequality within Poland is the average inequality within each region, weighted by region's income, plus inequality between regions. We can express the decomposition formally. If for the TI the population is divided into *k* subgroups and *si* is the income share of group *i*, *TTi* is the Theil index for that subgroup, and *xi* is the average income in group *i*, then then the TI is expressed by the formula:

$$T\_T = \sum\_{i=1}^k s\_i T\_{T\_i} + \sum\_{i=1}^k s\_i \ln \frac{\overline{\mathbf{x}}\_i}{\overline{\mathbf{x}}}. \tag{243}$$

The TI allows us to analyse the relative importance of spatial dimension of inequality, that is, the regional inequality [119].

For time *t* = 0 during the simulation, based on empirical data of income and wealth, the entropy measure (EM) and TI for Poland is computed. We obtain respectively *EM* = 0.2721004 and *T I* = 0.2836961 for income, and *EM* = 0.7599967 and *T I* = 0.6753153 for wealth. The decomposition of TI allows us to analyse the spatial inequality in Poland. The results of measures of spatial inequality are not reported for confidentiality reasons. The authors cannot present which spatial codes 1-4 represent which region and districts in Central Statistical Office but it is feasible to present the data and visualise changes in spatial inequality in each counterfactual simulation using maps.

*Entropy* **2020**, *22*, 129

The generalised entropy index can also be transformed into a subclass of the Atkinson index (AI) with = 1 − *α* for 0 ≤ *α* < 1, defined as:

$$A\_{\varepsilon}(y\_1, \dots, y\_N) = \begin{cases} 1 - \frac{1}{\mu} (\frac{1}{N} \sum\_{i=1}^{N} y\_i^{1-\varepsilon})^{\frac{1}{1-\varepsilon}} & \text{for } 0 \le \varepsilon \ne 1 \\\ 1 - \frac{1}{\mu} (\prod\_{i=1}^{N} y\_i)^{\frac{1}{N}} & \text{for } \varepsilon = 1 \end{cases} \tag{244}$$

where *ε* is an inequality aversion parameter. When *ε* approaches 0, it becomes more sensitive to changes in the upper end of the income distribution. Then, there is no aversion to inequality; no social utility is gained by complete redistribution. The higher *ε*, the more AI becomes sensitive to changes at the lower end of the income distribution. At the same time, more social utility can be gained from the redistribution as aversion to inequality is higher. Relatively low values of AI indicate a more equal distribution than higher values, given a particular degree of risk aversion. The computation of AI for the empirical distribution of income for Poland allows us to obtain the result of 0.1314228. The AI for the empirical distribution of wealth is equal to 0.3438987. A number of other measures of concentration and inequality have also been calculated to investigate the sources of income inequality in Poland. The Herfindahl concentration index (HHI) is equal 0.0005451883, while the Rosenbluth concentration index (RI) is 0.0004778672. The values of additional measures of wealth inequality are equal to 0.001255462 in the case of HHI and 0.4313275 in the case of RI.

#### *5.4. Indebtedness of Households & Macroprudential Ratios*

The distributions of debt service to income (DSTI), debt to income (DTI), loan to value for housing loans (LTV*H*) and debt to income (DTA) at *t* = 0 are analysed, and then the changes in the empirical distribution of these ratios at *t* > 0 are presented in Appendix D. The percentage of households that have DSTI ≥ 30% (6%) and 40% (3.5%), as well as DTI ≥ 3 (3.6%) and 4.5 (1.7%) is computed. In the sample, 101 504 individuals have a total of 137 216 consumer loans. None of the individuals have more than 5 consumer loans. On average, individual customers have been charged statistically with 1.4 of consumer loans. In the sample, 43 008 housing loans were still to be repaid.

#### **6. Results of Simulations**

Using this agent-based simulation, it is possible to analyse the behaviour of a heterogeneous economy within certain counterfactual scenarios and the effects of public policies, especially stabilising and distributional effects of macroprudential policies. Firstly, the scenario is analysed in which the main mechanisms described by H. Minsky in 'Stabilizing unstable economy' (1986) [44] and in 'Financial Instability Hypothesis' (1992) [45] are simulated. Under the second scenario, the behaviour of the system is investigated, assuming the use of macroprudential policies to mitigate financial risk and stabilise an unstable economy. Then, the macroprudential policy stance which would best allow for the stabilization of heterogeneous economy is analysed, as is the distributional effects of these policies.

#### *6.1. Minsky Moment*

According to Reference [44], 'capitalist economies exhibit inflations and debt deflations which seem to have the potential to spin out of control'. The economies are unstable by nature (this instability, in the most general terms, was mostly related to industrial structure and finance). In this statement Minsky refereed to the Kindleberger's definition of self-sustaining disequilibrium from the 1970s. The capitalist economy is conditionally coherent. Instead of accepting the state of equilibrium, the focus should rather be on periods of tranquillity, apparent stability, which, in essence, are destabilising.

The neoclassical synthesis tries to explain how a decentralized economy achieves *coherence* and *coordination* in production and distribution (in other words, how market mechanisms lead to a sustained, stable-price, full-employment equilibrium). In opposition, the Minsky theory focuses on capital development of an economy and *the impact of financial institutions' activity on production* and *distribution*. The optimum that is derived from the neoclassical decentralized market processes 'rules out interpersonal comparisons of well-being and ignores the inequity of the initial distribution of resources and thus of income'. As Minsky stated, 'inasmuch as our aim is to indicate how we can do better than we have, and as the best is often the enemy of the good, we can forget about the optimum [in neoclassical terms]. Even though a tendency toward coherence exists because of the processes that determine production and consumption in market economics, the processes of a market economy can set off interactions that disrupt coherence' [44].

Minsky's theory can be interpreted in two ways. In Keynesian terms, it should be understood in terms of accumulation of capital in the economy. In Knightian terms, it should rather be interpreted as a problem of allocating resources under risk and uncertainty. The paper refers to the first interpretation. In *Extensions*, the second interpretation is referred to. Hence, the role of risk perception and uncertainty in generation and amplification of risk within the system is analysed [42].

We begin with interpretations of the instability hypothesis in Keynesian terms. Minsky's theory refers to the general theory of Keynes from the 1930s. Nonetheless, in 'Stabilizing an unstable economy', the process of capital accumulation described by Keynes is accompanied by an exchange of current money for the future. At the heart of this theory are not only capital stock and investment but primarily cash flows. Any attempt to model the instability hypothesis must therefore be stock-flow consistent. In reference to the Minsky theory, in the simulation, three types of stylized cash flows are developed: income, balance sheet and portfolio. The income cash flow refers to all payments in the production and sale of inputs and final goods, thus also the one in the supplier searching and purchase modules. The balance sheet cash flow refers to repayment of debts. The third type of cash flow occurs due to transactions in which capital and financial assets are acquired by a new agent. Money in cash form is not analysed explicitly in the model, but the general idea of money and settlements has been taken into account in the model. As Minsky noted, 'money is created in the process of financing investment and positions in capital assets. An increase in the quantity of money first finances either an increase in the demand for investment output or an increase in the demand for items in the stock of capital or financial assets. As money is created, borrowers from banks enter upon commitments to repay money to the lending banks. In its origins in the banking process, money is part of a network of cash-flow commitments, a network that for the business side of the economy ultimately rests upon the gross profits, appropriately defined, that firms earn' [44].

The current money is used to purchase inputs that are used in the production of investment and consumption goods. The purchase of inputs can be funded by the firm from the liquid assets and capital. Otherwise, external funding can be obtained. Financial institutions on the market generate profits from lending funds. 'The financing terms affect the prices of capital assets, the effective demand for investment, and the supply price of investment outputs' [44]. Firms, establishments and individuals are obliged to repay debt, that is, principal and interest rates, within designated deadlines. In Minsky's basic theory, the focus was on investment. The government budget, the behaviour of consumption and the path of wages were secondary. To make the model more realistic and ensure it can be applied in modern policy making, all the above-mentioned elements were included. Similarly, the flow of money described by Minsky included only loans to firms, while in the simulation, loans to individuals and households were also added. The flow of money in Minsky's theory, similarly to the simulation, has the following two directions. Individuals make deposits to banks and banks lend money to firms and individuals. In a later period, firms and individuals return funds to banks and banks to depositories.

In this theory the cash flows are influenced by the *expected* future profits; the flow of money from companies to banks takes place after the realisation of real profits. These expectations need not be always consistent with the final realisation of profits.

Funds can be obtained through negotiation, in which risk perception and uncertainty as well as expectations play an important role. Firms willing to obtain money for carrying out their activity interpret financial results and the economic situation in an enthusiastic way, and in fact often create overly optimistic expectations. While bankers are inherently conservative, though profit-seeking, they are more restrictive in assessing potential gains from a deal. Despite being more restrictive, bankers are also aware that investment in innovation and new products, services and industries is the most profitable. Consequently, their propensity to finance projects from the most dynamic and profitable sectors is usually greater than the projects from other industries, even if the riskiness of the project is higher than average.

Minsky's theory incorporates elements of Kalecki-Levy theory, according to which the structure of aggregate demand determines profits. The profit expectations depend on the expected level of investment in the future and actual returns on investment. Investments continue on the assumption of both entrepreneurs and bankers that investment will also take place in the future. In order to increase investment, the agents borrow additional funds, frequently assuming unrealistic returns in the future.

According to Minsky, there are three types of agents that are characterised by their relation between income and debt. 'Hedge financing units are those which can fulfil all of their contractual payment obligations by their cash flows. (...) Speculative finance units need to roll over their liabilities, [that is,] issue new debt to meet commitments on maturing debt. (...) For Ponzi units, the cash flows from operations are not sufficient to fulfil either the repayment of principle or the interest due on outstanding debts by their cash flows from operations. Such units can sell assets or borrow. Borrowing to pay interest or selling assets to pay interest on common stock lowers the equity of a unit, even as it increases liabilities and the prior commitment of future incomes. A unit that Ponzi finances lowers the margin of safety that it offers the holders of its debts' [44]. The higher the leverage ratio of firms, the higher the probability of defaulting on debt. Therefore, the reduction of collateral required and credit rating requirements in this scenario leads to an increase in the percentage of speculative and Ponzi agents. Changes in creditworthiness requirements also affect the percentage of hedging, speculative and Ponzi-type agents in the economy. The higher the level of speculators and Ponzi-type agents, the greater the probability of a crisis.

Investment boom increases aggregate demand and spending through a multiplier effect and sales increase. Profits increase with increasing investment, encouraging further investment. In this way, the instability of the system is strengthened until the percentage of speculative investors increases significantly. In the case of prolonged prosperity, assuming that no prudential policies have been applied, the economy becomes unstable, due to the increasing number of speculative and Ponzi-type agents.

Minsky's instability hypothesis is a study about the extent to which debt affects the behaviour of the system and how the level of debt is considered to be adequate in terms of dynamics of the system. According to this theory, there is no need for external shock for the crisis to occur. The crisis is generated endogenously by agents taking too much risk and by the desire by entrepreneurs and bankers to obtain ever-increasing profits. At the same time, this situation also has consequences for individuals and households. In the event of an increase in insolvencies, banks may default and thus depositors would lose the funds (the case in which by increasing uncertainty individuals decide to withdraw deposits is analysed in *Extensions*, see: [8]). In addition, the situation on the labour market determines changes in the income and wealth of households.

According to Minsky's theory, increase in investment 'would never trickle down to the poor and would tend to increase inequality by favouring the workers with the highest skills working in industries with the greatest pricing power' [44]. In the simulation, this mechanism was modelled. Firms hire individuals according to their work skills and in industries with the greatest pricing power. Consequently, it leads to inequality. The changes in inequality can be measured using the Gini coefficient as well as other measures of asymmetry and spatial inequalities.

The dynamics of the real estate market is also changing. The increased percentage of job seekers is influencing their shift to cheaper properties and partly ineligible mortgage loan repayment, which again puts banks in a difficult position. Banks are in possession of properties for which there is no demand, and their prices are gradually lowered in order to find a buyer.

Two main components of the theory are the two-price system and the lender's and borrower's risk, both derived from theories of Kalecki and Keynes.

The first price system concerns current output prices, that is, costs and mark-ups, that need to be set at a level that will generate profits for the firm from the sale of consumer goods, investment goods, and goods and services purchased by the government in public contracts. If, in the analysis, the external fund increase is also taken into account, the supply price of capital plus the interest rate and lender's risk must also be considered.

The second pricing system refers to assets. Assets are expected to generate cash flow in the future. These flows are not known and their estimation depends on subjective expectations. How much is able to be paid for such a financial asset depends on the amount of external finance required. The more the borrower becomes indebted, the greater the risk of insolvency; in this sense the price of the asset includes the borrower's risk. Investments occur when demand price exceeds the supply price of assets. Prices include collateral. After the crisis, usually larger collateral are required, in the expansion period, they are lowered significantly.

As Minsky [44] states, 'the costs of financing the production of investment is a cost that enters the supply price of output like the costs of labour and purchased inputs. The fact that a firm has to borrow to pay wages raises the effective costs by the interest payments on the borrowings'. 'The decision to invest therefore involves a supply function of investment, which depends upon labour costs and short-term interest rates, a demand function for investment, which is derived from the price of capital assets, and the anticipated structure and conditions of financing. Whereas the structure of balance sheets reflects the mix of internal funds (gross retained earnings) and the external funds (bonds and equity issues) actually used, the investment decision is based upon expected flows of internal and external funds' [44].

#### *6.2. Simulating an Unstable Economy*

In the first scenario, the role and impact of financial institutions on production and distribution of income and wealth in the economy is simulated. As Minsky pointed out, according to neoclassical assumptions, the initial distribution of income and wealth did not matter. Neoclassical models ignore the impact of policies on income and wealth distributions *ex post*. The inclusion of *ex ante* heterogeneity was not relevant to the analysis of outcome *ex post*. In contrast, in the simulated scenario, we show that the processes of a market economy do 'set off interactions that disrupt coherence', and that incorporation of heterogeneity *ex ante* into the model makes it possible to observe changes in distributions *ex post*, including income and wealth distributions.

In accordance with Minsky's hypothesis, in the database and model design, the focus was put not solely on heterogeneity in capital stock and on different investment decisions but also on balance sheet changes and cash flows.

In the scenario, firms operate in eight different sectors through establishments. In the first iteration, the most profitable sector is the first sector, thus it attracts the highest percentage of new investors. Other sectors attract a smaller percentage of new businesses. During first iterations we observe fluctuations in the relative profitability of sectors, related to business fluctuations, that is, the effect of the business cycle. In the initial iterations, only stock fluctuations related to intrinsic dynamics of the economy are observed, while in further iterations, it is observed that increased stock fluctuations and a cease in production is experienced by a higher percentage of establishments. The number of firms in each of sectors decreased over a year due to both higher rate of bankruptcies and higher concentration on the market, *see:* Figure A6 (on the right) in Appendix D. At *t* = 0 there are 18727 establishments in the database. At *t* = 1, 14112 establishments from the database at *t* = 0 continue operating on the market. 4615 establishments ceased to produce, while 9887 new establishments were attracted by the market due to higher relative profitability of selected sectors. At *t* = 2, 15727 establishments from *t* = 1 operate on the market, while 2773 new establishments are created. In total, 18500 establishments are in operation. At *t* = 3, 15357 establishments from *t* = 2 operate on the market

but only 1546 new establishments are established due to deterioration of market conditions. In total, a lower number of establishments (16,903) with respect to *t* = 0 operate on the market. Some firms go bankrupt, while others cease their activity in selected establishments that are operating in less profitable sectors. At *t* = 4, 15,357 establishments stay on the market and 1491 new establishments are created. In total, 16848 establishments continue operation.

In next iterations, there are higher levels of debt and leverage and increased financial risk in the sectors that were the most profitable in the previous periods. The risk spreading between sectors was visualised in Figure A5 (on the left and on the right side) and Figure A6 (on the left). Over a year, the higher number of firms' bankruptcy with respect to the previous periods was observed, indicating the gradual *endogenous* generation of the crisis. Occasionally, though gradually more frequently, firms had problems finding a supplier, which is related to the cessation of business activity by selected establishments, and thus the interruption of network of transactions established between establishments and suppliers. The data could be analysed for further iterations than four (one year) but the goal was to show that a crisis can emerge endogenously in a relatively short period of time, such as 1–4 quarters, as it was the case during the financial crisis (Q2 2008–Q2 2009).

The problem of searching and matching the suppliers in the supply chain module gains importance. The time required to searching for supplier is increased due to the fact that new transaction relations are established with suppliers in further territorial units than previously.

When the uncertainty on the market increases and indicators of profitability and riskiness deteriorate, a lower percentage of firms is eligible for a loan. Establishments lose creditworthiness and are forced to restrict production, which in turn worsens economic conditions. At *t* = 1, 62.5% of establishments were checked for creditworthiness in the module *Consumer credit admissibility* 1, while 37.5% in *Consumer credit admissibility* 2. In the following iterations, these values were respectively: 48.61% and 51.39% at *t* = 2, 55% and 45% at *t* = 3, and 57.5% and 42.5% at *t* = 4. The firms and establishments' conditions are also closely related to the problems of specific industries and fluctuations in the economy.

Expectations of lower profits lead to a reduction in the flow of money from companies to banks and from banks to companies, worsening the state of the economy. Banks are on the one hand aware of the higher risk related to granting loans to companies that qualify for the liquidity problem procedure, on the other hand it allows them to earn a premium. Overall, however, they provide loans for shorter periods, which is related to the general uncertainty in the market.

In the simulation cycle under first scenario, the number of companies with higher debt and higher leverage gradually increases. Using the simulation, changes can be observed in the distribution of the firms' debt and leverage, rather than just analysing growth of the overall average debt and leverage. However, as the crisis becomes more severe, more firms with excessive debt and leverage go bankrupt or cease their activities in selected establishments; see: Table A11 in Appendix D.

The initial boom also encourages households to increase consumption, which in turn increases their overall debt, also affecting the value of debt service to income (DSTI), debt to income (DTI), debt to assets (DTA) and loan to value (LTV) ratios, see: Figures A12–A16. After the first iteration, the percentages of households that have DSTI ≥ 30% equal to 4.7%, and DSTI ≥ 40% equal to 2.7%, while the percentage of households with DTI ≥ 3 equal to 3% and DTI ≥ 4.5 equal to 1.3%. After the second iteration, the percentage of households with DSTI ≥ 30% was equal to 3.6%, and DSTI ≥ 40% equal to 2.2%, while the percentage of households with DTI ≥ 3 equal to 2.1% and with DTI ≥ 4.5 equal to 0.9%. After the third iteration, the percentage of households with DSTI ≥ 30% is equal to 4.6%, and with DSTI 40% ≥ 3.2%, while those with DTI ≥ 3 is equal to 1.9% and with DTI ≥ 4.5 equal to 0.9%. After one year, the percentage of households with DSTI ≥ 30% was equal to 5.04%, and with DSTI ≥ 40% was equal to 3.5%, while with DTI ≥ 3 this percentage was equal to 2.2% and with DTI ≥ 4.5 the percentage was equal to 1.1%. The percentage of households with respective values of DSTI and DTI at *t* > 0 are lower than at *t* = 0. There are two reasons that explain this pattern. Firstly, households with very excessive debt default are removed by the system. Secondly, highly indebted households

will not apply for any new loans and they pay back part of the debt. Nonetheless, as soon as their creditworthiness improves due to loan repayment, they are attracted by the market via mechanisms described by Minsky and the ratios start to deteriorate. Changes in investment and external financing directly affect the market imbalances. Individuals with lower qualifications and level of education experience a gradually deteriorating situation on average.

After a year the Gini coefficient for income distribution is equal to 39.9% and for wealth distribution is 60.8%. After two years, the values are 41.1% and 61.3%, respectively. The LAC is equal to 0.96901 and 0.93896 after four quarters. The point [*μ*, *f*(*μ*)] = (0.63; 0.33) for income, while it is equal (0.66; 0.26) the case of wealth. The adjusted azimuthal asymmetry (AAA) is equal to −0.07541 for income and −0.21341 for wealth.

Due to endogenous changes in the decisions of agents and their interactions, the dynamics of the markets and economy also changes. In particular, the dynamics of the labour and real estate markets change. Higher mortgages and a difficult situation on the labour market affect the dynamics of the real estate market. More properties are marked for sale and their price is reduced accordingly. On average, the prices of properties decreased by 2% in one year. It is possible to analyse a decrease in prices in each spatial unit, for example, region, however the results are not reported for confidentiality reasons.

With the deterioration of a favourable economic situation, the number of insolvencies and the NPLs ratios of banks increased; see: Appendix D (Figure A7 (on the right) and Figures A9 and A10 (on the left and right). Higher non-performing loans affect the supply of credit in subsequent iterations. In the model it is possible to use two methods of determining the supply. If the first one is used, banks adopt similar strategies in groups. If the second is used, there may be a greater degree in the heterogeneity of strategies. In both cases, these patterns were observed. The model allows the analysis of differences in non-performing loans according to the loan type which thus reflects another aspect of heterogeneity. Using simulation, we can also analyse the changes in profits (Figure A8 (on the left)), equity (Figure A8 (on the right)) or the fulfilment with the capital and liquidity requirements which were set on too low levels (Figure A11 (on the left) and Figure A11 (on the right)).

#### Stabilizing Unstable Economy via Macroprudential Tools

In the second scenario, the behaviour of the economy is simulated, assuming the implementation of macroprudential policy aimed at stabilising the unstable economy. All banks set the capital requirements set by the regulator as well as apply the recommendations with respect to debt to income (DTI), debt service to income (DSTI), debt to assets (DTA), loan to value (LTV) ratios and leverage ratio (LR). In the economy, the activity of companies is conducted in the eight sectors grouping NACE industries. Among the analysed sectors, the most attractive for potential entities is the third sector, while the relatively least profitable for investors is the eight sector. In the case of any industry, there is no significant decrease in relative profitability. In first scenario, it was observed that the role of some of the sectors, that is, real estate sector, increased sharply, and then was significantly reduced. In the second scenario, no sudden discontinuity of production or increasing number of bankruptcies were observed. There are were no significant changes in product prices.

The expectations are relatively much more consistent in time than in the case of the first scenario. In this scenario, these expectations are only slightly different than those formed in the previous period and adapt to the fluctuations of the economy. Stock fluctuations are consistent with the dynamics of the economy. There is no stock accumulation or stop to production and sales of stored goods. In this scenario, the leverage level is moderate. Only in the case of a small percentage of establishments was production stopped completely.

In this scenario there are no searching-matching problems between the establishments in the search for suppliers. Quality-to-price ratio of establishment in relation to quality-to-price ratio in a given sector is the appropriate determinant of the supplier's search decision. In most cases, it is possible to find a supplier in a given spatial unit that has a sufficient quantity of produced and stored goods. The search for a supplier in the unit that exceeded the basic spatial unit is moderate and corresponds

to normal time market dynamics. The additional costs generated by transportation of inputs for establishments' production of goods were also moderate.

Most firms have adequate liquid assets and adequate creditworthiness. Additional funds will be used for further investment. A very low percentage of establishments were eligible for the creditworthiness check in connection with transitional liquidity problems. Transient problems of establishments on the market are related to temporary economic fluctuations in industries, as well as market dynamics. In this scenario, banks have adopted similar credit requirements for less risk-prone companies. However, banks differ in credit requirements for more risk-prone businesses, especially firms with temporary liquidity or financial problems. The tightening of the criteria has countered the financial crisis. Of particular importance was the observation of return on assets (ROA), return on equity (ROE), financial risk and credit history of companies.

In the case of a low number of establishments, a readjustment of quantity was required, and the final purchase of the inputs was lower than the intended one. Banks providing loans for the purchase of inputs were characterised by different risk aversion and strategies on the market. In some cases, the network effects have been maintained. The establishments applied for a loan in a matched bank, thus maintaining a transaction link (edges in the network). For other transactions, there was a change of the loan-granting bank. When searching for a bank that will grant short-term credit for the purchase of inputs, the companies were mainly driven by the interest rate and the supply of credit.

In the model it is possible to use two methods of determining the supply. If the first one is used, banks adopt similar strategies in groups. If the second one is used, a greater degree of heterogeneity of strategies is observed. In the first case, network effects associated with transaction relationships in the market have been maintained. Individuals choose banks to apply for a loan according to the interest rates on consumer loans offered by banks. Granting a loan also depended on credit supply and sectoral exposure requirements. Some banks have exhausted the supply of consumer loans, which means that according to the strategy defined for a given period, the funds were spent on other activities such as granting short-term and long-term (investment) loans to companies, and residential and non-residential loans to individuals.

Within the second method, during the year the same number of individuals applied for a loan at the matched banks; a very high percentage of these applications were successful. In this case, network effects associated with transaction relationships in the market were maintained. The supply of consumer loans and sectoral requirements limited the number of loans granted.

In both cases there were also no searching-matching problems between consumers and suppliers of goods. Also, the quality-to-price ratio in relation to quality-to-price ratio in a given sector is the appropriate determinant of the supplier's search decision. In most cases, it has been possible to find a supplier in a given spatial unit that had a sufficient quantity of produced and stored goods. In some cases, the search for suppliers exceeded the basic spatial unit, generating a modest cost of goods transportation. It did not generate an excessive burden on households.

Demand of establishments and households was complemented by demand from the government, through public procurement. The establishments that signed the public contracts produce high-quality products. These establishments were also part of the largest companies on the market.

In the case of households within 'Housing stress!', the cost of accommodation, whether in the case of servicing a housing loan or renting, proved to be excessive. These households changed their residence to a cheaper property. The dynamics of the housing market was not excessive and was consistent with household income fluctuations. In the case of a very low percentage of households, their insolvency was observed, as was an increase of NPLs in the banks by the value of their loans. The prices of properties fluctuate on the market as a whole but the prices remain relatively stable within a determined region.

Using the simulation, it is also possible to compute which percentage of households purchased a new property in cash and which have applied for a residential or non-residential loan. Demographic trends were fully preserved in the scenario. The probability of survival or death has been specified according to Central Statistical Office data. As a consequence of the death of individuals, inheritors gained additional deposits. Most companies were taken over by the heirs, while in cases of negligible value the inheritance was rejected. In some cases, the deceased was the owner of the property charged with the loan. These properties were taken over by the bank and were resold at a lower value. In the case of survivors, the tendencies of completed education by individuals were also maintained.

Some companies were not created despite starting the company opening process. Some did not obtain a business license, and in some cases, funds were not sufficient to run a business. Credit applications are a special case in which the entrepreneurs compared the interest charged by the banks. The banks also checked whether the supply side restriction was fulfilled and whether the sectoral exposure did not exceed the requirements. Sectoral exposures have made it possible to limit potentially excessive credit growth in the most profitable sectors at any given moment, including in the real estate sector, which normally expands dynamically during prosperity. The larger companies were funded with contributions from entrepreneurs. There was an increase in average goodwill points during an expansive phase of a business cycle. At the same time, the structure on the market changed, with some activities ceasing and other new activities being created. New establishments were mostly opened in sectors with high or moderate risk. Changes in the number and structure of firms on the market corresponded to the usual dynamics of the economy. There was no increased concentration of capital, business clustering, excessive bankruptcies or escalation of reductions of labour force in already operating establishments.

An analysis of the distributions describing the attributes of firms and establishments does not allow the identification of situations typical of financial or economic crises and symptoms of overheating of the economy. In this scenario, a significant increase in the risk of activity of firms and establishments on the market was not observed, nor was the strong growth of the economy and the increased financial risk of a particular industry. The average risk to the business activity in the market was moderate.

The lack of concentration of financial risk in a given industry is largely due to the introduction of regulations for maximum exposure to a given industry. The situation of banks is stable. For the first and the second procedure of supply determination, the NPL ratios were moderate. Liquidity requirements are met in the case of most banks. Capital requirements were fulfilled at the level of 8%, introduced by bank regulator. None of the banks declared insolvency. A very low percentage of individuals declared insolvency as a result of net savings at a negative level. The NPL ratios and the growth (inflow) of NPLs of banks was modest.

The stabilising effects of macroprudential policies for the economy and the financial system is significant, however the effect on reducing inequality is ambiguous. The richest agents on the market seem to remain unaffected by the introduction of the policies. In extreme cases, the rich get richer. After one year, the Gini coefficient for income distributions was equal to 39.7% and 60.6% for wealth. After two years, the values were 40.1% and 60.9%, respectively. The Lorenz Asymmetry Coefficient (LAC) was equal to 0.97672 and 94782 respectively. The point [*μ*, *f*(*μ*)] = (0.62; 0.36) for income, while it is equal (0.67; 0.26) for wealth. The adjusted azimuthal asymmetry (AAA) is equal to −0.07541 in the case of income and −0.21341 in the case of wealth. The results do not differ significantly in the next four iterations.

#### *6.3. Optimality of Macroprudential Policy Stance*

Thus far, the possibility of stabilising an unstable economy using macroprudential policy has been analysed. Simulation has allowed analysis of the degree to which macroprudential policies influence the distribution of variables, including the distribution of income or the distribution of wealth, allowing a fuller welfare analysis. However, the main question is which policy combination to choose from, utilising possible combinations of tools to stabilise the economy and financial system, as well as to ensure a more homogeneous distribution of wealth and income. Optimal choice is understood here to

mean the method of choosing the most advantageous combination of macroprudential tools (from the point of view of social well-being). In contrast to the social planner approach, the abstract concept of Bentham's social utility is not focused on; rather there is focus on the stability of the economic and financial system and the measures of welfare that quantify changes in income and wealth distributions.

Based on the scenarios, it can be concluded that the use of a combination of macroprudential tools (appropriately calibrated) may lead to stabilisation of the system. Nonetheless, this combination of policies was not optimal in a sense that the statistical equilibrium was achieved at a level which does not guarantee a sufficient reduction of inequality in the system. The optimal policies would be the ones which enable a decrease in inequality in the system (to an acceptable level). The results were shown to be robust by carrying out the Monte Carlo procedure. The exact results for the Polish system (including optimal combination of macroprudential tools) are not reported here due to confidentiality of individual banks' and firms' data. The simulation can, however, be performed using data available from the National Bank of Poland, which would allow plausible results to be obtained. The results in the scenarios are mostly illustrative to the new methodology developed.

#### **7. Final Remarks**

The paper has analysed the stabilising effects of macroprudential policies on a heterogeneous economy using an agent-based approach. The presented simulation is a novel application of agent-based approach in systemic risk modelling. The model constitutes an alternative to the '3D' model with three layers of default that is widely-used by experts of the European Systemic Risk Board and the European Central Bank. The main advantage of the ABM model with respect to the '3D' model is the possibility to carry out counterfactual simulations within the framework of fully heterogeneous agents.

The simulation results show the stabilising effects of binding macroprudential policies on the unstable heterogeneous economy. However, in opposition to mainstream literature, the use of macroprudential policies as an alternative to redistribution policies does not always lead to the same results if heterogeneity is assumed in the model. Even if the shape of the income and wealth distributions could be smoothed for most percentiles, the macroprudential policies do not affect the richest individuals in the desired way; the richest get even richer with respect to the rest of society. In general, the macroprudential policies and regulation should counteract the negative effects of the crisis, including the impact of the crisis on society (distributional effects). Nonetheless, this paper shows that suboptimal or non-binding macroprudential policies in the economy with heterogeneous agents *ex ante* and *ex post* do not remove the all negative distributional effects. Poor calibration of macroprudential policies would not only counteract the endogenous generation of the crisis in Minsky's sense but would also lead to higher inequality. This finding is consistent with the ECB studies of P. Hartmann [120] on the distibutional effects of macroprudential policies and the possible interactions between social policies and macroprudential policies. This view was also supported by van der Heuvel [13] and Claessens [121]. Moreover, the policy recommendations and results of welfare analysis obtained from the DSGE models with homogeneous agents may be in practice very misleading for central bankers.

**Author Contributions:** Conceptualization, J.K.-M. and M.P.; methodology, J.K.-M. and M.P.; software, J.K.-M.; validation, J.K.-M. and M.P.; formal analysis, J.K.-M. and M.P.; investigation, J.K.-M. and M.P.; resources, J.K.-M. and M.P.; data curation, J.K.-M. and M.P.; writing—original draft preparation, J.K.-M. and M.P.; writing—review and editing, J.K.-M. and M.P.; visualization, J.K.-M.; supervision, M.P.; project administration, J.K.-M. and M.P.; funding acquisition, J.K.-M. and M.P. All authors have read and agreed to the published version of the manuscript.

**Funding:** The research of J. Kaszowska-Mojsa was partially funded by the National Science Centre (2013/09/N/HS4/03740) and the Polish-U.S. Fulbright Commission. The research of M. Pipie ´n was supported by the research grant no. 2017/25/B/HS4/02529, financed by the National Science Centre, Poland.

**Acknowledgments:** We would like to thank Alberto Russo and Silvano Cincotti for valuable comments during the seminars "Agent Based Modelling in Macroeconomics" on 8 May 2015, and "Agent-based Macroeconomics: Endogenous credit-driven business cycles in Eurace" on 4 October 2017 at the National Bank of Poland. We also would like to thank James M. Chen for valuable comments on inequality measures. The model code and pseudocodes can be found on: https://www.comses.net/codebase-release/9b39dc1c-506e-4a02-b2ca-56b9c50738e4/.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **Abbreviations**


#### **Appendix A. Notation and List of Variables (Agent's Attributes)**




#### **Table A2.** Individuals (−.*ind*) (*continuation*).


**Table A3.** Households (−.*HH*).

**Table A4.** Firm (−. *firm*).



**Table A5.** Establishments (−.*est*, −.*est*.*buy*).


**Table A6.** Bank (−.*bank*, −.*b*).


**Table A7.** Sector (industry) (−.*s*) .

**Table A8.** Properties (−.*prop*).



#### **Table A9.** Consumers (−.*cons*).



#### **Appendix B. Sequential Updating of States in the Model**

**Figure A1.** Sequential updating of states in the model (modules 1–12).

**Figure A2.** Sequential updating of states in the model (modules 13–23).

**Figure A3.** Sequential updating of states in the model (modules 24–36).

**Figure A4.** Sequential updating of states in the model (modules 37–47).

**Figure A5.** Sequential updating of states in the model (48–58).

#### **Appendix C. Calibration**

At the start of the simulation, the attributes of individuals, households, and consumers, as well as some attributes of properties were calibrated on the basis of data from the Household Wealth and Debt Survey from 2014 [112]. This first study on household wealth and indebtedness in Poland was conducted between January, 20 and February 28, 2014, on a sample of 7000 households residing in the country. The study was conducted through direct interviews. The test sample was generated by a two-stage random sampling scheme, where the first stage of sampling was stratified; the census units were randomly selected from the layers, and the second stage of household sampling was randomised. The stratification was based on the following criteria: province, size of the spatial unit (6 categories) and wealth (on a scale of 1–4). In the applied scheme, procedures of over-sampling of the most affluent households and imputation of missing observations were applied [122]. The completion ratio of the surveys was approximately 49.4%.

#### *Appendix C.1. Individuals, Households & Consumers att=0*

Based on the information from the Household Wealth and Debt Survey sample, the distributions of agent's attributes were approximated. In the model 971 520 individuals were distinguished at *t* = 0. There are 509 056 (0.52%) women and 462 464 (0.48%) men in the database. The distributions of sex and age were compared with the data from 'Population. Size and structure of population and vital statistics in Poland by territorial division as of 31 December 2014' [123], and 'Size and structure of population by age groups in 1989–2016' [124], provided by the Central Statistical Office (GUS). To ensure the proper dynamics of the model, data from 'Marriages contracted and dissolved in 1970–2015' [125], 'Births in 1970–2015' (GUS) [126] and 'Demographic Yearbook of Poland 2015' [127] were also used. In addition, data from life expectancy tables of 2014 provided by GUS were used [128]. Data was supplemented by 'Education in the school year 2014/2015' (GUS) [129]. Supplementary data on labour market and wages was used from 'Yearbook of Labour Statistics, 2015' (GUS) [130]. In addition, information from 'Social assistance. Child and Family services' (GUS) [131] was used. In the model, at *t* = 0, 442,240 households were distinguished. Each household is described by a joint distribution of attributes. BZDG data was supplemented by the data from 'Household budget survey in 2014' (GUS) [109] in order to obtain distributions. To each household a specific type of consumer has been assigned, which determines expenditures. There are therefore 442,240 × 8 (industries) × 6 (consumer types) = 21,227,520 data-points (records) in the Table *Consumers* database.

#### *Appendix C.2. Firms & Establishments att=0*

The values of variables of firms and establishments were approximated on the basis of GUS reporting forms of enterprises for 2014 [132]. In order to approximate inputs from different sectors and demand for final goods as well as direct product input coefficients and direct import input coefficients, information from input-output tables for 2010, provided by the Central Statistical Office [133], was used. The distributions of variables have not been reported for confidentiality reasons.

#### *Appendix C.3. Industries & Suppliers att=0*

The sectors in the model correspond to the branches of economy used in the input-output table at basic prices for domestic output for 2010, provided by GUS (2014) [133]. The classification used in the table corresponds to products and intermediate consumption (CPA 2008). Data from input-output tables was used to approximate the flows between sectors in the model. Each industry is described by the average values of variables that were approximated using the data from Central Statistical Office forms. The classification of industries (PKD (NACE) 2007) was matched with the classification of sectors used in the input-output tables. PKD 2007 is more disaggregated than the classification used in the published input-output tables. PKD-2007 is fully methodologically, conceptually, in the scope and coding system (up to fourth digit) coherent and compatible with the classification NACE Revision 2. In the input-output tables the Classification of Products by Activity (CPA) was used. Some of PKD sectors were aggregated into one group in input-output tables for confidentiality reasons. A total number of 73 sectors were analysed, excluding sectors 04 (Coal and lignite), 08 (Tobacco products), 66 (Public administration and defence services; compulsory social security services) and 77 (Services of households as employers of domestic personnel & Undifferentiated goods and services produced by private households for own use). The suppliers for establishments have been matched based on input-output tables. The model expresses the network structure of relations between companies in the economy. For confidentiality reasons, the system was simulated with eight sectors, grouping certain industries.

#### *Appendix C.4. Banks att=0*

The model included 14 major banks in the market. The interest rates for these representative banks came from new MIR interest rate statistics [134]. Different interest rates were used for deposits, consumer credit, housing loans and non-residential loans. The distinction between flows and stocks was also taken into account. The interest rates for each bank were not reported for confidentiality reasons. The behavioural aspects of banking decisions while checking the creditworthiness, such as levels of LTV or DTI, and sectoral exposures and concentration limits, have been approximated using the PFSA Recommendations S, T and C, as well the Banking Code. In the future, it will be possible to use the PFSA surveys. The data from the surveys has not yet been accessible for confidentiality reasons.

#### *Appendix C.5. Parameters and Decision Rules*

All decision rules are obtained as a result of prior econometric analyses. In addition, expert knowledge about the functioning of markets and economic agents on the Polish markets were used. Parameter values were obtained after a thorough analysis of statistical data obtained from the National Bank of Poland and the Central Statistical Office and partly correspond to the values adopted in macro-models in the literature (e.g., labour elasticity, capital elasticity, relative quality elasticity and, know-how elasticity in the production function). The most important added value of the analysis is the linking of information obtained from the Central Statistical Office database on firms and the publicly available input-output table at basic prices for domestic output. All parameters assumed in modules 6–8, selected parameters in 14 & 19–20 were obtained directly using the procedure developed by Santos & Kaszowska (in the MOSIPS FP7 project), based on input-output table data. In order to obtain the parameters in demographic, education and labour market modules, Central Statistical Office and Household Wealth and Debt Survey data were used (especially, modules 27–36, 47–50). The parameters in modules 38–40, 42–46, 50–52 were calibrated based on Central Statistical Office data on enterprises.

The group of 'parameters' in the model includes not only the values of estimated or calibrated parameters of a functional form of decision rules, but also parameters that can be adjusted by the user to develop scenarios and to carry out a counterfactual simulation on the state of the economy and financial sector as well as macroprudential policies. For instance, in module 3 it was assumed that the level of leverage and financial risk that is acceptable by the companies in each of the industries to produce goods and services. Similarly, the levels of screening ratios of banks (e.g., ROA, ROE, acceptable financial risk of the applicant or the industry etc.) and macroprudential ratios can be assumed. Alternatively, the experts of the National Bank of Poland can use confidential data from the surveys about the banks' policies and stance, and/or the calibration based on the ESRB recommendations.

*Entropy* **2020**, *22*, 129

#### **Appendix D. Figures & Tables**

**Figure A6.** Risk spreading between industries over 1 year horizon (two visualisations on the left and on the right).

**Figure A7.** Risk spreading between industries (on the left) & Number of firms in the sectors over 1 year horizon (on the right).

**Figure A8.** Profits of banks (on the left) & (**b**) Equity of banks over 1 year horizon (on the right).

**Figure A9.** Total NPL ratio of banks (on the left) & NPL ratio of consumers loans of banks over 1 year horizon (on the right).

**Figure A10.** NPL ratio of housing loans of banks (on the left) & (**b**) NPL ratio of firm loans of banks over 1 year horizon (on the right).

**Figure A11.** CAR of banks (on the left) & (**b**) LCR of banks over 1 year horizon (on the right).

**Figure A12.** Households' income over 1 year horizon. (\*) t = 0 BZGD. From t = 1 tot=4 simulation results.

**Figure A13.** DSTI over 1 year horizon \*. (\*)t=0 BZGD. From t = 1 to t = 4 simulation results.

**Figure A14.** DTI over 1 year horizon \*. (\*)t=0 BZGD. From t = 1 to t = 4 simulation results.

**Figure A15.** DTA over 1 year horizon \*. (\*)t=0 BZGD. From t = 1 to t = 4 simulation results.

**Figure A16.** LTV over 1 year horizon \*. (\*)t=0 BZGD. From t = 1 to t = 4 simulation results.

**Table A11.** Leverage of companies.


#### **References**


© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
