# Modeling Chaotic Behavior of Chittagong Stock Indices

Authors: Shipra Banik; Mohammed Anwer; A. F. M. Khodadad Khan
Journal: Applied Computational Intelligence and Soft Computing
 (2012)

---

## Abstract

Stock market prediction is an important area of financial forecasting, which attracts great interest to stock buyers and sellers, stock investors, policy makers, applied researchers, and many others who are involved in the capital market. In this paper, a comparative study has been conducted to predict stock index values using soft computing models and time series model. Paying attention to the applied econometric noises because our considered series are time series, we predict Chittagong stock indices for the period from January 1, 2005 to May 5, 2011. We have used well-known models such as, the genetic algorithm (GA) model and the adaptive network fuzzy integrated system (ANFIS) model as soft computing forecasting models. Very widely used forecasting models in applied time series econometrics, namely, the generalized autoregressive conditional heteroscedastic (GARCH) model is considered as time series model. Our findings have revealed that the use of soft computing models is more successful than the considered time series model.


---

## Body

## 1. Introduction

The stock index values play an important role in controlling dynamics of the capital market. As a result, the appropriate prediction of stock index values is a crucial factor for domestic/foreign stock investors, buyers and/or sellers, fund managers, policy makers, applied researchers (who want to improve the model specifications of this index), and many others. Many researchers, for example, [1–4] and others have found that the empirical distribution of stock is significantly nonnormal and nonlinear. Stock market data are also observed in practice chaotic and volatile by nature (e.g., see [5–8]). That is why stock values are hard to predict. Traditionally, the fundamental Box-Jenkins analysis has been the mainstream methodology that is used to predict stock values in applied literature. Due to continual studies of stock market experts, the use of soft computing models (such as artificial neural networks, fuzzy set, evolutionary algorithms, and rough set theory.) have been widely established to forecast stock market. Evidence [9, 10] suggests that the Box-Jenkins approach often fails to predict time series when the behavior of series is chaotic and nonlinear. Thus, soft computing systems have emerged to increase the accuracy of chaotic time series predictions. The reason is that these systems have the potential to provide a viable solution through the versatile approach to self-organization. Thus, in forecasting literatures [11–14], it has been found that soft computing systems yield better results compared to the statistical time series approaches when the series is chaotic. This paper compares forecasts of stock prices from soft computing forecasting models and the model introduced by [15]. Our motivation for this comparison lies in the recent increasing interest in the use of soft computing models for forecasting purposes of economic and finance variables. Thus, soft computing models are used to learn the nonlinear and chaotic patterns in the stock system. Several studies [7, 11] have compared soft computing models and the traditional Box-Jenkins model. However, there are only a few comparative analyses (according to our knowledge) between soft computing models and standard time series statistical models [13] in case of Bangladeshi stock indices. In this paper, we examine the performance of the daily Chittagong stock market indices using soft computing models and time series model. See [13] for prediction of the daily Dhaka stock market index values. Thus, we hope that findings of the study will be interesting to fund managers, many businesses investors, policy makers, academics, and others who are involved in this volatile market. The structure of the paper is as follows: data and forecasting model is given in the next section. Statistical properties and various econometric noises are discussed in Section 3. A brief description of the considered forecasting models is described in Section 4. Performances of the different evaluation criterion are explained in Section 5. Finally, concluding remarks with some proposed future research are given in the final section.


## 2. Data and Forecasting Model

### 2.1. Data

The indices, the Chittagong Stock Exchange has been maintaining since  October 10 1995, are the stock prices for all companies (cse-all) and for 30 selected companies (cse-30). Thus, we considered the daily cse-all and cse-30 [data source:http://www.cse.com.bd/] prices for the available periods (January 1, 2005 to May 5, 2011). For a description of the indices, see the above website.It is true people trend to invest in stock market because it has high returns over time. Stock markets are generally affected by economic, social, political, and even psychological factors. These factors interact with each other in a very complicated manner. That is why stock data are observed, chaotic and volatile by nature. It is well known that chart is the best way to visualize trend and chaotic behavior if present in any price series. Thus, to understand the behaviors of considered indices, cse-all and cse-30 are plotted against time in Figure1. It is very clear that there is a decreasing trend with respect to time. There are some reasons why these sorts of trend exist. See http://www.cse.com.bd/ for details. It is also observable from this plot the behaviors of these selected price series are not linear. This means series can appear volatile with moves that look chaotic. Some sort of nonlinearity can also be present in the selected series.Figure 1
Time plots of the indices.


### 2.2. Forecasting Models

Since our series are time series, so we have selected the most commonly used time series model, namely, the autoregressive (AR) model of orderp. The model is defined for each of considered series as follows:
(1)cse-allt=α+βt+ρicse-allt-i+et,t=1,2,3,…,n,(2)cse-30t=α+βt+ρicse-30t-i+et,t=1,2,3,…,n,
where α is an intercept, β is the deterministic trend, t is the time variable, ρi are the lag orders of the AR(p) model, and et~N(0,σ2). The appropriate lags of the series are selected by the Bayesian Information Criterion (BIC). Other information criterions, for example, Akaike Information Criterion (AIC), Schwarz Information Criterion (SIC), and others can also be used to select the lag order of the AR components of our selected models. See Table 1 for data size and proposed AR(p) model.Table 1
Data description and proposed model.
Indices
Size
Proposed AR(p) model
cse-all
1540 × 1
AR(2)
cse-30
1540 × 1
AR(4)


## 2.1. Data

The indices, the Chittagong Stock Exchange has been maintaining since  October 10 1995, are the stock prices for all companies (cse-all) and for 30 selected companies (cse-30). Thus, we considered the daily cse-all and cse-30 [data source:http://www.cse.com.bd/] prices for the available periods (January 1, 2005 to May 5, 2011). For a description of the indices, see the above website.It is true people trend to invest in stock market because it has high returns over time. Stock markets are generally affected by economic, social, political, and even psychological factors. These factors interact with each other in a very complicated manner. That is why stock data are observed, chaotic and volatile by nature. It is well known that chart is the best way to visualize trend and chaotic behavior if present in any price series. Thus, to understand the behaviors of considered indices, cse-all and cse-30 are plotted against time in Figure1. It is very clear that there is a decreasing trend with respect to time. There are some reasons why these sorts of trend exist. See http://www.cse.com.bd/ for details. It is also observable from this plot the behaviors of these selected price series are not linear. This means series can appear volatile with moves that look chaotic. Some sort of nonlinearity can also be present in the selected series.Figure 1
Time plots of the indices.


## 2.2. Forecasting Models

Since our series are time series, so we have selected the most commonly used time series model, namely, the autoregressive (AR) model of orderp. The model is defined for each of considered series as follows:
(1)cse-allt=α+βt+ρicse-allt-i+et,t=1,2,3,…,n,(2)cse-30t=α+βt+ρicse-30t-i+et,t=1,2,3,…,n,
where α is an intercept, β is the deterministic trend, t is the time variable, ρi are the lag orders of the AR(p) model, and et~N(0,σ2). The appropriate lags of the series are selected by the Bayesian Information Criterion (BIC). Other information criterions, for example, Akaike Information Criterion (AIC), Schwarz Information Criterion (SIC), and others can also be used to select the lag order of the AR components of our selected models. See Table 1 for data size and proposed AR(p) model.Table 1
Data description and proposed model.
Indices
Size
Proposed AR(p) model
cse-all
1540 × 1
AR(2)
cse-30
1540 × 1
AR(4)


## 3. Statistical Properties of Data

### 3.1. Numerical Summary

To understand the characteristics of the selected indices, summary statistics are tabulated in Table2. It is clear from the above table, most of times, that cse-all and cse-30 indices are observed 8691 and 7259.9, respectively. Standard deviation measures confirm to us that the considered prices are not equal to 8691 and 7259.9. The expected range of cse-all and cse-30 prices can be estimated as 8691±5883.3 and 7259.9±4668.6, respectively. Skewness measures indicate to us that stock market indices display right skewed distributions. It means that most of prices are below the average prices. Kurtosis measures also indicate to us that price indices are not normal.Table 2
Numerical properties of the selected indices.
Indices
Mean
Median
Standard deviation
Skewness
Kurtosis
cse-all
8.6916e + 003
7.6318e + 003
5.8833e + 003
0.5404
2.9063
cse-30
7.2599e + 003
6.5434e + 003
4.6686e + 003
0.4604
3.6754


### 3.2. Time Series Properties

It is now a well-established stylized fact that most time series are nonstationary and contain a unit root (e.g., see [14]). The conventional approach of time series is based on the implicit assumption that the underlying data series is stationary. This assumption was rarely questioned until the early 1970s and numerical analysis proceeded if all-time series were stationary. Numerous studies (e.g., [14–16] and many others) have suggested that most time series are nonstationary and therefore, the assumption of stationarity is unrealistic. Thus, prior to model specifications and the estimations, the stationary property of the data series is routinely tested. Otherwise, the study can yield unrealistic results. That is why to select appropriate forecasting model for our study, we have tested first stationarity property of the considered series.


#### 3.2.1. Stationarity Tests

There are many stationarity tests available in time series literature. For details, see [17–19] and others. To test the nonstationarity behavior of our considered models (1)-(2), we have used most commonly applied unit root tests, namely, the Augmented Dickey Fuller (ADF) test proposed by Said and Dickey [20] and the test proposed by Phillips and Perron (PP) [21]. For test procedures, see [17]. MATLAB commands that Adftest and pptest are used to compute the ADF and the PP statistics and results are reported in Table 3. Note that under the null hypothesis of the ADF and PP tests the series assumed nonstationary and that under the alternative hypothesis the series is stationary. Results show us all series are nonstationary (because Pvalue>α,α=0.05). Thus, null hypothesis of the tests is accepted. Then we have taken the first difference of the series to remove non-stationarity and applied then again the ADF test and the PP test. These test results show us in first differences that considered series are stationary. These results are not reported for spaces but are available on request. The effect of these tests will be shown when our forecasting model is used, the model is used in first differences.Table 3
Stationarity test results.
Indices
ADF(p) statistic
P value (critical value) for the ADF test
PP(L) statistic
P value (critical value) for the PP test
cse-all
−0.9888(2)
0.9434(−3.4144)
−1.13(12)
0.9227(−3.4144)
cse-30
−1.2330(4)
0.9022(−3.4144)
−1.29(10)
0.8877(−3.4144)
“p” and “L” indicate lag order to remove serial correlation.
Decision rule: IfP value < level of significance (α), then accept null hypothesis.


### 3.3. Linearity Test

There are many statistical techniques available in literature to test whether the series is linear or nonlinear. To select appropriate forecasting method, we have tested also linearity of the considered models (1) and (2). These tests are based on the ordinary least square method residuals. The statistical test proposed by Engle [5] is used to test the presence of nonlinear dependence. For details of the test procedure, see [22]. Linearity test results are tabulated in Table 4. Results show that at the 5% level of significance (α), nonlinearity is present (check the P-value) in our considered series. Just a note here under the null hypothesis, the series are considered linear and under the alternative hypothesis, the series are considered nonlinear. Table 4 results show us P-value is less than α which indicates rejection of the null hypothesis. So Table 4 results confirm to us that our considered series are nonlinear.Table 4
Linearity test results.
Indices
cse-all
cse-30
Engle test statistic
53.52
54.35
P value
0.0
0.0


## 3.1. Numerical Summary

To understand the characteristics of the selected indices, summary statistics are tabulated in Table2. It is clear from the above table, most of times, that cse-all and cse-30 indices are observed 8691 and 7259.9, respectively. Standard deviation measures confirm to us that the considered prices are not equal to 8691 and 7259.9. The expected range of cse-all and cse-30 prices can be estimated as 8691±5883.3 and 7259.9±4668.6, respectively. Skewness measures indicate to us that stock market indices display right skewed distributions. It means that most of prices are below the average prices. Kurtosis measures also indicate to us that price indices are not normal.Table 2
Numerical properties of the selected indices.
Indices
Mean
Median
Standard deviation
Skewness
Kurtosis
cse-all
8.6916e + 003
7.6318e + 003
5.8833e + 003
0.5404
2.9063
cse-30
7.2599e + 003
6.5434e + 003
4.6686e + 003
0.4604
3.6754


## 3.2. Time Series Properties

It is now a well-established stylized fact that most time series are nonstationary and contain a unit root (e.g., see [14]). The conventional approach of time series is based on the implicit assumption that the underlying data series is stationary. This assumption was rarely questioned until the early 1970s and numerical analysis proceeded if all-time series were stationary. Numerous studies (e.g., [14–16] and many others) have suggested that most time series are nonstationary and therefore, the assumption of stationarity is unrealistic. Thus, prior to model specifications and the estimations, the stationary property of the data series is routinely tested. Otherwise, the study can yield unrealistic results. That is why to select appropriate forecasting model for our study, we have tested first stationarity property of the considered series.


### 3.2.1. Stationarity Tests

There are many stationarity tests available in time series literature. For details, see [17–19] and others. To test the nonstationarity behavior of our considered models (1)-(2), we have used most commonly applied unit root tests, namely, the Augmented Dickey Fuller (ADF) test proposed by Said and Dickey [20] and the test proposed by Phillips and Perron (PP) [21]. For test procedures, see [17]. MATLAB commands that Adftest and pptest are used to compute the ADF and the PP statistics and results are reported in Table 3. Note that under the null hypothesis of the ADF and PP tests the series assumed nonstationary and that under the alternative hypothesis the series is stationary. Results show us all series are nonstationary (because Pvalue>α,α=0.05). Thus, null hypothesis of the tests is accepted. Then we have taken the first difference of the series to remove non-stationarity and applied then again the ADF test and the PP test. These test results show us in first differences that considered series are stationary. These results are not reported for spaces but are available on request. The effect of these tests will be shown when our forecasting model is used, the model is used in first differences.Table 3
Stationarity test results.
Indices
ADF(p) statistic
P value (critical value) for the ADF test
PP(L) statistic
P value (critical value) for the PP test
cse-all
−0.9888(2)
0.9434(−3.4144)
−1.13(12)
0.9227(−3.4144)
cse-30
−1.2330(4)
0.9022(−3.4144)
−1.29(10)
0.8877(−3.4144)
“p” and “L” indicate lag order to remove serial correlation.
Decision rule: IfP value < level of significance (α), then accept null hypothesis.


## 3.2.1. Stationarity Tests

There are many stationarity tests available in time series literature. For details, see [17–19] and others. To test the nonstationarity behavior of our considered models (1)-(2), we have used most commonly applied unit root tests, namely, the Augmented Dickey Fuller (ADF) test proposed by Said and Dickey [20] and the test proposed by Phillips and Perron (PP) [21]. For test procedures, see [17]. MATLAB commands that Adftest and pptest are used to compute the ADF and the PP statistics and results are reported in Table 3. Note that under the null hypothesis of the ADF and PP tests the series assumed nonstationary and that under the alternative hypothesis the series is stationary. Results show us all series are nonstationary (because Pvalue>α,α=0.05). Thus, null hypothesis of the tests is accepted. Then we have taken the first difference of the series to remove non-stationarity and applied then again the ADF test and the PP test. These test results show us in first differences that considered series are stationary. These results are not reported for spaces but are available on request. The effect of these tests will be shown when our forecasting model is used, the model is used in first differences.Table 3
Stationarity test results.
Indices
ADF(p) statistic
P value (critical value) for the ADF test
PP(L) statistic
P value (critical value) for the PP test
cse-all
−0.9888(2)
0.9434(−3.4144)
−1.13(12)
0.9227(−3.4144)
cse-30
−1.2330(4)
0.9022(−3.4144)
−1.29(10)
0.8877(−3.4144)
“p” and “L” indicate lag order to remove serial correlation.
Decision rule: IfP value < level of significance (α), then accept null hypothesis.


## 3.3. Linearity Test

There are many statistical techniques available in literature to test whether the series is linear or nonlinear. To select appropriate forecasting method, we have tested also linearity of the considered models (1) and (2). These tests are based on the ordinary least square method residuals. The statistical test proposed by Engle [5] is used to test the presence of nonlinear dependence. For details of the test procedure, see [22]. Linearity test results are tabulated in Table 4. Results show that at the 5% level of significance (α), nonlinearity is present (check the P-value) in our considered series. Just a note here under the null hypothesis, the series are considered linear and under the alternative hypothesis, the series are considered nonlinear. Table 4 results show us P-value is less than α which indicates rejection of the null hypothesis. So Table 4 results confirm to us that our considered series are nonlinear.Table 4
Linearity test results.
Indices
cse-all
cse-30
Engle test statistic
53.52
54.35
P value
0.0
0.0


## 4. Models Used for Prediction

Considered statistical tests results show that our selected series are nonstationary, nonlinear, and chaotic (Figure1). To remove nonstationarity, we used the series in first differences. We have selected nonlinear forecasting models to forecast Chittagong stock indices, which has also the ability to capture chaotic behavior. We have chosen the following models to forecast considered indices. A brief description of the considered forecasting models is given below.


### 4.1. Soft Computing Model

We have chosen two very popular and widely used models, namely, the genetic algorithm (GA) model and the neuro-fuzzy model.


#### 4.1.1. GA Model

Holland [23] introduces this technique. It is a technique based on the “Darwin’s Principle of Natural Selection” and is used to solve optimization problems. The basic idea is to select the best, discard the rest. To handle the complex multidimensional behaviors of a system, this approach has been used efficiently in forecasting literature (e.g., [23–26] and others). See Figure 2, for the flowchart that illustrates the basic steps in a GA. See Table 5, for the standard GA options. A brief explanation of each step is as follows.Table 5
GA options.
Step
Algorithm option
Creation
Uniform, normal
Fitness scaling
Rank, proportional, top (truncation), linear scaling, shift
Selection
Roulette, stochastic uniform selection, tournament, uniform
Crossover
Binary-valued (single-point, two-point,n-point, uniform) real-valued (intermediate, line)
Mutation
Gaussian, uniform
Reinsertion
Pure, uniform, elitist, fitness-basedFigure 2
Flowchart of a GA model.Step 1.
Create an initial population consisting of random chromosomes. To understand the GA process, for example, for an AR(2) model, consider the following random population of 6 chromosomes with 4 parameters each: (0.13, 0.01, 0.84, 0.68), (0.20, 0.74, 0.52, 0.37), (0.19, 0.44, 0.20, 0.83), (0.60, 0.93, 0.67, 0.50), (0.27, 0.46, 0.83, 0.70), and (0.19, 0.41, 0.01, 0.42). Population size is chosen usually from 100–500. Larger population may produce more robust solution.Step 2.
Fitness scaling is used to provide a measure of how selected chromosomes perform in the problem domain. The AR(2) model fitness is evaluated through a criterion like RMSE (CC, MAE can be also used). For the AR(2) model, we get RMSE: 26.19, 32.09, 53.75, 20.18, 18.67, and 66.64. Using the linear-ranking process, for example, (details, see Pohlheim [27]), Fit(RMSE): 1.2, 0.8, 0.4, 1.6, 2.0, 0.Step 3.
Based on Step2 results, choose parents for the next generation. To understand it, consider the distribution found in Tables 5 and 6.
It is observed that chromosome 5 is the fittest chromosome, because it occupies the largest interval, whereas chromosome 3 is the second least fit chromosome as the smallest interval. Chromosome 6 is the least fit interval that has a fitness value of 0 and gets no chance for reproduction. Using for example, the roulette wheel method (purpose is to eliminate the worst chromosomes and to regenerate better substitutes), selected 4 parents are: (0.20, 0.74, 0.52, 0.37), (0.13, 0.01, 0.84, 0.68), (0.27, 0.46, 0.83, 0.70), and (0.13, 0.01, 0.84, 0.68).
Next step is to produce offspring from selected parents by combining entries of a pair of parents (known as crossover) and also by making random changes to a single parent (known as mutation).Table 6
RMSE:
26.19
32.09
53.75
20.18
18.67
66.64
Fit (RMSE):
1.2
0.8
0.4
1.6
2.0
0
pdf of RMSE:
0.2
0.13
0.06
0.26
0.33
0
cdf of RMSE:
0.2
0.33
0.39
0.65
0.98
1.0Step 4 (GA operator-1).
Basic operator for producing new (improved) chromosomes is known as crossover (a version of artificial mating). It produces offspring that have some parts of both parents genetic material. Offspring are produced using the intermediate crossover method, because this is a method proposed to recombine for parents with real-valued chromosomes (see details, Pohlheim [27]). Thus, crossover offspring are (0.16, 0.16, 0.85, 0.57), (0.13, 0.22, 0.76, 0.43), (0.13, 0.15, 0.83, 0.69), and (0.26, 0.45, 0.84, 0.68).Step 5 (GA operator-2).
Offspring are mutated after producing crossover offspring and this GA operator increases the chance that the algorithm will generate better fittest RMSE than the Step4. GA creates 3 types of offspring: elite offspring (number of best RMSE values in the current generation that are guaranteed to survive to the next generation), crossover offspring, and mutation offspring. To understand it, consider an example: suppose that the population size is 20 and the elite count is 2. If crossover fraction is 0.8, then the distribution of offspring is 2 elites, 14 (18*0.8) are crossover offspring, and the remaining 4 are mutation offspring. Just to know, a crossover fraction of 1 means all offspring other than elite are crossover offspring, while a crossover fraction of 0 means that all offspring are mutation offspring. How offspring are produced under the mutation process, see Pohlheim [27]. The mutation offspring are found (0.16, 0.17, 0.85, 0.56), (0.13, 0.22, 0.76, 0.43), (0.13, 0.14, 0.83, 0.69), (0.26, 0.45, 0.84, 0.68), respectively.Step 6.
Once offspring have been produced using Steps4–5, offspring fitness (i.e., RMSE values) must be determined (procedure similar to Step 2). We get improved RMSE: 23.37, 28.13, 24.11,18.62.
If less offspring are produced than the original population size, then to maintain size, offspring have to be reinserted into the old population. By this step, it is determined which chromosomes will be replaced by offspring. Using for example, the fitness-based reinsertion method, the following RMSE are found: 20.18, 18.67, 18.62, 23.37, 24.11, and 28.13.
If termination criteria are not defined, GA returns to Step3 and continues up to Step 6. It is satisfied when either maximum number of generations is achieved or when all chromosomes in the population are identical (i.e., converge). The creator sets this number before running GA, which ensures that GA does not continue indefinitely.


#### 4.1.2. Adaptive Network Fuzzy Integrated System (ANFIS) Model

The second widely used soft computing model we have selected is the ANFIS model. In computing the literature, Jang [8] proposed this model. This model is a combination of two intelligence systems: neural network (NN) system and fuzzy inference system (FIS). This is also known as NN-fuzzy integrated system, where the NN learning algorithm is used to determine parameters of FIS. NNs are nonlinear statistical data modeling tools and can capture and model any input-output relationships. FIS is the process of formulating the mapping from a given input to an output using the fuzzy logic. This mapping provides a basis from which decisions can be made or patterns can be discerned. The process of FIS involves membership functions (mfs), fuzzy logic operators, and if-then rules. The structure of ANFIS (see Figure 3 for its architecture) has 5 layers: (a) 1 input layer, (b) 3 hidden layers that represents mfs and fuzzy rules, and (c) 1 output layer. ANFIS uses the Sugeno-fuzzy inference model to be the learning algorithm. As an example, the fuzzy if-then rules for the first-order Sugeno-fuzzy model can be expressed as follows.Figure 3
AN ANFIS system.Rule 1.
Ifx (input 1) is A1 and y (input 2) is B1, then f1 (output) =p1x+q1y+r1.Rule 2.
Ifx (input 1) is A2 and y (input 2) is B2, then f2 (output) =p2x+q2y+r2.The learning algorithm of ANFIS is a hybrid algorithm, which combines the gradient descent (GD) method and the least square estimation (LSE) for an effective search of parameters. ANFIS uses a two-pass of learning algorithm to reduce error: forward pass and backward pass. The hidden layer is computed by the GD method of the feedback structure and the final output is estimated by the LSE method (for details, see [8]).


### 4.2. Time Series Model: GARCH Model

Since our considered series are time series, to compare the performances of the soft computing models, a very popular time series model, namely, generalized autoregressive conditional heteroscedastic (GARCH) model is selected from time series econometrics literature. A brief description of this model is discussed.In 1986, Bollerslev invented the GARCH model. To understand it clearly, consider an AR(1) model:(3)stockpricet=Constant+stockpricet-1+et,+et,+et,t+et,+ett=1,2,…,n,
where stockpricet is the observed cse-all and cse-30 prices. Here, the current volatility depends not only on the past errors, but also on the past volatilities. Suppose et=εtσt, where σt=β0+∑i=1qβiet-i2+∑j=1pγjσt-j  with  β0>0,βi≥0(i=1,2,…,q),γj≥0(j=1,2,…,p), and εt~N(0,1), known as an GARCH process of orders p and q. This model is widely used to know the volatility nature that exists generally in the time series data. For details, see [6].


## 4.1. Soft Computing Model

We have chosen two very popular and widely used models, namely, the genetic algorithm (GA) model and the neuro-fuzzy model.


### 4.1.1. GA Model

Holland [23] introduces this technique. It is a technique based on the “Darwin’s Principle of Natural Selection” and is used to solve optimization problems. The basic idea is to select the best, discard the rest. To handle the complex multidimensional behaviors of a system, this approach has been used efficiently in forecasting literature (e.g., [23–26] and others). See Figure 2, for the flowchart that illustrates the basic steps in a GA. See Table 5, for the standard GA options. A brief explanation of each step is as follows.Table 5
GA options.
Step
Algorithm option
Creation
Uniform, normal
Fitness scaling
Rank, proportional, top (truncation), linear scaling, shift
Selection
Roulette, stochastic uniform selection, tournament, uniform
Crossover
Binary-valued (single-point, two-point,n-point, uniform) real-valued (intermediate, line)
Mutation
Gaussian, uniform
Reinsertion
Pure, uniform, elitist, fitness-basedFigure 2
Flowchart of a GA model.Step 1.
Create an initial population consisting of random chromosomes. To understand the GA process, for example, for an AR(2) model, consider the following random population of 6 chromosomes with 4 parameters each: (0.13, 0.01, 0.84, 0.68), (0.20, 0.74, 0.52, 0.37), (0.19, 0.44, 0.20, 0.83), (0.60, 0.93, 0.67, 0.50), (0.27, 0.46, 0.83, 0.70), and (0.19, 0.41, 0.01, 0.42). Population size is chosen usually from 100–500. Larger population may produce more robust solution.Step 2.
Fitness scaling is used to provide a measure of how selected chromosomes perform in the problem domain. The AR(2) model fitness is evaluated through a criterion like RMSE (CC, MAE can be also used). For the AR(2) model, we get RMSE: 26.19, 32.09, 53.75, 20.18, 18.67, and 66.64. Using the linear-ranking process, for example, (details, see Pohlheim [27]), Fit(RMSE): 1.2, 0.8, 0.4, 1.6, 2.0, 0.Step 3.
Based on Step2 results, choose parents for the next generation. To understand it, consider the distribution found in Tables 5 and 6.
It is observed that chromosome 5 is the fittest chromosome, because it occupies the largest interval, whereas chromosome 3 is the second least fit chromosome as the smallest interval. Chromosome 6 is the least fit interval that has a fitness value of 0 and gets no chance for reproduction. Using for example, the roulette wheel method (purpose is to eliminate the worst chromosomes and to regenerate better substitutes), selected 4 parents are: (0.20, 0.74, 0.52, 0.37), (0.13, 0.01, 0.84, 0.68), (0.27, 0.46, 0.83, 0.70), and (0.13, 0.01, 0.84, 0.68).
Next step is to produce offspring from selected parents by combining entries of a pair of parents (known as crossover) and also by making random changes to a single parent (known as mutation).Table 6
RMSE:
26.19
32.09
53.75
20.18
18.67
66.64
Fit (RMSE):
1.2
0.8
0.4
1.6
2.0
0
pdf of RMSE:
0.2
0.13
0.06
0.26
0.33
0
cdf of RMSE:
0.2
0.33
0.39
0.65
0.98
1.0Step 4 (GA operator-1).
Basic operator for producing new (improved) chromosomes is known as crossover (a version of artificial mating). It produces offspring that have some parts of both parents genetic material. Offspring are produced using the intermediate crossover method, because this is a method proposed to recombine for parents with real-valued chromosomes (see details, Pohlheim [27]). Thus, crossover offspring are (0.16, 0.16, 0.85, 0.57), (0.13, 0.22, 0.76, 0.43), (0.13, 0.15, 0.83, 0.69), and (0.26, 0.45, 0.84, 0.68).Step 5 (GA operator-2).
Offspring are mutated after producing crossover offspring and this GA operator increases the chance that the algorithm will generate better fittest RMSE than the Step4. GA creates 3 types of offspring: elite offspring (number of best RMSE values in the current generation that are guaranteed to survive to the next generation), crossover offspring, and mutation offspring. To understand it, consider an example: suppose that the population size is 20 and the elite count is 2. If crossover fraction is 0.8, then the distribution of offspring is 2 elites, 14 (18*0.8) are crossover offspring, and the remaining 4 are mutation offspring. Just to know, a crossover fraction of 1 means all offspring other than elite are crossover offspring, while a crossover fraction of 0 means that all offspring are mutation offspring. How offspring are produced under the mutation process, see Pohlheim [27]. The mutation offspring are found (0.16, 0.17, 0.85, 0.56), (0.13, 0.22, 0.76, 0.43), (0.13, 0.14, 0.83, 0.69), (0.26, 0.45, 0.84, 0.68), respectively.Step 6.
Once offspring have been produced using Steps4–5, offspring fitness (i.e., RMSE values) must be determined (procedure similar to Step 2). We get improved RMSE: 23.37, 28.13, 24.11,18.62.
If less offspring are produced than the original population size, then to maintain size, offspring have to be reinserted into the old population. By this step, it is determined which chromosomes will be replaced by offspring. Using for example, the fitness-based reinsertion method, the following RMSE are found: 20.18, 18.67, 18.62, 23.37, 24.11, and 28.13.
If termination criteria are not defined, GA returns to Step3 and continues up to Step 6. It is satisfied when either maximum number of generations is achieved or when all chromosomes in the population are identical (i.e., converge). The creator sets this number before running GA, which ensures that GA does not continue indefinitely.


### 4.1.2. Adaptive Network Fuzzy Integrated System (ANFIS) Model

The second widely used soft computing model we have selected is the ANFIS model. In computing the literature, Jang [8] proposed this model. This model is a combination of two intelligence systems: neural network (NN) system and fuzzy inference system (FIS). This is also known as NN-fuzzy integrated system, where the NN learning algorithm is used to determine parameters of FIS. NNs are nonlinear statistical data modeling tools and can capture and model any input-output relationships. FIS is the process of formulating the mapping from a given input to an output using the fuzzy logic. This mapping provides a basis from which decisions can be made or patterns can be discerned. The process of FIS involves membership functions (mfs), fuzzy logic operators, and if-then rules. The structure of ANFIS (see Figure 3 for its architecture) has 5 layers: (a) 1 input layer, (b) 3 hidden layers that represents mfs and fuzzy rules, and (c) 1 output layer. ANFIS uses the Sugeno-fuzzy inference model to be the learning algorithm. As an example, the fuzzy if-then rules for the first-order Sugeno-fuzzy model can be expressed as follows.Figure 3
AN ANFIS system.Rule 1.
Ifx (input 1) is A1 and y (input 2) is B1, then f1 (output) =p1x+q1y+r1.Rule 2.
Ifx (input 1) is A2 and y (input 2) is B2, then f2 (output) =p2x+q2y+r2.The learning algorithm of ANFIS is a hybrid algorithm, which combines the gradient descent (GD) method and the least square estimation (LSE) for an effective search of parameters. ANFIS uses a two-pass of learning algorithm to reduce error: forward pass and backward pass. The hidden layer is computed by the GD method of the feedback structure and the final output is estimated by the LSE method (for details, see [8]).


## 4.1.1. GA Model

Holland [23] introduces this technique. It is a technique based on the “Darwin’s Principle of Natural Selection” and is used to solve optimization problems. The basic idea is to select the best, discard the rest. To handle the complex multidimensional behaviors of a system, this approach has been used efficiently in forecasting literature (e.g., [23–26] and others). See Figure 2, for the flowchart that illustrates the basic steps in a GA. See Table 5, for the standard GA options. A brief explanation of each step is as follows.Table 5
GA options.
Step
Algorithm option
Creation
Uniform, normal
Fitness scaling
Rank, proportional, top (truncation), linear scaling, shift
Selection
Roulette, stochastic uniform selection, tournament, uniform
Crossover
Binary-valued (single-point, two-point,n-point, uniform) real-valued (intermediate, line)
Mutation
Gaussian, uniform
Reinsertion
Pure, uniform, elitist, fitness-basedFigure 2
Flowchart of a GA model.Step 1.
Create an initial population consisting of random chromosomes. To understand the GA process, for example, for an AR(2) model, consider the following random population of 6 chromosomes with 4 parameters each: (0.13, 0.01, 0.84, 0.68), (0.20, 0.74, 0.52, 0.37), (0.19, 0.44, 0.20, 0.83), (0.60, 0.93, 0.67, 0.50), (0.27, 0.46, 0.83, 0.70), and (0.19, 0.41, 0.01, 0.42). Population size is chosen usually from 100–500. Larger population may produce more robust solution.Step 2.
Fitness scaling is used to provide a measure of how selected chromosomes perform in the problem domain. The AR(2) model fitness is evaluated through a criterion like RMSE (CC, MAE can be also used). For the AR(2) model, we get RMSE: 26.19, 32.09, 53.75, 20.18, 18.67, and 66.64. Using the linear-ranking process, for example, (details, see Pohlheim [27]), Fit(RMSE): 1.2, 0.8, 0.4, 1.6, 2.0, 0.Step 3.
Based on Step2 results, choose parents for the next generation. To understand it, consider the distribution found in Tables 5 and 6.
It is observed that chromosome 5 is the fittest chromosome, because it occupies the largest interval, whereas chromosome 3 is the second least fit chromosome as the smallest interval. Chromosome 6 is the least fit interval that has a fitness value of 0 and gets no chance for reproduction. Using for example, the roulette wheel method (purpose is to eliminate the worst chromosomes and to regenerate better substitutes), selected 4 parents are: (0.20, 0.74, 0.52, 0.37), (0.13, 0.01, 0.84, 0.68), (0.27, 0.46, 0.83, 0.70), and (0.13, 0.01, 0.84, 0.68).
Next step is to produce offspring from selected parents by combining entries of a pair of parents (known as crossover) and also by making random changes to a single parent (known as mutation).Table 6
RMSE:
26.19
32.09
53.75
20.18
18.67
66.64
Fit (RMSE):
1.2
0.8
0.4
1.6
2.0
0
pdf of RMSE:
0.2
0.13
0.06
0.26
0.33
0
cdf of RMSE:
0.2
0.33
0.39
0.65
0.98
1.0Step 4 (GA operator-1).
Basic operator for producing new (improved) chromosomes is known as crossover (a version of artificial mating). It produces offspring that have some parts of both parents genetic material. Offspring are produced using the intermediate crossover method, because this is a method proposed to recombine for parents with real-valued chromosomes (see details, Pohlheim [27]). Thus, crossover offspring are (0.16, 0.16, 0.85, 0.57), (0.13, 0.22, 0.76, 0.43), (0.13, 0.15, 0.83, 0.69), and (0.26, 0.45, 0.84, 0.68).Step 5 (GA operator-2).
Offspring are mutated after producing crossover offspring and this GA operator increases the chance that the algorithm will generate better fittest RMSE than the Step4. GA creates 3 types of offspring: elite offspring (number of best RMSE values in the current generation that are guaranteed to survive to the next generation), crossover offspring, and mutation offspring. To understand it, consider an example: suppose that the population size is 20 and the elite count is 2. If crossover fraction is 0.8, then the distribution of offspring is 2 elites, 14 (18*0.8) are crossover offspring, and the remaining 4 are mutation offspring. Just to know, a crossover fraction of 1 means all offspring other than elite are crossover offspring, while a crossover fraction of 0 means that all offspring are mutation offspring. How offspring are produced under the mutation process, see Pohlheim [27]. The mutation offspring are found (0.16, 0.17, 0.85, 0.56), (0.13, 0.22, 0.76, 0.43), (0.13, 0.14, 0.83, 0.69), (0.26, 0.45, 0.84, 0.68), respectively.Step 6.
Once offspring have been produced using Steps4–5, offspring fitness (i.e., RMSE values) must be determined (procedure similar to Step 2). We get improved RMSE: 23.37, 28.13, 24.11,18.62.
If less offspring are produced than the original population size, then to maintain size, offspring have to be reinserted into the old population. By this step, it is determined which chromosomes will be replaced by offspring. Using for example, the fitness-based reinsertion method, the following RMSE are found: 20.18, 18.67, 18.62, 23.37, 24.11, and 28.13.
If termination criteria are not defined, GA returns to Step3 and continues up to Step 6. It is satisfied when either maximum number of generations is achieved or when all chromosomes in the population are identical (i.e., converge). The creator sets this number before running GA, which ensures that GA does not continue indefinitely.


## 4.1.2. Adaptive Network Fuzzy Integrated System (ANFIS) Model

The second widely used soft computing model we have selected is the ANFIS model. In computing the literature, Jang [8] proposed this model. This model is a combination of two intelligence systems: neural network (NN) system and fuzzy inference system (FIS). This is also known as NN-fuzzy integrated system, where the NN learning algorithm is used to determine parameters of FIS. NNs are nonlinear statistical data modeling tools and can capture and model any input-output relationships. FIS is the process of formulating the mapping from a given input to an output using the fuzzy logic. This mapping provides a basis from which decisions can be made or patterns can be discerned. The process of FIS involves membership functions (mfs), fuzzy logic operators, and if-then rules. The structure of ANFIS (see Figure 3 for its architecture) has 5 layers: (a) 1 input layer, (b) 3 hidden layers that represents mfs and fuzzy rules, and (c) 1 output layer. ANFIS uses the Sugeno-fuzzy inference model to be the learning algorithm. As an example, the fuzzy if-then rules for the first-order Sugeno-fuzzy model can be expressed as follows.Figure 3
AN ANFIS system.Rule 1.
Ifx (input 1) is A1 and y (input 2) is B1, then f1 (output) =p1x+q1y+r1.Rule 2.
Ifx (input 1) is A2 and y (input 2) is B2, then f2 (output) =p2x+q2y+r2.The learning algorithm of ANFIS is a hybrid algorithm, which combines the gradient descent (GD) method and the least square estimation (LSE) for an effective search of parameters. ANFIS uses a two-pass of learning algorithm to reduce error: forward pass and backward pass. The hidden layer is computed by the GD method of the feedback structure and the final output is estimated by the LSE method (for details, see [8]).


## 4.2. Time Series Model: GARCH Model

Since our considered series are time series, to compare the performances of the soft computing models, a very popular time series model, namely, generalized autoregressive conditional heteroscedastic (GARCH) model is selected from time series econometrics literature. A brief description of this model is discussed.In 1986, Bollerslev invented the GARCH model. To understand it clearly, consider an AR(1) model:(3)stockpricet=Constant+stockpricet-1+et,+et,+et,t+et,+ett=1,2,…,n,
where stockpricet is the observed cse-all and cse-30 prices. Here, the current volatility depends not only on the past errors, but also on the past volatilities. Suppose et=εtσt, where σt=β0+∑i=1qβiet-i2+∑j=1pγjσt-j  with  β0>0,βi≥0(i=1,2,…,q),γj≥0(j=1,2,…,p), and εt~N(0,1), known as an GARCH process of orders p and q. This model is widely used to know the volatility nature that exists generally in the time series data. For details, see [6].


## 5. Discussion of Results

Forecasting with 100% accuracy may be impossible, but we can do our best to reduce forecasting errors. Thus, to find the error level between observed and predicted stock series that means the forecasting performances of the considered models are evaluated against the following widely used statistical measures, namely, root mean square error (RMSE), correlation coefficient (CC), and coefficient of determination(R2).Note that a smallest value of RMSE indicates higher accuracy in forecasting, and higherR2 value indicates better prediction. All computational works were carried out using the programming code of MATLAB (version 7.0). We have selected January 1, 2005 to January 1, 2009 as the training periods and rest of periods as the testing periods. See Table 7 for computational parameters for all selected forecasting models. Tables 8 and 9 summarize the performances of different considered forecasting models where the training and testing data are achieved for prediction of stock values using the considered error measures RMSE, CC, and R2. In terms of all measures, our training results show that for the cse-all price series, the GA forecasting model performed better (noted smallest RMSE values, highest CC, and R2 values) than other forecasting models, followed by the ANFIS forecasting model and the GARCH forecasting model. For the cse-30 series, we found that the ANFIS forecasting model performed better than the other forecasting models. After the models are built using the training data, considered series forecasted over the testing data and performances are reported in Table 9. The testing results when compared to our considered forecasting models show again that the daily cse-all price series forecasting ability of the GA forecasting model is higher than the other forecasting models. We noted for the cse-30 price index, the ANFIS forecasting model performed (lowest value of RMSE, highest values of CC and R2) better than the other forecasting models.Table 7
Computational settings for selected forecasting models.
GA
ANFIS
GARCH
(1) Population size—3000, generated at random from the uniform probability distribution.
(1) Input—Lags of cse-all and cse-30
cse-all and cse-30: Fitted GARCH (2,1) and GARCH (1,1) Selection Process: BIC.
(2) Fitness function—RMSE of model (2.2.1-2.2.2); Fitness scaling—Linear ranking process.
(2) 2 mfs (type Gaussian) for each of input variables. Thus, 8 if-then fuzzy rules were learned.
(3) Selection-Roulette wheel.
(4) Crossover-fraction: 0.95; Intermediate method.
(5) Mutation-fraction: 0.05; Uniform method.
(6) Reinsertion: The fitness-based reinsertion method.
(7) Termination Criteria—Maximum number of generations, assumed 200.Table 8
Performances for training data.
Forecasting models
cse-all
cse-30
RMSE
CC
R
2
RMSE
CC
R
2
GA
6.79
0.94
0.88
6.95
0.91
0.82
ANFIS
6.89
0.93
0.86
6.83
0.92
0.84
GARCH
7.34
0.91
0.82
7.56
0.88
0.77
Note: We considered January 1, 2005 to January 1, 2009 as a training period.Table 9
Performances for testing data.
Forecasting models
cse-all
cse-30
RMSE
CC
R
2
RMSE
CC
R
2
GA
5.37
0.96
0.92
6.48
0.94
0.88
ANFIS
6.93
0.94
0.88
5.59
0.97
0.94
GARCH
8.58
0.89
0.79
7.89
0.90
0.81
Note: We considered February 1, 2005 to May 5, 2011 as a testing period.


## 6. Conclusion and Future Works

It is well known that soft computing models pay particular attention to nonlinearties which in turn help to improve complex data predictions. In this paper, we forecasted Chittagong stock price index for all companies and stock price index for 30 selected companies for the period from January 1, 2005 to May 5, 2011. Recent time series literature suggests that most stock price series are nonstationary, contains a unit root. For this reason to make appropriate predictions, using unit root tests, first we tested nonstationarity properties because our considered series are time series. Our test results suggested that the series are nonstationary. To remove this noise from the series, we used the series in first differences. Then we tested linearity of the series using the statistical linear test. Test result showed us that the two considered series are nonlinear. Thus, we selected two very well-known soft computing models, namely, the GA forecasting model and the ANFIS forecasting model. To compare the performances of these two models, we also selected most popular nonlinear time series forecasting model. According to our findings, we would like to conclude that applied workers should select the GA forecasting model to forecast future daily stock price index for all selected companies. In case of daily stock price index for 30 selected companies, the ANFIS forecasting model is more successful than the other considered forecasting models. We believe our findings will be helpful for researchers who are planning to make appropriate decisions with this complex variable. Our next step is to improve and compare the predictions with other recently proposed model, for example, rough set theory and other. This is left for future research.



---

*Source: 410832-2012-08-08.xml*