# The Stock Index Prediction Based on SVR Model with Bat Optimization Algorithm
## 6 Robustness Test  
This chapter aims to test the robustness of the BA-SVR model from different angles. Referring to the stationarity test and cointegration test of each time series variable in the previous chapter, there is a cointegration relationship between each variable. However, to ensure the accuracy of the data, we take the stationary data after the first-order difference of the stock index characteristics as the input and output variables of the new prediction model, and we re-estimate the optimized three SVR model parameters. After changing the input variables and output variables into stable first-order differential stock index characteristic data, we use bat algorithm to optimize the SVR model. The three parameters optimized by bat algorithm of 18 stock indexes in the short, medium and long term are shown in Table 14. Table 14 shows that the optimal parameter range of the penalty factor obtained is between 34.6240 and 98.6366. The absolute value of the optimal parameter range of the intensive loss factor is between 0.0870 and 2.9864. The optimal range of the width parameter of the radial basis kernel function is between 0.9862 and 7.7466. In addition, based on the existing literature, we introduce ANN model and random forest model with good prediction performance as the control model, and use the stationary time series data for training and prediction from the short-term, mid-term and long-term perspectives. The short-term, mid-term and long-term prediction performance results of BA-SVR model, ANN model and RF model are listed in Tables 15-17, respectively. Following literature [31; 32; 33], we also conduct Diebold-Mariano test on the prediction residuals of the three models to prove the effectiveness of BA-SVR model in stock index prediction. When two time series have the same time length and the data meet the stationarity condition, DM detection is often used to detect whether one model is better than the other in terms of statistics. The calculation formula of DM statistics is as follows:  
\[\text{DM statistics}\,=\,\frac{d_{\text{mean}}}{d_{\text{std}}} \tag{13}\]  
where \(d\) indicates the difference between the prediction residual sequences of two models. \(d_{\text{mean}}\) indicates the mean value of time series \(d\). \(d_{\text{std}}\) indicates the standard error of time series data \(d\). We mark the results of DM test by \(\ast\) and \(\circ\), which indicate the comparison of BA-SVR model with RF model and ANN model, respectively. It can be seen from Table 15 that the short-term prediction performance of BA-SVR model of 8 of the 18 stock indexes is significantly better than that of random forest model. The short-term prediction performance of BA-SVR model of 7 stock indexes is significantly  
\begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multirow{2}{*}{**Index**} & \multicolumn{3}{c}{**Short-Term**} & \multicolumn{3}{c}{**Mid-Term**} & \multicolumn{3}{c}{**Long-Term**} \\ \cline{2-10}  & **C** & \(\epsilon\) & \(\sigma\) & **C** & \(\epsilon\) & \(\sigma\) & **C** & \(\epsilon\) & \(\sigma\) \\ \hline SSE & 92.1870 & 1.5430 & 3.4531 & 97.7989 & \(-1.0548\) & 3.0  
better than ANN model. The short-term prediction performance of BA-SVR of only one stock index (SSE A shares) is significantly worse than that of ANN model. Therefore, in general, BA-SVR has certain advantages over the commonly used ANN model and RF model in the short-term prediction performance of stock index. Note: Tables 15-17 presents the out of sample performance of BA-SVR and the benchmark Artificial Neural Network model and Random Forest model with the testing sample. We list three evaluation indicators, including RMSE, MAE and MAPE. *, *** indicate the prediction performance of BA-SVR model and RF model by DM test under the significance of 10%, 5% and 1%, respectively.