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

Authors: Maobin Li; Shouwen Ji; Gang Liu
Journal: Mathematical Problems in Engineering
 (2018)

---

## Abstract

With the rapid development of e-commerce (EC) and shopping online, accurate and efficient forecasting of e-commerce sales (ECS) is very important for making strategies for purchasing and inventory of EC enterprises. Affected by many factors, ECS volume range 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.


---

## Body

## 1. 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–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–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. Section2 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.


## 2. 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.Previous studies show that ARIMA and NARNN approaches have better prediction performance in time series prediction [16–24]. For example, Cheng C and Qin P [16] used the ARIMA model to predict the time series data of settlement of seawalls and got higher accuracy than the gray prediction. Also, Bonetto R and Rossi M [24] used the NARNN model to predict the power demand and get a good predictive effect. In time series prediction of ECS, currently, most scholars [16–25, 25–31] mainly use the methods of moving average, exponential smoothing, time regression, or ARIMA alone, while the ARIMA, NARNN, and ARIMA-NARNN combined models have not yet been used to predict and analyze comparisons in the e-commerce industry.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.


## 3. Methodology

### 3.1. ARIMA for ECS Forecasting

#### 3.1.1. Basic Theory 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.


#### 3.1.2. Moving Average: MA (q)

A qth-order moving average process: MA (q) is expressed as follows:(1)Yt=u+εt+θ1εt-1+θ2εt-2+⋯+θqεt-qwhereYt is the current value of ECS, u is a constant term, εt is the white noise sequence of ECS, and θ1,θ2,…,θq are the moving average coefficient.


#### 3.1.3. Autoregression: AR (p)

A pth-order autoregressive process: AR (p) is expressed as follows:(2)Yt=c+ϕ1Yt-1+ϕ2Yt-2+⋯+ϕpYt-p+vtwhereYt-1,Yt-2,…,Yt-p, are, respectively, the value that lag 1st-order, 2nd-order, …, and pth-order of the ECS time series, c is a constant term, and {vt} is a white noise process.


#### 3.1.4. The 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:(3)Yt=c+ϕ1Yt-1+ϕ2Yt-2+⋯+ϕpYt-p+θ1εt-1+θ2εt-2+⋯+θqεt-q+εtwhere the meaning of each parameter is the same as those mentioned above.


#### 3.1.5. Autoregressive Integrated Moving 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 ECSYt is transformed into a stationary sequence Wt with d differences, Yt is a nonstationary sequence of d order. The ARMA (p, q) process is established for Wt; in this way, Wt is a ARMA (p, q) process, and Yt is an ARIMA(p, d, q) process.


#### 3.1.6. 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,Qs 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.


### 3.2. NARNN for ECS Forecasting

#### 3.2.1. Basic Theory

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
Example of the NARNN with one input, one hidden layer with 17 neurons, and one output layer with one output neuron and one output.Figure1 shows an example NARNN, y(t) is the input and output of the neural network, that is the time series of e-commerce sales, Hj 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, l 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 Section3.1.1 of ECS-ARIMA model.It can be described as follows:(4)yt=a0+a1yt-1+a2yt-2+a3yt-3+⋯+anyt-n+etwhereyt,yt-1,yt-2,yt-3,…,y(t-n) are, respectively, the value lag 0-order, 1st-order,…, and nth-order 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:(5)yt=fyt-1,yt-2,yt-3,…,yt-nDelay 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 byyi. The hidden layer calculates the output Hj of each neuron based on the connection weight wij and the threshold bi between the input data and hidden layer neurons.(6)Hj=f∑i=1nwijyi+bjj=1,2,…,lwhereHj 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, l is the number of hidden layer neurons, f is the activation function of the hidden layer, yi is the input of the ECS time series of the network, wij is the connection weight between the ith output delay signal and the jth neuron of the hidden layer, andbi is the threshold of the jth hidden neuron.The output layer gets the outputy(t) of the network through a linear calculation based on the output Hj of the hidden layer.(7)yt=f∑j=1lHjwj+bwherey(t) is the output of the network, f is the activation function of the output layer, wj is the connection weight between the jth neuron in the hidden layer and the neuron in the output layer, and b is the threshold of output layer neurons.


#### 3.2.2. Forecasting of the ECS-NARNN Model

NARNN predictions in ECS-NARNN are recursive. The main idea of this method is to recycle 1st-step forward predictive value. The basic idea is that, as for the NARNN modelytn=f(ytn-1,ytn-2,…,ytn-d), the first prediction value ytncan be obtained when k=1; when it is added to the original samples (ytn-d,…,ytn-2,ytn-1), a new sample ytn+1 can be obtained for the two-step prediction valueytn+1; then we use the nonparametric model to get the new samples (ytn-d,…,ytn-2,ytn-1,ytn,ytn+1), repeating this continuous cycle until k is reached. Since the information contained in ytn,ytn+1,…,ytn+k-1 is used for the prediction of the kth step (k>1), the recursive prediction method is better than the direct prediction method.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.


### 3.3. The ARIMA-NARNN Combined Model

Based on the above basic theories of the ARIMA and NARNN models, a time series of ECSyt can be considered as comprising a linear autocorrelation structure Lt and a nonlinear component Nt. Therefore, yt can be expressed as (8)yt=Lt+NtThe 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 Section3.1.1 of ECS-ARIMA model.The steps of the ARIMA-NARNN combined model to predict are as follows.Step 1.
The linear componentL^t is predicted by modeling and forecasting the true time series of ECS yt by using the ARIMA model.Step 2.
The predicted residuals of the ARIMA model are obtained by(9)et=yt-L^t
The sequenceet implies a nonlinear relationship in the original time series:(10)et=fet-1,et-2,…,et-n+εt′
whereεt′ is a random error, et-1,et-2,···,et-n are, respectively, the value lag 1st-order, 2nd-order, …, and nth-order of et and f is the nonlinear autoregressive function.Step 3.
The NARNN model is used to approximate the nonlinear functionf, and then, the sequence et is predicted with the NARNN model. We set the predicted result as N^t.Step 4.
Combining the two models, the final prediction result of the ARIMA-NARNN combined model is as follows.y^t is the predicted sequence of ECS time series data:(11)y^t=L^t+N^tThe above process is shown in Figure2.Figure 2
The ARIMA-NARNN combined model principle.


### 3.4. Predictive Evaluation Method

We use the mean relative error (MRE), correlation coefficient R2, and root mean square error (RMSE) to evaluate the accuracy of fitting and prediction of each model. [27](12)MRE=1n∑i=1nyi-y^iyi×100%(13)R2=n∑i=1nyiy^i-∑i=1nyi∑i=1ny^in∑i=1nyi2-∑i=1nyi2n∑i=1ny^i2-∑i=1ny^i2(14)RMSE=MSE=1n∑i=1nyi-y^i2whereyi is the true value of ECS, y^i is the predictive value of ECS, and n is the number of ECS samples.


## 3.1. ARIMA for ECS Forecasting

### 3.1.1. Basic Theory 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.


### 3.1.2. Moving Average: MA (q)

A qth-order moving average process: MA (q) is expressed as follows:(1)Yt=u+εt+θ1εt-1+θ2εt-2+⋯+θqεt-qwhereYt is the current value of ECS, u is a constant term, εt is the white noise sequence of ECS, and θ1,θ2,…,θq are the moving average coefficient.


### 3.1.3. Autoregression: AR (p)

A pth-order autoregressive process: AR (p) is expressed as follows:(2)Yt=c+ϕ1Yt-1+ϕ2Yt-2+⋯+ϕpYt-p+vtwhereYt-1,Yt-2,…,Yt-p, are, respectively, the value that lag 1st-order, 2nd-order, …, and pth-order of the ECS time series, c is a constant term, and {vt} is a white noise process.


### 3.1.4. The 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:(3)Yt=c+ϕ1Yt-1+ϕ2Yt-2+⋯+ϕpYt-p+θ1εt-1+θ2εt-2+⋯+θqεt-q+εtwhere the meaning of each parameter is the same as those mentioned above.


### 3.1.5. Autoregressive Integrated Moving 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 ECSYt is transformed into a stationary sequence Wt with d differences, Yt is a nonstationary sequence of d order. The ARMA (p, q) process is established for Wt; in this way, Wt is a ARMA (p, q) process, and Yt is an ARIMA(p, d, q) process.


### 3.1.6. 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,Qs 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.


## 3.1.1. Basic Theory 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.


## 3.1.2. Moving Average: MA (q)

A qth-order moving average process: MA (q) is expressed as follows:(1)Yt=u+εt+θ1εt-1+θ2εt-2+⋯+θqεt-qwhereYt is the current value of ECS, u is a constant term, εt is the white noise sequence of ECS, and θ1,θ2,…,θq are the moving average coefficient.


## 3.1.3. Autoregression: AR (p)

A pth-order autoregressive process: AR (p) is expressed as follows:(2)Yt=c+ϕ1Yt-1+ϕ2Yt-2+⋯+ϕpYt-p+vtwhereYt-1,Yt-2,…,Yt-p, are, respectively, the value that lag 1st-order, 2nd-order, …, and pth-order of the ECS time series, c is a constant term, and {vt} is a white noise process.


## 3.1.4. The 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:(3)Yt=c+ϕ1Yt-1+ϕ2Yt-2+⋯+ϕpYt-p+θ1εt-1+θ2εt-2+⋯+θqεt-q+εtwhere the meaning of each parameter is the same as those mentioned above.


## 3.1.5. Autoregressive Integrated Moving 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 ECSYt is transformed into a stationary sequence Wt with d differences, Yt is a nonstationary sequence of d order. The ARMA (p, q) process is established for Wt; in this way, Wt is a ARMA (p, q) process, and Yt is an ARIMA(p, d, q) process.


## 3.1.6. 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,Qs 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.


## 3.2. NARNN for ECS Forecasting

### 3.2.1. Basic Theory

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
Example of the NARNN with one input, one hidden layer with 17 neurons, and one output layer with one output neuron and one output.Figure1 shows an example NARNN, y(t) is the input and output of the neural network, that is the time series of e-commerce sales, Hj 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, l 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 Section3.1.1 of ECS-ARIMA model.It can be described as follows:(4)yt=a0+a1yt-1+a2yt-2+a3yt-3+⋯+anyt-n+etwhereyt,yt-1,yt-2,yt-3,…,y(t-n) are, respectively, the value lag 0-order, 1st-order,…, and nth-order 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:(5)yt=fyt-1,yt-2,yt-3,…,yt-nDelay 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 byyi. The hidden layer calculates the output Hj of each neuron based on the connection weight wij and the threshold bi between the input data and hidden layer neurons.(6)Hj=f∑i=1nwijyi+bjj=1,2,…,lwhereHj 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, l is the number of hidden layer neurons, f is the activation function of the hidden layer, yi is the input of the ECS time series of the network, wij is the connection weight between the ith output delay signal and the jth neuron of the hidden layer, andbi is the threshold of the jth hidden neuron.The output layer gets the outputy(t) of the network through a linear calculation based on the output Hj of the hidden layer.(7)yt=f∑j=1lHjwj+bwherey(t) is the output of the network, f is the activation function of the output layer, wj is the connection weight between the jth neuron in the hidden layer and the neuron in the output layer, and b is the threshold of output layer neurons.


### 3.2.2. Forecasting of the ECS-NARNN Model

NARNN predictions in ECS-NARNN are recursive. The main idea of this method is to recycle 1st-step forward predictive value. The basic idea is that, as for the NARNN modelytn=f(ytn-1,ytn-2,…,ytn-d), the first prediction value ytncan be obtained when k=1; when it is added to the original samples (ytn-d,…,ytn-2,ytn-1), a new sample ytn+1 can be obtained for the two-step prediction valueytn+1; then we use the nonparametric model to get the new samples (ytn-d,…,ytn-2,ytn-1,ytn,ytn+1), repeating this continuous cycle until k is reached. Since the information contained in ytn,ytn+1,…,ytn+k-1 is used for the prediction of the kth step (k>1), the recursive prediction method is better than the direct prediction method.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.


## 3.2.1. Basic Theory

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
Example of the NARNN with one input, one hidden layer with 17 neurons, and one output layer with one output neuron and one output.Figure1 shows an example NARNN, y(t) is the input and output of the neural network, that is the time series of e-commerce sales, Hj 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, l 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 Section3.1.1 of ECS-ARIMA model.It can be described as follows:(4)yt=a0+a1yt-1+a2yt-2+a3yt-3+⋯+anyt-n+etwhereyt,yt-1,yt-2,yt-3,…,y(t-n) are, respectively, the value lag 0-order, 1st-order,…, and nth-order 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:(5)yt=fyt-1,yt-2,yt-3,…,yt-nDelay 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 byyi. The hidden layer calculates the output Hj of each neuron based on the connection weight wij and the threshold bi between the input data and hidden layer neurons.(6)Hj=f∑i=1nwijyi+bjj=1,2,…,lwhereHj 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, l is the number of hidden layer neurons, f is the activation function of the hidden layer, yi is the input of the ECS time series of the network, wij is the connection weight between the ith output delay signal and the jth neuron of the hidden layer, andbi is the threshold of the jth hidden neuron.The output layer gets the outputy(t) of the network through a linear calculation based on the output Hj of the hidden layer.(7)yt=f∑j=1lHjwj+bwherey(t) is the output of the network, f is the activation function of the output layer, wj is the connection weight between the jth neuron in the hidden layer and the neuron in the output layer, and b is the threshold of output layer neurons.


## 3.2.2. Forecasting of the ECS-NARNN Model

NARNN predictions in ECS-NARNN are recursive. The main idea of this method is to recycle 1st-step forward predictive value. The basic idea is that, as for the NARNN modelytn=f(ytn-1,ytn-2,…,ytn-d), the first prediction value ytncan be obtained when k=1; when it is added to the original samples (ytn-d,…,ytn-2,ytn-1), a new sample ytn+1 can be obtained for the two-step prediction valueytn+1; then we use the nonparametric model to get the new samples (ytn-d,…,ytn-2,ytn-1,ytn,ytn+1), repeating this continuous cycle until k is reached. Since the information contained in ytn,ytn+1,…,ytn+k-1 is used for the prediction of the kth step (k>1), the recursive prediction method is better than the direct prediction method.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.


## 3.3. The ARIMA-NARNN Combined Model

Based on the above basic theories of the ARIMA and NARNN models, a time series of ECSyt can be considered as comprising a linear autocorrelation structure Lt and a nonlinear component Nt. Therefore, yt can be expressed as (8)yt=Lt+NtThe 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 Section3.1.1 of ECS-ARIMA model.The steps of the ARIMA-NARNN combined model to predict are as follows.Step 1.
The linear componentL^t is predicted by modeling and forecasting the true time series of ECS yt by using the ARIMA model.Step 2.
The predicted residuals of the ARIMA model are obtained by(9)et=yt-L^t
The sequenceet implies a nonlinear relationship in the original time series:(10)et=fet-1,et-2,…,et-n+εt′
whereεt′ is a random error, et-1,et-2,···,et-n are, respectively, the value lag 1st-order, 2nd-order, …, and nth-order of et and f is the nonlinear autoregressive function.Step 3.
The NARNN model is used to approximate the nonlinear functionf, and then, the sequence et is predicted with the NARNN model. We set the predicted result as N^t.Step 4.
Combining the two models, the final prediction result of the ARIMA-NARNN combined model is as follows.y^t is the predicted sequence of ECS time series data:(11)y^t=L^t+N^tThe above process is shown in Figure2.Figure 2
The ARIMA-NARNN combined model principle.


## 3.4. Predictive Evaluation Method

We use the mean relative error (MRE), correlation coefficient R2, and root mean square error (RMSE) to evaluate the accuracy of fitting and prediction of each model. [27](12)MRE=1n∑i=1nyi-y^iyi×100%(13)R2=n∑i=1nyiy^i-∑i=1nyi∑i=1ny^in∑i=1nyi2-∑i=1nyi2n∑i=1ny^i2-∑i=1ny^i2(14)RMSE=MSE=1n∑i=1nyi-y^i2whereyi is the true value of ECS, y^i is the predictive value of ECS, and n is the number of ECS samples.


## 4. 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 Sections4.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.


### 4.1. 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 Figure3. This sequence shows dramatic fluctuations, with some tendency and the possible seasonality; therefore, the (S)ARIMA process is considered for this time series.Figure 3
Original time series graph of a single food item.The nonstationary sequence shown in Figure3 is differentiated, and the stationarity test of differential sequence is performed using the augmented dickey-fuller (ADF) test.From Table1, 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.Table 1
ADF test of first-order differential sequence.
Null Hypothesis: D(DLOGDATA) has a unit root Exogenous: Constant Lag Length: 5 (Automatic - based on SIC, maxlag=13)  t-Statistic Prob.∗  Augmented Dickey-Fuller test statistic -10.36760 0.0000  Test critical values: 1% level  -3.479656 5% level  -2.883073 10% level  -2.578331From Figure4, 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.Figure 4
Autocorrelation and partial autocorrelation functions graph of the first-order differential sequence.Figure 5
Real values and ARIMA model predictive values.


### 4.2. 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 coefficientR2 of training results are recorded as shown in Figure 6.Figure 6
MSE andR2 under different hidden neurons.From Figure6, as the number of hidden neurons increases, RMSE decreases firstly, and R2 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:Figure 7
The network residual autocorrelation map when the number of hidden neurons is 17.Figure 8
The error graph of the NARNN fitting model.From Figure7, 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 Figure9.Figure 9
Actual values and predicted values from ECS-NARNN.


### 4.3. ARIMA-NARNN for ECS Forecasting

ARIMA-NARNN combination prediction is mainly completed by the following:(1) Calculating the residual sequenceet=yt-Lt^.(2) Using the NARNN prediction to obtain the predicted sequence valueNt^ of the nonlinear prediction part based on the obtained residual sequence et.(3) Calculating the sales forecast resultyt^=Lt^+Nt^ 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 Figure10, 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.Figure 10
Error correlation diagram of using NARNN to fit the residual of ARIMA.Figure 11
Error of using NARNN to fit the residual of ARIMA.The errors of NARNN are shown in Figure11. 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.Figure 12
The prediction of using ARIMA-NARNN combined model and actual values.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 Figure13.Figure 13
Actual values and the predicted values from the three models.From Figure13, 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.


### 4.4. 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 Figure14.Figure 14
RMSE of 60 time series of e-commerce products from the ARIMA, NARNN, and ARIMA-NARNN models.It can be seen in Figure14 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.Table 2
Average of the MRE and RMSE for 60 e-commerce products of fitting and prediction.
Model Fitting error Prediction error MRE RMSE MRE RMSE ARIMA 0.0998 28.3451 0.1389 31.8082 NARNN 0.0879 19.1893 0.1016 25.5668 ARIMA-NARNN 0.0703 12.9549 0.09012 23.2321The fitting and forecasting performance of the three models for Jingdong’s weekly sales data is shown in Table2. 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.


## 4.1. 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 Figure3. This sequence shows dramatic fluctuations, with some tendency and the possible seasonality; therefore, the (S)ARIMA process is considered for this time series.Figure 3
Original time series graph of a single food item.The nonstationary sequence shown in Figure3 is differentiated, and the stationarity test of differential sequence is performed using the augmented dickey-fuller (ADF) test.From Table1, 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.Table 1
ADF test of first-order differential sequence.
Null Hypothesis: D(DLOGDATA) has a unit root Exogenous: Constant Lag Length: 5 (Automatic - based on SIC, maxlag=13)  t-Statistic Prob.∗  Augmented Dickey-Fuller test statistic -10.36760 0.0000  Test critical values: 1% level  -3.479656 5% level  -2.883073 10% level  -2.578331From Figure4, 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.Figure 4
Autocorrelation and partial autocorrelation functions graph of the first-order differential sequence.Figure 5
Real values and ARIMA model predictive values.


## 4.2. 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 coefficientR2 of training results are recorded as shown in Figure 6.Figure 6
MSE andR2 under different hidden neurons.From Figure6, as the number of hidden neurons increases, RMSE decreases firstly, and R2 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:Figure 7
The network residual autocorrelation map when the number of hidden neurons is 17.Figure 8
The error graph of the NARNN fitting model.From Figure7, 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 Figure9.Figure 9
Actual values and predicted values from ECS-NARNN.


## 4.3. ARIMA-NARNN for ECS Forecasting

ARIMA-NARNN combination prediction is mainly completed by the following:(1) Calculating the residual sequenceet=yt-Lt^.(2) Using the NARNN prediction to obtain the predicted sequence valueNt^ of the nonlinear prediction part based on the obtained residual sequence et.(3) Calculating the sales forecast resultyt^=Lt^+Nt^ 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 Figure10, 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.Figure 10
Error correlation diagram of using NARNN to fit the residual of ARIMA.Figure 11
Error of using NARNN to fit the residual of ARIMA.The errors of NARNN are shown in Figure11. 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.Figure 12
The prediction of using ARIMA-NARNN combined model and actual values.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 Figure13.Figure 13
Actual values and the predicted values from the three models.From Figure13, 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.


## 4.4. 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 Figure14.Figure 14
RMSE of 60 time series of e-commerce products from the ARIMA, NARNN, and ARIMA-NARNN models.It can be seen in Figure14 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.Table 2
Average of the MRE and RMSE for 60 e-commerce products of fitting and prediction.
Model Fitting error Prediction error MRE RMSE MRE RMSE ARIMA 0.0998 28.3451 0.1389 31.8082 NARNN 0.0879 19.1893 0.1016 25.5668 ARIMA-NARNN 0.0703 12.9549 0.09012 23.2321The fitting and forecasting performance of the three models for Jingdong’s weekly sales data is shown in Table2. 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.


## 5. 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.



---

*Source: 6924960-2018-11-19.xml*