You are on page 1of 4

Application and analysis of forecasting stock price index based on combination

of ARIMA model and BP neural network


Yulin Du1,2
1. School of Management ,Fudan University ,Shanghai,China,200433
E-mail: tongjihz@sina.com
2. Department of Finance, East China University of Political and Science of Law, Shanghai,201620

Abstract: Stock price index is a barometer of the national economy, which often shows strong nonlinearity because of
various factors. It is necessary to use nonlinear models to improve the accuracy of prediction. We predict Shanghai
Securities Composition stock index with ARIMA-BP neural network method, and compare the accuracy with the result
of single ARIMA model and BP neural network method. We find that the prediction accuracy of ARIMA-BP neural
network is better than the BP neural network, BP neural network is better than linear model ARIMA, which confirms the
change of stock price index is nonlinear.
Key Words: BP neural network; Shanghai Securities Composition stock index; ARIMA-BP; Foresting

1 INTRODUCTION 2 ARIMA-BP NEURAL NETWORK MODEL


Stock market forecasting is a branch of economic There are many kinds of methods to forecast the stock
forecasting. Whether the future trend of stock market price index, which can be divided into linear and nonlinear
can be predicted is closely related to the effectiveness of the models .In order to make comparison, we select ARIMA
financial market. If the stock market is in line with the (p,d, q) to represent the linear model , BP neural network
effective market hypothesis, which means the stock price mode representing the nonlinear method ,we then combine
follows random walk model, the prediction of the stock these two models into ARIMA-BP neural network to
price is meaningless. With the development of China's improve the predction accuracy.
securities market, many scholars are devoted into the study
2.1 Linear model :ARIMA
of the validity and predictability of China stock market.
From the research on the characteristics of China's stock Stock price index data is usually collected in
market, most researchers believe that China's stock market chronological order. It can be regarded as time series data. It
has not yet reached the weak and effective market,which has significant nonlinear and time-varying characteristics.
means that the historical information of stock trading will There are many research on stock market prediction ,
help to predict its future price . In the short term, the stock putting forward many prediction methods. Autoregressive
price is predictability, so is the stock price index. Now more Integrating Moving Average (ARIMA) is quite flexible in
and more people are investing in securities. The influence of time series analysis, which combines the advantages of time
the operation of stock market on China's real economy is series and regression analysis. It is widely used in stock
deepening. It is playing the role of "barometer" and "alarm" application and prediction.
in the national economy. It is of great significance in For time series yt ,{t = 1, 2,3, ", n} , the modeling
understanding of the stock market rules, analysis and process of ARIMA is as follows:
prediction of the future stock price index to investors and (1)Stabilizing the time series
regulators. The stock price index is generally a nonstationary time
However, there are many factors affecting the change of series, it needs to be stabilized by the difference method,
the stock price index, the stock price index has noisy and that is:
highly nonlinear fuzzy characteristics .It is hard to predict
the future index through a simple model. Many scholars ∇ d yt = zt
have given different forecasting methods, such as time Where d is the number of differences, for stock price
series prediction, grey forecasting, combination forecasting. index, d is often equal to d=1.
But the stock index the fluctuation is easily affected by (2) Establishing ARMA model
short-term factors,it is hard to catch the behavior of the The ARMA (p, d, q) model is established for the result of
stock price index using a single model. In this paper ,we the difference:
predict the future stock price index through ARIMA-BP ϕ ( B )(1 − B ) d yt = ψ ( B )ε t
neural network method to improve the prediction accuracy. p q
ϕ ( B)=1-¦ α i B i ˈψ ( B)=1-¦ β i B i
i =1 i =1
Where B is the lagged operator.
This work is supported by National Nature Science Foundation under
Grant 71371054

978-1-5386-1243-9/18/$31.00 2018
c IEEE 2854
(3) Determining the parameters of the model and testing
the regression model
P and q are the key parameters in ARMA (p, q)
model.According to the AR (p), MA (q) model, we can use
the autocorrelation and partial autocorrelation function to
estimate p and q values of the stock price index by
comparing the minimum information criterion (AIC) and
consistency criterion (SC) to determine the optimal number
of model order. At the same time, the coefficient, equation Input layer Hidden layer Output layer
and residual error of the model should be tested. Figure 1 The structure of BP neural network

(4)Prediction through the model X 1 , X 2 , " , X n is the BP neural network input value,
After the model is determined, the data outside the
sample are extrapolated and predicted.There are two kinds Y1 , Y2 , ", Yn is to predict the value of the BP neural network,
of prediction methods: dynamic prediction and static ωij , ω jk are the weights of the neural network. BP neural
prediction. Dynamic prediction is based on the data of the
network can be regarded as a nonlinear function, the
first observation value, so the prediction is not very accurate.
network input and output respectively the function of the
Generally, it uses the static prediction method, which can
independent and dependent variables, as the network input
get better prediction by using the real value of the original
nodes and output nodes are respectively n, m, which reflects
time series.
a variable from the n to m because of the mapping function
2.2 Nonlinear model :BP neural network variables in BP neural network.
2.3 ARIMA-BP neural network method
In ARIMA model, we assume that the stock price
index follows a linear system. However, the stock price The ARIMA-BP model is the synthesis of two kinds of
index is nonlinear and time-varying. Therefore, the models, which regard the residuals of the ARIMA model as
prediction result of ARIMA is not ideal. A single prediction the input parameters of the BP neural network model, then
model can only reflect the stock price index segment pulsing them together to get the final result, the result will be
information, it is difficult to fully change the stock price more accurate than the single ARIMA model and the BP
data mining rules hidden in the prediction results and the neural network model result.
requirements of investors, investors have a certain gap,
combination model to great extent to the comprehensive use 3 DATA AND EMPIRICAL ANALYSIS
of various models to provide information as much as
possible to improve the prediction accuracy, especially in 3.1 Data
the economic, management and statistical research and all We select Shanghai securities composition index
kinds of combination forecasting method has been represent the stock price index, we choose the closing price
improved and an important way to improve the forecast data from January 3, 2017 to December 22, 2017. A total of
accuracy. 240 data samples were collected, of which the first 200 data
BP (Back Propagation) network is a multilayer feed were used as training set to model stock closing price index.
forward neural network, the network training, adjust the To avoid the chance of single sample prediction, the last 40
training algorithm right threshold follows the error samples are used as test sets tocheck the prediction ability
back-propagation method. Usually the BP neural network of the model. The closing price of Shanghai securities
has 3 layers or 3 layers these neurons, including input layer, composite index is shown in the figure 2.
hidden layer and output layer, realize the connection 3,500

between the upper and lower layer, and the same neuron
connection. The input layer neurons and neurons in the 3,400

hidden layer and hidden layer between neurons and neurons


in the output layer is the network weights, the connection 3,300

strength between two neurons in the hidden layer. When a


pair of learning is provided to the input neurons, neuronal 3,200

activation values from the input layer through the hidden


layer to the output layer, then according to reduce the error 3,100

between the network output and the actual output samples


from the output layer direction, reverse direction through a 3,000
25 50 75 100 125 150 175 200 225
hidden layer to the input layer, so as to gradually modify the
connection weights, the algorithm is called "the error Figure 2 The line graph of Shanghai securities
back-propagation algorithm" or "negative gradient composite index
correction algorithm".
3.2 The establishment and prediction of the linear model
In ARIMA (p,d, q) ,threr are three parameters to be
determined in the model. p is the order of AR(p) model,

The 30th Chinese Control and Decision Conference (2018 CCDC) 2855
we can get p through the partial autocorrelation coefficient be choosen from ARIMA˄1,1,1˅,ARIMA˄2,1,1˅ARIMA
of the series; q is the number of order moving average, ˄1,1,2˅.Finally we choose model by comparing their
which can be obtained through the auto regression function; values of the SC and BIC criteria.
d is the order of a single integration , obtained from the unit Table 2 The BIC and SC criteria value of models
root test. Three parameters in the ARIMA model and other
models is obtained from EViews9 and Matlab2014. BIC SC
3.2.1 Unit root test
ARIMA(1ˈ1ˈ1) -5.346911 -5.323679
We use ADF to test the series of Shanghai composite
index(SH) and its first difference , we get the following ARIMA(2ˈ1ˈ1) -5.367165 -5.357804
results: ARIMA(1ˈ1ˈ2) -5.358152 -5.336381
Table 1 The results of unit root test
From the results, we see that the SC and BIC values of
Time series Statistic p-Value Critical Value
ARIMA(2,1,1) model are the smallest. Therefore ARIMA
SH -2.48 0.1169 -3.99293˄1%˅ (2, 1, 1) model is the best model. We choose this model to
First predict the out of sample data.
-15.8*** 0.0001 -3.13293˄10%˅ 3.2.3 Out of sample prediction
difference
From the table ,we see that the Shanghai composite We will use ARIMA (2, 1, 1) to predict the out of
index is not stable, but the first order difference becomes sample data of Shanghai composite index using one step
stable, the Shanghai index is I(1), so the parameter d=1. prediction . The first I moments of the stock price, using the
3.2.2 Auto correlation function and partial I - 1 data as learning samples in the model training, the
autocorrelation function diagram follow-up data shall not participate in the training in the
According to the theory of time series, the partial prediction modeling. The prediction results of the ARIMA
autocorrelation coefficient of AR (p) mode truncated at p model are shown in Figure 5. From Figure 5, we can see that
order; autocorrelation coefficient of MA (q) truncated at q the prediction accuracy of ARIMA model to stock price
Order. So we can get p and q values from the partial index is not high, but we can grasp the trend of stock price
correlation and autocorrelation function image.The well, that is, we get the linear part information of stock price
Shanghai composite index and partial autocorrelation index.
autocorrelation function the number of images are as
follows:

Figure 5 The prediction result of ARIMA model


Figure 3 Auto correlation coefficient and partial
autocorrelation coefficient diagram of SH series 3.3 Prediction based on BP neural network model
We use a single BP neural network to predict the stock
price index. The results are shown in Figure 6. From Figure
6, it can be seen that the prediction accuracy of the single BP
neural network model is not high.Iit is difficult to describe
the change of stock price in a comprehensive and accurate
way.

Figure 4 Auto correlation coefficient and partial


autocorrelation coefficient diagram of the first difference of
SH series
From the above autocorrelation and partial
autocorrelation coefficients, we can see that our model can Figure 6 The prediction result of BP neural network

2856 The 30th Chinese Control and Decision Conference (2018 CCDC)
3.4 Prediction based on ARIMA-BP neural network the model, the BP neural network model results the result is
model better than the ARIMA model, the stock price index has
According to ARIMA (2, 1, 1) the prediction results ,the obvious non-linear characteristics. The comparison results
actual stock price index is worth to the residual sequence of show that ARIMA-BP has made full use of the advantages
stock price index. We use it as the desired output of the BP of ARIMA and BP neural network to achieve
neural network, then reconstruce the original data of the complementary advantages, overcome both defects, and
phase space for the optimal order of the reconstructed data comprehensively depict the change rule of stock price index.
as BP input. We then train the input to the BP neural ARIMA-BP neural network model is an effective prediction
network for learning modeling, and the residual sequence method of stock price index.
test set was predicted by ARIMA (2,1, 1) residual sequence
prediction. At the same time, the prediction results of
ARIMA (2, 1, 1) and BP neural network model are added to 4 CONCLUSIONS
get the final prediction result of the stock price index. The
prediction results are shown in Figure 7. Because there are more and more uncertainty in financial
market, it is hard to use a single model to predict stock price
index. We predict Shanghai stock index with ARIMA-BP
neural network method, and compare the accuracy with the
result of ARIMA model and BP neural network method
along. We find that the prediction accuracy of ARIMA-BP
neural network is better than the BP neural network, BP
neural network is better than linear model ARIMA, which
confirms the change of stock price index is nonlinear.

REFERENCES
[1]Albanis George,Batchelor Roy.Five classification
algorithm to predict high performance stocks[M] .Kluw er
Figure 7 The prediction result of ARIMA-BP neural
AcademicPublishers, 2000(3): 1-30.
network
[2]Bhattacharya A, Abraham A, Grosan C, et al.
Meta-Learning Evolutionary Artificial Neural Network for
3.5 Comparison of the three models
Selecting Flexible Manufacturing Systems[C] Advances in
In order to verify the predictive ability of the three
Neural Networks - Isnn 2006, Third International
models, we measure the predictive effect of the three models
Symposium on Neural Networks, Chengdu, Proceedings.
by means of the root mean square error and the relative
DBLP, 2006:891-897.
mean error. The mean square error is the expected value of
[3]Guresen E, Kayakutlu G, Daim T U. Using artificial
the square of the difference between the parameter
neural network models in stock market index prediction[J].
estimation and the true value of the parameter ( Root Mean
Expert Systems with Applications,
Squared Error, RMSE).
2011,38(8):10389-10397.
1 [4]Jensen H L Using neural networks for credit scoring[J]
RM SE = ¦ (yˆ i − y i ) 2 Managerial Finance,1992,(6):15-26.
n i
[5]Majhi R, Panda G, Sahoo G, etal. Stock market
The mean relative error is better to reflect the actual
prediction of S&P 500 and DJIA using Bacterial Foraging
situation of the prediction error because it has no
Optimization Technique[C] Evolutionary Computation,
dimensional influence, it is a percentage easy to make
IEEE, 2007:2569-2575.
comparison.
[6]Qiu M, Song Y, Akagi F. Application of artificial neural
network for the prediction of stock market returns: The case
1 ŷ i − y i 2 of the Japanese stock market[J]. Chaos Solitons & Fractals
MRE = ¦( ) the Interdisciplinary Journal of Nonlinear Science &
n i yi
Nonequilibrium & Complex Phenomena, 2016,
Table 3 The MRE and RMSE of three models 85(September):1-7
Method MRE RMSE [7]Rather, Agarwal , Sastry. Recurrent neural network and
ARIMA 7.45% 89.21 a hybrid model for prediction of stock returns. Expert
BP 5.61% 65.73 Systems with Applications[J] , 2015 , 42 (6) :3234-3241.
ARIMA-BP 1.03% 18.02 [8]Vanstone BˈFinnie G.An empirical methodology for
From the result of the model , RMSE and MRE results developing stock market trading systems using artificial
of ARIMA-BP is the smallest among the three kinds of neural networks[J].Expert Systems with
models, the results of the BP model is in the middle, the Applications,2009,36(3):6668-6680.
worst is the results of ARIMA, so ARIMA-BP's stock price
prediction accuracy is much higher than that of single
ARIMA and BP neural network, the prediction accuracy of

The 30th Chinese Control and Decision Conference (2018 CCDC) 2857

You might also like