Predictive Analysis of Fiscal Crises with Deep Learning Time Series Model

Fiscal crisis can cause serious damage to the economy. Remarkably, there is limited study about when and how it occurs. With the social and economic data of more than 180 countries from 1970 to 2015, this paper constructs a fiscal crisis risk index system to explore the relationships between the crises and the indicators such as GDP growth rate, inflation rate, FDI, and foreign debt interests. Predictive analysis is performed based on the time series model of deep neural network to shed some light on policies and economic dynamics around the crises. We find that besides the inflation, fiscal crises in advanced economies are closely related to the net outflows of FDI and GDP p.c. while in developing countries the GDP growth rate and the net inflows of FDI are the key factors. Low-income developing countries are the heavy-hit targets with the net inflows of FDI, debt structure and interests as main contributors.


Background
In recent years, fiscal crises have caused serious problem on the world economy.They are usually resulted from large deficit or sovereign debt default.For example, in August 1982 Mexico failed to repay the debt of $26.8 billion, the country fell into a recession spreading to 34 countries including Brazil, Argentina, and Peru, which is known as the Latin American debt crisis.In August 1998 the Russian government announced that it was unable to repay $15 billion in foreign debt leading to a plunge in the Rouble exchange rate.The stock market fell 85% compared with the beginning of the year; in January 1999, Brazil's Minas Gerais announced that the state was unable to repay the federal government's $15.4 billion debt, resulting in a 44 % drop in the price of Brazilian government bonds on that day.The real exchange rate against the us dollar fell sharply.Within three weeks, the central bank governor changed hands twice.In October 2009 the Greek government reported that the country's fiscal deficit and public debt would cross the red line, 12% of GDP and 120% of GDP respectively.The Greek sovereign credit rating has soon been downgraded by the world's three largest Rating firms.This has led to a global shock in capital markets.
Fiscal crisis often comes with the collapse of the exchange rate system or the fragile banking system, and evolves from the debt crisis, the monetary crisis to the financial crisis, and expands to other levels of the economy, which has become a comprehensive economic crisis with huge damages.Apparently, excessive growth of debt will have a serious impact on the economy.
In view of the devastating effect of a fiscal crisis, the assessment of risk factors is of great practical significance.The current research focuses on the causes of the fiscal crisis and the response to it.Few studies involve various types of countries, and can answer the questions such as, when will a fiscal crisis occur?what is the duration of the crisis?what are the main factors leading to the outbreak of the crisis?Through the analysis of the social and economic development data of more than 180 countries from 1970 to 2015, this paper explores the relationship between fiscal crises and macroeconomic factors such as GDP growth rate, consumer price index, FDI, foreign debt interest rate, constructs the fiscal crisis risk index system, and employs artificial intelligence and other quantitative models to analyze them.Considering the different social and economic development status in various countries, there are great differences in the ability to withstand and dissolve the crisis.Hence this paper studies the important factors that affect the occurrence of the crisis with four groups: advanced market economies (AM), emerging market economies (EM), low income developing countries (LIDC) and small developing states (SDS).

Literature Review
In 1990s fiscal crises were considered to have a predictable component to some extent (Flood & Marion, 1998).For example, Lein and Marion (1994) applied the Logit model to study the financial crisis of Latin America from 1957 to 1991, and found that the probability of a crisis would increase with the increase in the overvaluation of currency and the decrease of foreign exchange reserves.The IMF has organized experts to launch a crisis warning model called KLR model or the signal model with wide influence.The key of the model is to select the right early warning indicators and determine the threshold values of these indicators.The warning indicators include exchange rate overestimation, stock index, export growth rate, broad currency and foreign exchange reserve ratios, and output growth rate.The KLR model uses the method of minimizing the noise to signal ratio to determine the threshold of the index.Later, Goldstein, Kaminsky, and Reinhart (2000) modified the signal model, adding credit growth rate, real interest rate and other indicators.Mulder, Perrelli, and Rocha (2001) added the micro-economic indicators, including the ratio of short-term loan to working capital, the bank's balance sheet variables, the debt to export ratios for foreign banks, and so on.Kruger and Messmacher (2004) pointed out that short-term financing pressure might lead to sovereign debt crisis.Mauro (2011) proposed a better financial regulation mechanism to avoid a financial crisis.
However, the Asian financial crisis in 1990s and the European debt crisis ten years later have the outbreak come suddenly, and none of the early warning models provide the warning in advance.Predictability of the crisis remains a mystery.The world's three largest credit rating agencies, Standard & Poor's, Moody and Fitch, have issued regular credit ratings for each country.They tend to lower their ratings after the outbreak of a crisis rather than foresee a crisis, which leads to the the further turbulence of the market.
With the introduction of deep learning technology, the artificial intelligence (AI) based machine learning method has recently drawn more interests in the field.Since the AI algorithm has no requirements for the selection of samples, can automatically learn and adapt to complex systems and obtain results quickly in some fields.For example, Fioramanti (2008) finds that the multi-layer neural network early warning model is superior to the parameter model and non-parametric model in Econometric under a certain condition.However, there is a lack of research on neural network models in the early warning of a fiscal crisis.Considering the country difference and the dynamics of the crisis throughout the years, deep neural network model can learn and adapt the complex system with strong fault tolerance and robustness.Therefore, this paper aims to build Time Series NARX (a nonlinear auto-regressive network with exogenous inputs) Feedback Neural Networks as the early-warning model for the fiscal crisis.

Data and Methodology
From the WEO (World Economic Outlook) and IFS (International Financial Statistics) database of the International Monetary Fund, the WDI (World Development Indicators) and GDF(Global Development Finance) database of World Bank, 183 countries with relatively complete data from 1970 to 2015 are selected as the sample (Figure 1).According to the definition of the fiscal crisis of Gerling et al. (Note 1), if at least one event occurs in the following 4 items, it indicates a fiscal crisis in the country.1) credit events: sovereign debt defaults, rescheduling or restructuring, causing significant losses to debt holders.
2) special financing: special loans or financial adjustment plan set by IMF for a country over 100% of its quota.
3) implicit domestic public default: high inflation rates or a sharp increase in domestic debt.4) loss of market confidence: a country finds that the cost of financing in the international capital market has increased sharply or is unable to finance at all.Based on the above definition, table 1 lists the number of fiscal crises in the 183 sample countries including the duration of the crisis, the frequency of the crisis and the average numbers.According to the different types of social and economic development status, these countries are divided into four groups (Note 2): advanced markets (AM), emerging markets (EM), low-income developing countries (LIDC) and small developing states (SDS).
The duration of a crisis refers to the total number of years that the country is identified as a crisis; the number of crises refers to the total number of times the country's discontinuous crisis occurs during this period; the average duration is the average number of years in crisis, which is calculated by dividing the duration of the crisis by the number of crisis for the country.The data showed that the total number of crises are 505 in the sample countries.The total number of years in crises are 2459 and the crisis lasts 4.87 years on average.LIDCs are the heavy zone of the crises, which not only occurred most frequently, but also lasted the longest time.Figures 1 and 2 show the changes in the average GDP per capita growth rate and current account balance, before and after the sovereign debt crisis for these four groups of countries (AM, EM, LIDC, SDS).If the crisis happens at the time of T, then we choose the mean value from T-3 to T-1 before the crisis, and the three year average from T to T+2 after the crisis.It is apparent that the debt crisis has disrupted the economic development of all countries, the rate of economic growth has decreased significantly or even becomes negative, with the current account deficit increased with most of the countries except AM and SDS.Relatively speaking, the LIDC and SDS countries have less serious damages from the outbreak of sovereign debt crisis, and the current account balance in SDS has improved after the crisis.One explanation is that these countries are relatively small in terms of GDP, and the international financial organization usually provide the debt relief or special financing plan soon after the crisis occurs,which help them get through the difficulties.To set up the early warning model of the fiscal crisis, we need to start with the determination of the crisis indicators index system.Based on the principles of scientism and comprehensiveness, we divides the early-warning indicators of fiscal crisis into 37 subcategories of the 3 major categories: 1) economic development indicators, which reflect the overall performance of a country's economy.Since the root cause of debt crises is the deterioration of macroeconomic conditions, these macroeconomic indicators are essential to determine a country's debt repayment capabilities.
2) debt indicators, which represent the total debt and debt maturity structure of a country.Historically, the excessive amount of external debt and the displaced debt maturity structure can invoke the debt crisis directly.
3) international capital flow indicators, which imply the relevance of a country's economy to the world economy.According to the literature study, there is a strong correlation between international capital flows and sovereign debt.A large number of international capital flows during the short period can directly or indirectly lead to the outbreak of the sovereign debt crisis.Therefore, these indicators can play an early warning role in the occurrence of the sovereign debt crisis.Next, a synchronous gradient learning algorithm is established for all parameters for the given sample: . The average error function of the neural network on the sample set is: Among them, m is the number of hidden layers, and   is the connection weight between the j hidden units and the l output unit.
From the derivatives of the error function   ,   , we can get the minimum mean square error (MSE) learning criterion.
Among them, tl y  is the prediction value of the l output unit at the t time node, tl y is the observation value of the l output unit at the t time node.In these parameter learning criteria,  (>0) is the learning rate which can be gradually reduced from a slightly larger initial value to zero over the time.When the mean square error (MSE) reaches the lowest point after many iterations, the calculation stops so that the parameter values of the neural network are obtained.

Results and Analysis
In the past, we can see that in the design of parameters, neural networks should undergo repeated experiments to select the best training parameters.Therefore, the design and training process of neural network are implemented simultaneously.The purpose is to come out the neural network model with the best training result.As shown in Figure 4, when the network model is trained to 16 epochs, the overall error values of the training set and the validation set reach the lowest point, which meets the accuracy requirements of the training target,hence the training stops.At the same time, since the validation set curve has been decreasing before the sixteenth step, it can be determined that there is no over fitting.
When the network model is trained, we will put the input variables of the test and validation set into the network, and simulate the samples.We can modify the program above by adjusting the input and feedback delays.After multiple tries, we find that the result of one time node delay is better than that of two time node delays.  2 lists the simulation result: the prediction from the model is correct 8417 times including 5959 times with no warning signal, and 2438 times with the warning signal.There is only one case that the model fails to simulate correctly; it forecasts a crisis which has not occurred.Overall, the deep neural network model has achieved the correction rate of 99.99%.The results show that the deep dynamic neural network model has a high accuracy rate for the analysis of large financial crisis data.It can predict the occurrence of financial crisis in a country one year ahead.Historically the neural network model is considered as a black box, which is lack of interpretative effect.In recent years, the research literature (Cochrane, 2011;Zhou, & Wang, 2016) shows that by investigating the connection weight coefficient or partial derivative (Partial Derivatives) between the neurons, the complex network model can be analyzed, and the input parameters which have an important impact on the output results can be obtained.Using the weight analysis, the following chart lists the five most influencing factors that contribute to the fiscal crises in four groups of countries including the advanced economies (AM), the emerging economies (EM), the low-income developing countries (LIDC) and the small developing states (SDS).
Figure 5 shows that inflation is a major contributor to the outbreak of fiscal crises in AM, EM and LIDC countries.Inflation leads to the devaluation of local currency, which is equivalent to the appreciation of foreign currency.As the foreign debt is mostly settled in US dollars, the home country's debt is aggravated; in addition, inflation will increase the risk and operating cost of productive investment, which induces to the decline of foreign investment and the fund escape.Thus the inflation results in the fiscal crises.For the AM countries, the net outflow of FDI and the GDP per capita are the main contributors to the outbreak of the crises besides the inflation.A developed country with the net outflow of FDI has usually a weak economic growth rate and a substantial devaluation of the currency to the US dollar.When the devaluation of the currency and the stall of economic growth, financing in the international market will be greatly increased, and the risk of the financial crisis will rise sharply.As for the per capita GDP, it reflects the economic strength of a country.The per capita GDP of the developed economies is usually higher than that of the developing countries, and the ability to bear the debt is also stronger.In general, the possibility of the financial crisis will be reduced with the increase of GDP per capita.
For EM countries, GDP growth rate, urban population growth rate, foreign net assets are the main contributors besides inflation.This illustrates that the keys to prevent fiscal crises in emerging economies are promoting economic growth and strengthening the abilities to resist risks.Measures to promote the process of urbanization, increase the net assets of foreign countries, and regulate the interest rate of new foreign debt are very important for the emerging economies to improve their economic strength and prevent financial risks.
LIDC countries are usually the heavy-hit targets of the fiscal crises whether from the number of outbreaks or the duration of the crisis period.Besides inflation, the net inflow of foreign direct investment in the last year, the interest in arrears of foreign debt and the proportion of short-term foreign debt to GDP are the main contributors to the financial crises.This shows that the economic development of these countries relies on the investment of foreign capital to a large extent.If the inflow of foreign capital is reduced, the interests of foreign debt gets higher and the proportion of short-term external debt is too high, financing in the international capital market becomes difficult, which leads to a rapid economic downturn or a financial crisis.Therefore, the key to prevent financial crisis in LIDC countries is to manage foreign debts well, pay close attention to the flow of foreign capital and guard against financial risks.
For the SDS countries, the net inflows of foreign direct investment in the last year, the net assets abroad and the interest in the arrears of foreign debt, the external balance on goods and services, and the GDP growth rate are the main contributors to the crises.The financial risks of these countries depend on not only the international capital flows but also their own economic development status.These countries, such as Fiji and Bahamas, are easily affected by a variety of factors due to their small economic volume.Hence the factors that cause the crisis are diversified.

Concluding Remarks
Deep Learning (DL) methods have been proved efficient in computer vision, natural language processing, and can also applied to time series analysis.The deep learning time series model has many advantages such as good simulation effect and strong fault tolerance.In this paper, the fiscal crisis early warning model is constructed by utilizing the DL methods on four different types of countries (AM, EM, LIDC and SDS).The results show that the proposed model has achieved the correction rate of 99.99%.
The top factors of the crisis are then derived from the model.For AM countries, the inflation, the net outflows of FDI, and the per capita GDP are the main factors.For EM countries, the priorities need to be set on promoting economic growth and resisting the financial risks.In particular, top priorities are to control the rate of inflation, increase the GDP growth rate, increase urban population, accumulate the net assets of foreign countries and regulate external debt interests.For LIDC countries, their economies are largely dependent on the investment of foreign capital.Hence, the rate of inflation, the net inflows of FDI, the external debt interests and the proportion of short-term external debt are the main concerns.For SDS countries, there are a variety of factors such as the net inflows of FDI, net foreign assets, external debt interests, external balance on goods and services, and the GDP growth rate.

Figure 1 .
Figure 1.GDP p.c. growth rates before and after the crisis Source: Author's own calculations based on IMF and World Bank databases.

Figure 2 .
Figure 2. Current account balance before and after the crisis Source: Author's own calculations based on IMF and World Bank databases.
Before the Crisis Current Account Balance After the Crisis

Figure 3 .
Figure 3. Sovereign debt crises counts vs. US and Asian financial crises Note. the gray bar areas correspond to the years of US economic crises while the yellow one indicates the Asian financial crisis.

Figure 3
Figure3shows that the number of sovereign debt crises of the above sample countries between 1970 and 2015 is closely related to the 5 economic crises in US and the Asian financial crisis from 1997 to 1998.The economic crises in the United States has led to the economic recession of other major developed countries, which resulted in serious shortage of domestic demand, sudden drop in export and quick decline of foreign exchange reserves in developing countries.Consequently, the developing countries had lost their income sources, failed to make payments which caused the debt crises.The Asian financial crisis has directly led to the currency devaluation of a large number of developing countries, loss of repayment ability and economic crises eventually.
In this paper, the training of neural network time series model is implemented on Matlab 2016a.First, 36 economic indicators from 1970 to 2015 in 183 countries are imported into Matlab as the input variables in matrix form represented as Country Input 183.Then the warning signal values of 46 year in these 183 countries are used as the expected output variables in matrix form represented as Country Result 183.Subsequently the Matlab program is written to train the model.

Figure 5 .
Figure 5. Five major influencing factors of fiscal crises

Table 1 .
Fiscal crises of 183 countries since 1970 Source: Author's own calculations based on IMF and World Bank databases.
Neural network and deep learning technology can simulate human behavior and resolve many complex issues that other methods pale.In this paper, the Matlab neural network toolbox is used to construct the time series model of sovereign debt crisis by using the deep dynamic neural network (NARX) with feedback.The input and output relation of the NARX model is )Figure5shows the schematic diagram of the neural network structure of the model.The neural network model includes an input layer, ten hidden layers and an output layer.The input layer is a multidimensional vector consisting of 46 time nodes (from 1970 to 2015) and 6588 (36*183=6588) input nodes.The output layer is a multidimensional vector containing 44 time nodes and 183 output nodes; the time delays of input and feedback signals are 2 time nodes; the learning function is the gradient descent learning function; and the conjugate gradient function is used as the training function.
in which, the next value of the output signal   is a function of the previous values of the output signal and the previous values of the independent (external) input signal x.

Table 2 .
Simulation result