Forecasting of Chinese E-Commerce Sales: An Empirical Comparison of ARIMA, Nonlinear Autoregressive Neural Network, and a Combined ARIMA-NARNN Model

. With the rapiddevelopmentof e-commerce(EC) and shopping online,accurateand efficientforecasting of e-commercesales (ECS) is veryimportantfor making strategiesfor purchasingand inventoryof EC enterprises.Affectedby many factors,ECS volumerange varies greatly and has both linear and nonlinear characteristics. Three forecast models of ECS, autoregressive integrated moving average (ARIMA), nonlinear autoregressive neural network (NARNN), and ARIMA-NARNN, are used to verify the forecasting efficiency of the methods. Several time series of ECS from China’s Jingdong Corporation are selected as experimental data. The result shows that the ARIMA-NARNN model is more effective than ARIMA and NARNN models in forecasting ECS. The analysis found that the ARIMA-NARNN model combines the linear fitting of ARIMA and the nonlinear mapping of NARNN, so it shows better prediction performance than the ARIMA and NARNN methods.


Introduction
In recent years, e-commerce has developed rapidly in China.The forecasting of ECS greatly affects inventory, ordering, and logistics strategies, so it is very important for e-commerce enterprises to predict the ECS accurately [1].In terms of the lifecycle of EC, its sales present the stages of growth, stability, and decline, whereas in the short term, the sales are affected by price, promotions, evaluations and descriptions online, product life cycle, season, ranking online, etc.There is a dramatic fluctuation in ECS volume, and the ECS shows a linear trend of increase or decrease in a specific period of time, but certain phases may show the characteristics of nonlinear fluctuation because of various potential uncertainties.Therefore, it is critical for the forecasting of ECS to find a prediction method that is suitable for the mixed characteristics of both the linear and nonlinear changes.
The prediction studies of ARIMA and NARNN models in other areas [2][3][4][5][6][7] found that ARIMA fits and forecasts better when the time series data shows a clear linear trend, otherwise the prediction becomes less accurate or even lower than the confidence requirements, while the NARNN model shows a better prediction performance for nonlinear changes in the data.
In view of the above characteristics of the ARIMA and NARNN models, as well as the mixed characteristics of ECS change, both linearly and nonlinearly, we propose to establish the ARIMA-NARNN hybrid model to predict the ECS.
At first, we gained the real sales data of a single food product in Jingdong Company of China and preprocessed and divided the data set into an experimental set and a test set.Then we, respectively, used the ARIMA, NARNN, and the ARIMA-NARNN hybrid models to fit based on experimental set data and predict sales of the single food product for the next few weeks.Finally, we compare fitting accuracy of the three models with the same experimental data and prediction accuracy in the test data.In order to prove the universal superiority of our proposed hybrid model in the e-commerce industry, weekly sales data for a total of 60 e-commerce products was used for our empirical analysis.Finally, the research shows that the ARIMA-NARNN hybrid model is superior to the ARIMA and NARNN models for the ECS we selected.This research has certain reference value to the EC enterprises in the forecast of ECS, demand control of stock, and development of logistics strategy.
In fact, ARIMA, NARNN, and ARIMA-NARNN have been studied in many industries, such as agriculture and forestry [2], healthcare [3,5], geography [4], manufacturing [6], and offline retail [7].Some of these studies [2][3][4][5] only analyzed a single time series to reach conclusions, and some [6,7] only conducted empirical analysis of the hybrid model and did not compare the ARIMA, NARNN, and ARIMA-NARNN to prove the effectiveness of the hybrid model.The innovativeness of this paper is to do a comparative study between the ARIMA, NARNN, and ARIMA-NARNN methods combining the characteristics of the e-commerce industry.The empirical analysis of multiple time series of multiple e-commerce products is used to verify the universal superiority of the ARIMA-NARNN model we propose.
The remainder of this paper is organized as follows.Section 2 is about the relevant literature review.ARIMA and NARNN are introduced, and the ARIMA-NARNN model for forecasting of ECS is proposed in Section 3. Related description of the real case study is presented in Section 4. The conclusion and further research directions are in Section 5.

Literature Review
There are a large number of studies on the prediction of the sales volume of e-commerce products which mainly include time series, causal regression, and machine learning methods.On time series forecasting, Dai W et al. [8] studied the prediction of the clothing sales volume in Taobao based on structure time series model and Taobao search data.In this research, they explored a real-time prediction method of clothing sales volume using structure time series model and website search data.For the regression prediction, Peng Geng [9] predicted the e-commerce transaction volume based on online keywords search, word frequency, and other data as well as the classification of commodities.Jian-hong YU et al. [10] studied Amazon's sales forecast.Based on the historical data of Amazon, the authors used exponential smoothing, time series decomposition, and ARIMA models to predict sales.They found that the exponential smoothing forecast is the worst, while the ARIMA is best.As for machine learning prediction, Yu Miao [11] studied the extreme learning machine (ELM) neural network, taking into account seasons, categories, holidays, and other factors in the forecasting of medium-term sales of clothes.Weng Yingjing [12] used a back propagation (BP) neural network to predict sales online.Philip Doganis et al. [13] constructed a framework of combining genetic algorithms with a radial basis function (RBF) neural network model to analyze and predict sales of perishable food, and its predictive performance and efficiency were demonstrated in the practice of several large companies in the Athens dairy industry.Franses PH [14] combined expert prediction and model prediction to accurately predict the stock keeping unit (SKU) level of drug products and then proved that the effect of the hybrid model is better than either model alone.Weng Y and Feng H [15] established the BP neural network using variables such as the number of users, the conversion rate, the unit price, and the number of collections and verified the accuracy and validity of the model by using sales data from Alibaba.
The above methods do have effects on the prediction of ECS.The causal regression and machine learning methods require a large number of explanatory variables such as the number of clicks and visits, the favorable rate, and even the consumer information.However, there are many kinds of products involved in the e-commerce sales, and the sales of different kinds of products are affected by different factors.Therefore, it is a waste of time and energy to establish a forecasting model by collecting a large number of explanatory variables, and it also does not meet the requirement of a quick prediction, whereas the time series model only needs time as an explanatory variable, and if it can achieve an acceptable prediction accuracy, it will be very suitable for prediction of ECS.Therefore, we selected the time series method to predict.
However, in the e-commerce industry, the types of products are very numerous; that is to say, there are more than one time series to be predicted.Moreover, the sales volume of e-commerce products fluctuates greatly and is easy to be affected by many factors such as price, promotion, ranking, etc.In addition, the prediction of e-commerce requires timeliness.Therefore, the mechanism and approaches for predicting e-commerce sales should be reformulated.

Methodology
. .ARIMA for ECS Forecasting . . .Basic eory and Assumptions.ARIMA (p, d, q) is called autoregressive integrated moving average [25].ARIMA (p, d, q) is used in the e-commerce sales forecasting to build the ECS-ARIMA forecasting model, where AR is an autoregressive and p is an autoregressive term, MA is moving average, q is the moving average term, and d is the number of differentials made when the time series of ECS become stable.
The basic assumptions of the ECS-ARIMA forecasting model are as follows: (1) The time series of ECS follow the basic assumptions of the traditional ARIMA model.
(2) Abnormal data, including promotions, will be discarded or smoothed out.
(3) The time series of ECS can become a stationary sequence with a finite difference.
(4) Presales of EC are not considered in the ECS-ARIMA forecasting model.
( 5) The e-commerce company as a research object operates continuously.
The ECS-ARIMA forecasting model includes the moving average process (MA), the autoregressive process (AR), the autoregressive moving average process (ARMA), and the ARIMA process, depending on whether the time series of ECS is stable or not and what the regression contains.
. . .Moving Average: MA (q).A qth-order moving average process: MA (q) is expressed as follows: where   is the current value of ECS, u is a constant term, {  } is the white noise sequence of ECS, and  1 ,  2 , . . .,  q are the moving average coefficient.
. . .e Autoregressive Moving Average: ARMA (p, q).If the MA (q) process is merged with the AR (p) process, the ARMA (p, q) process can be obtained, which is in the form as follows: where the meaning of each parameter is the same as those mentioned above.Average: ARIMA(p,  d, q).A time series can be transformed into a stationary sequence by one or more differences.If a time series of ECS {  } is transformed into a stationary sequence {  } with d differences, {  } is a nonstationary sequence of d order.The ARMA (p, q) process is established for {  }; in this way, {  } is a ARMA (p, q) process, and {  } is an ARIMA(p, d, q) process.

. . . Seasonal Autoregressive Integrated Moving Average.
When the time series of e-commerce sales are both trendy and seasonal, the series has a correlation that is an integer multiple of the seasonal period.It requires that some appropriate stepwise differencing and seasonal differencing of the series is usually performed to make the series stationary, which should adopt the SARIMA(p, d, q)(P, D, Q) s model for this kind of time series, where P, Q are the seasonal autoregressive and moving average orders, D is the seasonal differencing order, and s is a seasonal cycle.p,d,q are same as the ARIMA (p,d,q) mentioned in Section 3.1.1.
The (S)ARIMA model is good at linear fitting and forecasting, because it is both linear combination of the historical data set residuals and the linear regression of the time series lag items, no matter in the MA, AR, or ARMA process.
. .NARNN for ECS Forecasting . . .Basic eory.NARNN is called nonlinear autoregressive neural network [26].The NARNN is used in forecasting of ECS to build an ECS-NARNN forecasting model.The model can continuously learn and train based on past values of a given time series of ECS to predict future values, which has good memory function.The components of the ECS-NARNN model include the input neuron(s), the input layer(s), the hidden layer(s), the output layer(s), and the output neuron(s).The basic framework is as shown in Figure 1. Figure 1 shows an example NARNN, y(t) is the input and output of the neural network, that is the time series of e-commerce sales,   is the output of hidden layer, 1: n represents the delay order (1: 3 shown in the figure), in which the 1: n can be calculated by formula and obtained by constantly trying, w is the link weight, b is the threshold,  is the number of hidden layer neurons, and f is the activation function of the hidden and output layer.
The basic assumptions of the ECS-NARNN forecasting model are as follows: (1) The time series of ECS follow the basic assumptions of the traditional NARNN model.
(2) Other basic assumptions are the same as the assumptions (2) -( 5) in Section 3.1.1 of ECS-ARIMA model.
It can be described as follows: where (), ( − 1), ( − 2), ( − 3), . . ., ( − ) are, respectively, the value lag 0-order, 1st-order,. .., and nthorder of the ECS sequence and e(t) is white noise.It can be seen from the equation that the output at the next moment depends on the last n moments.
Based on the principle of autoregression, the following NARNN are used in the model: Delay in the ECS-NARNN is the time delay of the output signal.Because it is a regression based on its own data, the ECS-NARNN takes the output time delay as the input of the network and calculates the output of the network from the hidden layer and the output layer.The input signal of network is represented by   .The hidden layer calculates the output   of each neuron based on the connection weight   and the threshold   between the input data and hidden layer neurons.
where   is the output of the jth neuron in hidden layer, i is the ith input e-commerce sales data, n is the number of input e-commerce sales, j is the jth hidden layer neuron,  is the number of hidden layer neurons, f is the activation function of the hidden layer,   is the input of the ECS time series of the network,   is the connection weight between the ith output delay signal and the jth neuron of the hidden layer, and   is the threshold of the jth hidden neuron.
The output layer gets the output () of the network through a linear calculation based on the output   of the hidden layer.
where () is the output of the network, f is the activation function of the output layer,   is the connection weight between the jth neuron in the hidden layer and the neuron in the output layer, and  is the threshold of output layer neurons.
It can be seen that the ECS-NARNN can perform nonlinear autoregressive prediction based on time series lag values, and the NARNN and all-regression neural network can transform each other, so the ECS-NARNN has significant performance in nonlinear mapping and prediction.
. .e ARIMA-NARNN Combined Model.Based on the above basic theories of the ARIMA and NARNN models, a time series of ECS   can be considered as comprising a linear autocorrelation structure   and a nonlinear component   .Therefore,   can be expressed as The basic assumptions of the ARIMA-NARNN combined model are as follows: (1) The ECS-ARIMA model can fully extracted the linear component of the time series of ECS.
(2) The fitting residues of the ECS-ARIMA model contain a great deal of the nonlinear component in the time series of ECS.
(3) Other basic assumptions are the same as the assumptions (2)-( 5) in Section 3.1.1 of ECS-ARIMA model.
The steps of the ARIMA-NARNN combined model to predict are as follows.
Step .The linear component L is predicted by modeling and forecasting the true time series of ECS   by using the ARIMA model.
Step .The predicted residuals of the ARIMA model are obtained by The sequence   implies a nonlinear relationship in the original time series: (10) where    is a random error,  −1 ,  −2 , ⋅ ⋅ ⋅,  − are, respectively, the value lag 1st-order, 2nd-order, . .., and nth-order of   and  is the nonlinear autoregressive function.
Step .The NARNN model is used to approximate the nonlinear function , and then, the sequence   is predicted with the NARNN model.We set the predicted result as N .
Step .Combining the two models, the final prediction result of the ARIMA-NARNN combined model is as follows.ŷ is the predicted sequence of ECS time series data: The above process is shown in Figure 2. . .Predictive Evaluation Method.We use the mean relative error (MRE), correlation coefficient R 2 , and root mean square error (RMSE) to evaluate the accuracy of fitting and prediction of each model.[27] where   is the true value of ECS, ŷ is the predictive value of ECS, and n is the number of ECS samples.

Case Study
We selected a total of 60 types of e-commerce items from the Jingdong Company in China as an empirical research object.The types of items include food, beverages, household appliances, fresh food, household goods, baby products, toys, home textiles, clothing, footwear, etc.Each time series of e-commerce items we selected is from January 2014 to March 2017, a total of 167 weekly sales data sets for one time series.Outliers due to promotions and price changes will be removed and reinterpolated.Then, based on the preprocessed data, the ECS-ARIMA, ECS-NARNN, and the ARIMA-NARNN combined models are, respectively, used to predict the ECS that we selected, and, finally, the prediction errors of the three models are compared by using ( 12) and (14).
For this time series, a total of 167 weekly sales data sets were used for modeling and forecasting, and the top 85% (i.e., a total of 142 sets of weekly sales data from January 06, 2014, to September 19, 2016) were selected as the model training set.The last 15% (i.e., a total of 25 sets of weekly sales data from September 26, 2016, to March 13, 2017) were used as a test set.A two-sided P value of ≤ 0.05 was regarded as significant.
In order to fully demonstrate the process of the case study, from Sections 4.1-4.3, a time series (e-commerce sales data for a single food item) was selected as the object to be described.In Section 4.4, the results of a comprehensive analysis of 60 time series consisting of 60 e-commerce products will be presented.
. .ARIMA for ECS Forecasting.Based on Eviews 8.0 software, the ARIMA model is used to predict to the ECS.At first, the ECS model training set is plotted as Figure 3.This sequence shows dramatic fluctuations, with some tendency and the possible seasonality; therefore, the (S)ARIMA process is considered for this time series.
The nonstationary sequence shown in Figure 3 is differentiated, and the stationarity test of differential sequence is performed using the augmented dickey-fuller (ADF) test.
From Table 1, the first-order differential sequence is a stationary sequence at a significant level of 0.05, so d = 1 and D = 0 in the ECS-ARIMA model.
From Figure 4, both graphs are trailing.And possible (S)ARIMA models are identified by Eviews, and the best one is selected as SARIMA (2, 1, 3)(1, 0, 1) 52 .Finally, we use Eviews to predict the total 25 weekly sales data of the test sample from September 26, 2016, to March 13, 2017.The predicted results are in Figure 5.
. .NARNN for ECS Forecasting.We use neural network toolbox of Matlab2014b to construct a NARNN structure and use the trial-and-error method to construct the model with  the number of hidden layer neurons from 5 to 40, respectively (debugging shows that when the number of neurons exceeds 40, network training time will become longer).The analysis shows that the goods needed to predict for Jingdong is too much, not suitable for an extended training time, that is, after more than 40, model predictive performance improvement is not enough to make up for the training time loss.Since input weights and thresholds directly affect the performance of the neural network, each model is trained 10 times, and the root mean square error (RMSE) and the decision coefficient  2 of training results are recorded as shown in Figure 6.
From Figure 6, as the number of hidden neurons increases, RMSE decreases firstly, and  2 increases.A change to the opposite direction begins to occur after reaching 20, indicating that, as the number increases, the tendency to coordinate results in reduced ability to generalize and  finally get the best number of hidden layer neurons of 17. Network training and debugging results are shown in Figures 7 and 8: From Figure 7, only the confidence interval of the error autocorrelation coefficient exceeds 95% when the delay lag order is 0. The correlation coefficients of the other orders are within 95% confidence intervals and then the relevance of information has been fully extracted.This illustrates this model is for purpose and then get the error graph shown in Figure 8.The final result is shown in Figure 9.
(2) Using the NARNN prediction to obtain the predicted sequence value N of the nonlinear prediction part based on the obtained residual sequence   .
(3) Calculating the sales forecast result ŷ = L + N of the ARIMA-NARNN model based on the prediction results of ARIMA model in 4.1 and the nonlinear part residual prediction values obtained in (2).
From Figure 10, only the autocorrelation coefficient of the error whose delay lag order is 0 exceeds 95% confidence intervals.The autocorrelation coefficients of the other orders are within 95% confidence intervals and fluctuate around the 0 value, indicating that the model is reasonable and credible.At the same time, its model error is shown in Figure 11.The errors of NARNN are shown in Figure 11.The errors of training set, verification set and test set vary little with time, and the residuals in the previous period are close to zero.In the later period, although the residuals have become bigger than before, the overall error is within the acceptable range and fluctuates around the zero value, indicating that the established neural network model is credible and can be used for prediction of future residuals.So based on this network, the forecast result is shown in Figure 12.
This article uses weekly sales data from January 06, 2014, to September 19, 2016, as the experimental set, data from September 26, 2016, to January 13, 2017, as a test set, using the MRE and RMSE to compare the fitting error and prediction error of ECS-ARIMA, ECS-NARNN, and ARIMA-NARNN combined model and then evaluate the predictive performance of each model.The predicted and actual values of the three models are compared as shown in Figure 13.
From Figure 13, the predicted value of the three models in the test set fits well with the real value, and the prediction performance is also good.The ARIMA-NARNN model has a higher fitting degree for predicted values and real values.However, the result is only for a single time series; in order to verify the universal superiority of the ARIMA-NARNN model, the same analysis process will be performed for the other 59 time series of different e-commerce items sales.The types of items include food, beverages, household appliances, fresh food, household goods, baby products, toys, home textiles, clothing, footwear, etc. . .Model Comparison and Discussion.In the 60 time series of different e-commerce products, the trend and seasonality of them are not exactly the same.For different time series features, different analysis methods (i.e., ARIMA or SARIMA) will be used.The final analysis results are shown in Figure 14.
It can be seen in Figure 14 that the RMSE of ARIMA-NARNN is generally lower than that of ARIMA and NARNN.In order to quantitatively compare the effects of the three models, average of the MRE and RMSE for 60 e-commerce  products of fitting and prediction was calculated by using (12) and (14).Table 2 shows the calculation results.
The fitting and forecasting performance of the three models for Jingdong's weekly sales data is shown in Table 2.It can be seen that both the MRE and RMSE of the ARIMA-NARNN combined model are the lowest in model fitting and model prediction.Therefore, the ARIMA-NARNN combination model is the best, the ECS-NARNN is the second, and the ECS-ARIMA model is the worst.

Conclusion
The ECS studied in this paper often has two characteristics: linearity and nonlinearity.We choose the e-commerce sales time series of many single products from Jingdong Company in China as empirical analysis data sets and forecast the time series of weekly sales by ECS-ARIMA model.We find that the model has good adaptability to the linear patterns of e-commerce sales and low fitness to nonlinear patterns, which has a big local error.When ECS-NARNN model is used to predict, it is found that the model can well realize the nonlinear mapping process.However, it is easy to cause underfitting and overfitting because of poor control of the model structure, and the prediction of linear components is not as effective as the ECS-ARIMA model.We set up the ARIMA-NARNN combined model.Specifically, we use the ECS-ARIMA model to predict linear components of the time series and use the predicted residual of the ARIMA as a nonlinear component.At last, we predict the nonlinear component by using the ECS-NARNN.Our case study shows that the ARIMA-NARNN outperforms the ECS-ARIMA and ECS-NARNN models in terms of the prediction accuracy, which is well adapted to the forecasting of ECS with linear and nonlinear characteristics.
In the actual application of EC companies, the idea of this research can be used to forecast the sales of different types of e-commerce products.Depending on the sales frequency of different types of products, different forecasting durations can be selected to use this more effective ARIMA-NARNN combined model to predict sales in a future period of time.Therefore, according to this precise forecast, the enterprise's inventory strategy and logistics strategy can be more rationally formulated so that the entire supply chain can operate more smoothly.

Figure 1 :
Figure 1: Example of the NARNN with one input, one hidden layer with 17 neurons, and one output layer with one output neuron and one output.

Figure 3 :
Figure 3: Original time series graph of a single food item.

Figure 4 :
Figure 4: Autocorrelation and partial autocorrelation functions graph of the first-order differential sequence.

Figure 5 :
Figure 5: Real values and ARIMA model predictive values.

Figure 8 :
Figure 8: The error graph of the NARNN fitting model.

Figure 11 :Figure 12 :
Figure 11: Error of using NARNN to fit the residual of ARIMA.

Figure 13 :
Figure 13: Actual values and the predicted values from the three models.

Figure 14 :
Figure 14: RMSE of 60 time series of e-commerce products from the ARIMA, NARNN, and ARIMA-NARNN models.

Table 2 :
Average of the MRE and RMSE for 60 e-commerce products of fitting and prediction.