Early Warning System in ASEAN Countries Using Capital Market Index Return: Modified Markov Regime Switching Model

Asia’s financial crisis in July 1997 affects currency, capital market and real market throughout Asian countries. Countries in Southeast region (ASEAN), including Indonesia, Malaysia, Philippine, Singapore, and Thailand are some of the countries where the crisis hit the most. In these countries, where financial sectors are far more developed than real sectors and the money market sectors, most of the economic activities are conducted in capital market. Movement in the capital market could be a proxy to describe the overall economic situation and therefore the prediction of it could be an early warning system of economic crises. This paper tries to investigate movement in ASEAN (Indonesia, Malaysia, Philippine, Singapore, and Thailand) capital market to build an early warning system from financial sectors perspective. So this paper will be very beneficial to the government to anticipate the forthcoming crisis. The insight of this paper is from Hamilton (1990) model of regime switching process in which he divide the movement of currency into two regimes, describe the switching transition based on Markov process and creates different model for each regimes. Differ from Hamilton, our research focus on index return instead of currency to model the regime switching. This research aimed to find the probability of crisis in future by combining the probability of switching and the probability distribution function of each regime. Probability of switching is estimated by categorizing the movement in index return into two regimes (negative return in regime 1 and positive return in regime 2) then measuring the proportion of switching to regime 1 in t given regime 1 in t-1 (P11) and to regime 2 in t given regime 2 in t-1 (P22). The probability distribution function of each regime is modeled using t-student distribution. This paper is able to give signal of the 1997/8 crisis few periods prior the crisis.


Introduction
The event of economic (financial) crisis in various countries, such as Latin America (1994)(1995), Russia (1998), Argentina (2002), and South East Asian Countries (hereinafter referred as ASEAN;1997 has boost many researches to the development of Early Warning System (EWS). The EWS is expected to capture and detect early possibilities of any economic (financial) crisis; therefore necessary action in monetary or fiscal policy could be realized as soon as possible. Kaminsky et al. (1998) and Berg and Pattillo (1999) developed EWS in countries which financial market is categorized as an emerging market. While Schnatz (1998) and Kamin and Babson (2001) developed EWS for central banks.
Prior to implementation of EWS in country policy level, EWS has been developed in banking institutions to detect financially distressed banks, such as Pettway and Sinkey (1980), Persaud (1998), and Roy and Tudela (2001).
Various economic indicators have been used as a variable to define the event of economic (financial) crisis. Kaminsky and Reinhart (1999) and Bussiere and Fratzcher (2006) used currency to define the financial crisis. Further discussion about definition of crisis could be referred to Schnatz (1998).
Many researches were striving to find the perfect model in forming EWS model. Kaminsky and Reinhart (1999), Kaminsky et al. (1998), and Goldstein et al. (2000) used leading indicator approach where each economic indicator were transformed into a binary signal and if any single indicator passes the threshold, the signal then will confirm that the crisis is going to occur, while Pettway and Sinkey (1980), Eichengreen et al. (1995), Frankel and Rose (1996), and Berg and Pattillo (1999) were using discrete dependent variable approach, with discriminant model, logit or probit.
Each research mentioned above inspired by Hamilton's framework (1989) with fixed transition probabilities (ergodic). Diebold et al. (1999) proposed Markov Switching methodology with time varying transition probabilities where the probability model was based on logit with external inference factor. We noticed that every EWS model was based on the assumption of the property of model's data observation, where each country's specific crisis had a different characteristics, thus, in this research, we will create a fit EWS model for ASEAN countries.
ASEAN countries tend to possess similar social culture and economic structure. By understanding the pattern and characteristics of crisis events in ASEAN countries, academicians as well as policy maker are able to predict the crisis event by utilising signal. The logic of this research was inspired by Hamilton (1989) and Engel and Hamilton (1990) by modifying the probability model and eliminating the process of observed variable. This paper is organized into five sections. Section 1 is the introduction, consists of research background and research specification. Section 2 is the literature review, while section 3 discusses variables and data as well as model specification, threshold issue and type 1 and 2 error, estimation of probability model, and simple algorithm. Section 4 is results and discussions, includes validity test of EWS model. Section 5 concludes all the content of this paper.

Literature Review
Initiated from Hamilton (1989), probability based EWS was acknowledged and continuously improved, in which the possibilities of events were assumed to follow Markov Chain. Within Hamilton's framework (1989), unobserved discrete variable (state / regime = 1 or 2) was derived from observed variable (first difference logarithm of GNP real). Observed variable followed autoregressive model (AR(4)) and the probabilities of state transition followed Markov chain. Initially, Markov Switching model of Hamilton (1989) used to detect business cycle by combining autoregressive model to random observed variable and Markov chain probabilities. Hamilton (1989) used autoregressive model with lag 4 followed by Goodwin (1993). This was done by adding model Markov Switching (MS) 4. In 1990, Engel also used the same methodology to test the presence of long swing in US Dollar with AR(1) model (Engel and Hamilton, 1990). See also AR(1) model by Chauvet (1998).
Markov Switching Model is continuously improved, from the autoregressive model as well as the assumption of probability theory, for example, Dueker (1997) with model Markov-GARCH, Cai (2004) and Hamilton and Susmel (1994) with model Markov-ARCH(2) process and Markov-GARCH(1,1). Haas et al. (2004) used model Markov-Mixed Normal GARCH (MN-GARCH). Every research that has been mention earlier was using MLE for parameter estimation, of course by assuming nonlinearity. Lux (2004) used GMM method in implementing estimation of parameter multi-fractal model by assuming linearity. Model used by Lux (2004) is Markov Switching Multi Fractal -GARCH model (and FIGARCH).
In developing Markov Switching model, Yao and Attali (2000) proposed several conditions that were required in autoregressive model, which was strictly stationary ergodic, the presence of moment (minimum one level), and the presence of limit theorem which covers string law of large numbers and central limit theorem. Test upon Markov Switching model were continuously developed, for example Hamilton (1989), Engel and Hamilton (1990), Garcia (1998), Nelson et al. (2001), also Kim and Nelson (2001). Neftci (1984) applied two states condition in analyzing the economy with US unemployment data, State 1 exists when unemployment rate was rising and in contrary, State 2 exists when unemployment rate was diminishing, while Hamilton (1989) used US GNP to detect US's business cycle where there were two states; regime 1 when growth state was positive and regime 2 when the growth rate was negative (recession).

Data and variable
We try to utilize stock index as a proxy to detect the ASEAN crisis. Asia's financial crisis in July 1997 affected currency, capital market and real market throughout Asian countries. Countries in southeast region (ASEAN), including Indonesia, Malaysia, Philippines, Singapore, and Thailand are some of the countries where the crisis hit the most. In these countries, where financial sectors are far more developed than real sectors and the money market sectors, most of the economic activities are conducted in capital market. Movement in the capital market could be a proxy to describe the overall economic situation and therefore the prediction of it could be an early warning system of economic crises. ASEAN countries which included to our research are Indonesia, Malaysia, and Singapore, with observed period from January 1996 to January 2008; Thailand (from January 1996 to September 2007); and Philippines (January 1996to March 2006. Monthly index data are coming from IMF's International Financial Statistics. In this paper, we also employ several other macroeconomic variables such as exchange rate, money supply (M2), inflation (CPI), and interest rates. These variables are supposed to improve the Markov Probability.

Model specification
Following Hamilton (1989) and Engel and Hamilton (1990), we divide the s t s(state) into two parts, increasing (s t =1) and decreasing (s t =2) of index in period t. Engel and Hamilton (1990) assumed that both states were coming from normal distribution (N(μ 1 ,σ 1 2 )) and (N(μ 2 ,σ 2 2 )) along with each trend (μ 1 and μ 2 ). When it combined into a single model, Engel and Hamilton (1990) used mixture of normal distribution where S t was an unobserved variable whose value were derived from random variable y t that fulfilled the increasing and decreasing specification in period t.
By following the Markov Chain postulate to explain the evolution of variable s t , we could conclude that: To fulfil the Markov Chain specification, the evolution process of variable s t could only be decided prior (s t-1 ) whose reflecting the real values of y and s. Hamilton (1990) used the assumption of autocorrelation on random variable (y 1 ) to lag 4, while Engel and Hamilton (1990) used only lag 1 in their autoregressive model.
In predicting the events of regimes in period t+1, Hamilton based models (1989) were doing self adjusting on its autoregressive model by entering Markov Chain probability model in estimating model parameter AR and they were also simultaneously estimating the parameter of both probability distribution (assumption: normal distribution, θ=(μ 1 ,μ 2, σ 1, σ 2 ,p 11 ,p 22 ). These six parameters were sufficient to explain (a) y t distribution conditional on y t , (b) s t distribution conditional on s t-1 , and (c) unconditional distribution of state in initial observation, which was: (2) Based on the information of distribution parameter and the value of probability state transition, joint probability of observed variable in period T (y 1 ,...,y T ) and variable unobserved (S 1 ,...,S T ) could be defined as: (3) Hamilton (1989) and Hamilton and Engel (1990) used MLE in estimating the parameter and also Quasi Bayesian Approach (Hamilton, 1991). Further explanation could be found in their paper. When the state of observed variable y t is known, p(S t =1;y 1 ,...y T , )=1 or 0, then the estimation of Markov transition probabilities is calculated using frequency approach (Cohort approach). The sum of transition process (S t ) from regime i to regime j in period t is divided by sum of (S t-1 ) which has been in regime i ( ). could be estimated by: In methodology developed by Hamilton (1989) and later researches, Markov chain inferences were used to detect the regime transition by decomposing non-stationary time series into a stochastic process, which is segmented time series.
The implementation of constant transition probabilities and parameter could only be relevant in stable economic condition such as in G7 countries. In the contrary, developing countries such as ASEAN possess the characteristics of fluctuative economic condition, often with big magnitude and rapid reversion. This difference requires necessary adjustment in model that accommodates the fundamental economic changes (see figure 1). In explaining the behavior of random variable y t , we propose an Equally Weighted Moving Average (EWMA) model superior to AR or ARCH/GARCH model, written as below: = w 1 y t-1 + w 2 y t-2 + w 3 y t-3 + w 4 y t-4 + ε t (5) In this model, we use EWMA(4) as a proxy in obtaining parameter of both t-student distribution from two economic regimes. EWMA (4) different from general Hamilton (1989) based model, where they estimated the parameter of probability distribution and random variable y t simultaneously using numerical method. By using this approach, we are successfully eliminating the issue of local optimum. The standard error parameter is formulated as below: (6)

Threshold issue and type 1 and 2 error
After defining the inference probability model, the next issue is to set the threshold. Threshold itself is used to detect the origin of random variable. Wecker (1979) used an indicator functions of y t , if y t-1 < y t and y t > y t-1 as an optimum forecast. However, this method tends to be arbitrary. Hamilton (1989) and Engel and Hamilton (1990) set the turning point as an inherent structural event in data generating process. Hamilton (1989) and Hamilton and Engel (1990) utilized the Markov Switching regression approach formulated by Goldfeld and Quandt (1973) to characterize the transition parameter from an autoregressive process.

Figure 1. Stock index trends of ASEAN countries
Source: data processing As in Kalman filter, time path from observed series was used to infer upon the unobserved state variable. But, unlike Kalman filter who used a linear algorithm to estimate the unobserved state variable, Hamilton (1989) used a nonlinear filter developed by Cosslett and Lee (1985) for the discrete variable value of an unobserved state. Further explanation about Hamilton (1989) could be found in Aoki (1967), Tong (1983), and Sclove (1983). Bussiere and Fratzscher (2006) defined crisis when the variable Exchange Market Pressure (EMP) 2 times standard deviation above the average EMP.
In this research, we define threshold of crisis as 60% from maximum index price to period t.
This new definition of threshold allows the model to accommodate the continuous fluctuation of fundamental shift. This will lead to a definition of crisis when index price is under the threshold. Every increase on index price is categorized as crisis when the price is still below the threshold line, vice versa.
However, we are not free from the two of errors, which are the Type 1 error and Type 2 error. When the defined threshold relatively too high, the model will tend to alarmed more crisis and the probability will tend to give false signal. In the contrary, when the threshold is too low, the model will tend to produce less crisis signals and the probability of not giving any signal when crisis really occur is tend to be higher (Type 1 error).
It is not possible to reduce both error without adding more sample in time or country (Watson et al., 1993;Wonnacott and Wonnacott, 1984). However, the event of crisis does not occur in every country and if it does, it only happen once for the long period of time. By that condition, we could only prefer which error we should prioritize. Logically, because the purpose of EWS is to reduce the impact of crisis, every decision maker should prioritize on Type 1 error by consideration that the impact of Type 1 error is more severe to economic condition rather than Type 2 error (Pettway and Sinkey, 1980;Bussiere and Fratzcher, 2006).

Estimation of probability model: the simple algorithm
As common comprehension, the fiscal and monetary policy taken in handling crisis take effect in three months. The EWS model is necessary to anticipate the fore coming crisis for the next three months in order to allow the regulator to implement the policy. To analyze the effect of inference in Markov chain model, we construct the initial model of EWMA(4) without regime transition probabilities. The algorithm for the model written as below: 1) Normalizing the monthly index price to convince no condition of missing value data. 2) Calculating the arithmetic return of index price with formula written as below: 3) Calculating the average and standard error of return three months ahead from return of four months preceding to every regime with formula : and 4) Setting the threshold period t and calculating the excess (thresh) as below: 5) Calculating the t student test with formula: 6) Calculating the one way probability from the t-student test by assuming t-student distribution. This probability shows the possibilities of being in the crisis regime for the next three months, when the index price going below the threshold line.
To improve the estimation result of EWMA(4) model above, we insert the inference of Markov Chain probability into the model. This inference will improve the random variable y t into a regime along with the transition probabilities in order to obtain the joint probabilities. The algorithm for this Markov-EWMA(4) model is: 1) Similar step of (1) and (2) as prior model.

2)
The return is then categorized into two states, state 1 when negative return occurs and state 2 when positive return occurs. Return classification into these states is not automatically the classification for crisis and non crisis regime, but it is used to obtain the transition probabilities with Cohort approach.

3) Calculating the average and standard
error return one month ahead from previous four month for each regime. This model is different from the preceding model in terms of the assumption of state transition could occur several times in three months (the approach of three times average is incorrect). 4) Calculate the transition probabilities state (P ij ) with Cohort approach, using formula as written below: and and N is the amount of return moving from i in period t-1 to state j in period t. When there is no data in the four months preceding, then we assuming the state transition probabilities from any or to any state is 0.5. 5) Calculating the excess threshold as step 4 from the previous model. 6) Calculating the t-student statistic by noticing the combination of state transition as shown in Figure 2 Based on the combination of state transition above, we could conclude t value to calculate the t-student statistic. Table 1 provides the summary of the formula from t-statistic of t-student by assuming the distribution follows t-student. This probability portrays the possibility of entering the crisis state, which is when index price goes below the threshold line. 2) Calculate the joint probabilities of state transition and the probabilities of index price passing the threshold; in order to predict the events of crisis for the next three months. 3) Probability of entering the crisis regime is resulted from adding joint probability from every possible state combination.
However, it is very likely that the problem of interstate Markov switching occurred. As explained in the algorithm above, state transition probability for four periods are calculated using a Cohort approach. This will allow the probability value entering state 1 (negative return) close to zero while there is no available data in four preceding periods. When probability entering regime 1 (crisis regime) is 99.99% -probability close to crisis threshold-, the value of group probability becomes very small and cannot catch the crisis itself. Therefore, the next developed EWS model is based on improvement issue of Markov probability of state movement.
To improve the probability of state movement, we will regress the probability of state transition of unobserved dummy variable which has the value of 1 if the state is 1 and 0 for the others. In addition, we will insert several macroeconomic variables as explanatory variables, which are exchange rates, money supply (M2), inflation (CPI), and interest rates. The last model we built is the model expected to improve the transition probabilities of state event by utilizing information of several macroeconomic variables such as exchange rates, money supply (M2), inflation (CPI), and interest rates. The improvement upon the model uses Logit approach as written below: and

Result and Discussion
Almost every ASEAN countries experienced similar crisis period, which is begin in the early 1997 (Thailand) to the end of 1999 (Indonesia), and in some countries, there are several indication of repeated crisis  Table 1. Formula statistic t-student test in the next periods. Even Thailand almost experienced a continuous crisis until 2007, which is caused by its political instability. As its definition, threshold is varying over time. Threshold was changed when there is a fundamental shift in a country's economic condition which measured by its stock index, where this hardly applicable when using currency as a proxy. Singapore's threshold is increasing in 1999 while the stock index were over priced the index price before the ASEAN crisis, and has rising steadily since the end of 2006. The same behavior is shown also in Indonesia, where the index price has gradually increasing since mid 2004.
Malaysia and Philippines also gave the same trend, where it could reach the index price point higher than pre-crisis price of 1997 (mid 2007) even the increasing pattern of index has already begin since 2003. The same behaviors of index price were shown by Thailand stock index. The threshold line remained further, because, until mid 2007, the index price was unable to reach the index price before 1997 crisis (for other countries figure see attachment).
Using EWMA (4) model, the up and down of index prices could be responded properly. This model is very sensitive on capturing the effect of index prices up and prices down. However, this model ignores the origin of distribution crisis and non crisis regime, where it depicted on its threshold. For example, during 1998 crisis and index prices were gradually rising from its lowest point, the probability on EWMA(4) model has already plummeted even though the index price is far below the threshold (in crisis regime). For improving EWMA (4) model that could not grasped the increasing (decreasing) of stock index effect within the certain regime threshold, we added Markov probability model to the EWMA (4) model. In Markov-EWMA Model, The increasingdecreasing index probability was grouped with the probability of entering index into the crisis regime threshold. If the rising (declining) index price still below the threshold (within crisis regime), the probability of crisis was still high (above 70%) and then decreasing when index price started to reach the threshold.
Markov-EWMA(4) model was more reliable to capture the crisis probability that started with a progressively decreasing from index price. For example Malaysia's Index, index decreasing started from the beginning of 2000 and then entered to the crisis regime from the end of 2000 to the beginning 2002, which can be better captured. Markov-EWMA Model (4) provided response immediately with the crisis probability increasing since the decreasing of the index for the first time. Meanwhile EWMA (4) provided after the second index decreasing. The superiority of predictive power from Markov-EWMA (4) model to the EWMA (4) also could be seen to the other ASEAN's countries.
As mentioned before, utilizing of stock index has more power to observe the fundamental change to the countries' economy which has emerging market, such as GDP, compare to currency exchange. With utilizing economic growth proxy, economic crisis threshold became more dynamic and logically fitted. However, the basic problem when using this proxy is the bubble effect. This effect will naturally exist, because the calculation of index used weighted-average approach, equal or not equal. Within the countries' economy, there will be more than one economic sector that has positive-negative correlation in the performance criteria. Therefore, the possibility of index decreasing effect of economic sector was neutralized by the other economic sectors.  For reducing bubble effect of Markov-EWMA (4) Model, we also used several macroeconomic variables besides index, such as inflation (CPI), interest rate (INT), currency exchange (EX), and money supply (M2). The improvement of Markov-EWMA (4) Model was applied for fixing the probability of interstate Markov transition probability. When Markov probability could explain state transition behavior properly, it was regressed to state transition unobserved variable, where it is valued 1 for State 1 and 0 for other, with logit model approach resulted a significant coefficient correlation.

Variable's Logit model
By adding some other macroeconomic variables, we expect to improve the state transition probabilities by explaining the portion of unexplained error model. The result of probability regression on Markov-EWMA(4) model and several macroeconomic variables to an unobserved variables could be studied in table 4.
From table 1 above, every country has a defining factor of different state transition. In Singapore and Malaysia, the indicator variables that expected to improve on probability Markov are first difference of exchange rate and money supply. In Indonesia, there is no other macroeconomic variable that is expected to improve the Markov probabilities. However, no doubt a Markov probability is the best in measuring the state transition. Even though in Thailand and Philippine, Markov probability variable could not give any significant effect. In Thailand, there is a proxy variable to measure the state transition, which using the first difference of exchange rate variable. While in Philippines, every defining variable are insignificant. The most optimum regression as an improvement upon Markov probability in measuring the state transition could be seen in each figure.
As an improvement upon state transition Markov probability, the probability of entering the crisis regime Logit-EWMA(4) model gives an indifferent result from previous Markov-EWMA(4) model. More detailed insight could be seen in EWS picture of each country. The parameter of all models, which is EWMA (4), Markov-EWMA(4) and Logit-EWMA(4) could be seen in table 3 below. The difference of Markov-EWMA(4) model and Logit-EWMA(4) model is in the state transition probability while the other parameter is equal for both model.

Validity test of EWS model
Logically, there should be an increasing probability of crisis occurred while approaching the expected crisis period. To observe whether that phenomenon occur or not in ASEAN countries, further prediction model for this behavior is built with the algorithm below: 1) By taking the probability filter of entering crisis regime based on the threshold crisis defined, we could get the information of the initial month when stock index entering the crisis regime.
2) The probability value of entering the crisis regime on period of month t-1 to t-6 before entering the crisis period. If the amount of crisis is less then six months, for example three or five months, then the collection of crisis probability is also less than six months, or three to five period depends on the months available. 3) Then we regress the data of crisis probability as a dependent variable with time variable, one to six periods, as an explanatory variable. 4) P crisis (t) = α + βT(t) + ε(t) T=1,2,3,4,5,6 5) Based on the formula above, the relation between times to crisis probability is significantly negative.

Logit-EWMA(4)
Constant 0.777***   Using the same logic, we could develop the crisis signal cut off for the next three months. P crisis value is resulted from inserting T=3. This means the regression model above could also be the cut off function for period t-1 to t-6. Nevertheless, the test of predicting power EWS related with cut off issue could not be part of this research.
The validity test to measure the best EWS model is using the Mean Square Error (MSE) approach based on the crisis probability and the occurrence of crisis event based on the crisis threshold (1 when crisis occurred and 0 if other). But to reduce the mistakes of test model related to wrong samples, we could only use the observed data in the model above (the result is shown in table 3).
The result of trend regression and MSE test could be seen in table 4.

Conclusion
Using the stock index from 5 ASEAN countries, which is Singapore, Indonesia, Malaysia, Thailand and Philippines, this paper develops EWS as an anticipatory model of economic crisis event. The preference of stock index proxy could be a debatable issue. Stock index is a combination of every economic sector in one country, where it is possible to have a negative and positive correlation. This will eventually lead to bubble effect as an outcome of counter neutralizing of every up (and down) in stock sectoral price. However, by using this proxy, we were able to capture the fundamental shift of a country.
EWSs were built to predict the event of crisis three months ahead with three models, which is EWMA (4), Markov-EWMA(4), and Logit-EWMA(4). The implementation of EWMA (4) as a basic model of random variable y t was the second debatable issue. Hamilton (1989) use an AR (4) model by estimating the parameter model of AR(4) simultaneously along with mix normal distribution (two normal distribution with different parameter); by assuming the Markov probability is constant. Diebold et al. (1999) transforms Hamilton's (1989) assumption by using logit model on the state transition probabilities, and several other researches uses other random variables y t such as AR(1) model by Chauvet (1998), Dueker (1997 with model Markov-GARCH, Cai (2004) and Hamilton and Susmel (1994) with model Markov-ARCH(2) process, and Haas et al. (2004) who used model Markov-Mixed Normal GARCH (MN-GARCH).
From the plotting of actual data of stock index and crisis probability, we conclude that generally Markov-EWMA(4) model and Logit-EWMA(4) model could present a better result than EWMA(4). This means that the state transition probability are able to improve the probabilities of entering the crisis regime. The last issue was the definition of threshold line to give signal of crisis for three months ahead. The logical foundation in this paper is that the crisis probability was supposed to increase when approaching the crisis period.
By regressing the trend model of crisis probabilities six months prior to crisis event, we could obtained a model that is applicable as a cut off model, where this idea is more academically representable than the cut off threshold definition by Hamilton dan Engel (1990) dan Bussiere dan Fratzcher (2006).

Saherudin, Muhammad Budi Prasetyo, Imam Salehudin, and Abdur Rabbi for
any discussion conducted. All errors and opinions are of course our own.