# Time series prediction in Statistical Science (1)

Time：2021-7-15

Prediction is an important application scenario of time series related knowledge. As we said before [time series data (Part 1)], time series can be divided into stationary time series and non-stationary time series. Today, this article mainly introduces the prediction methods of stationary time series.

The so-called stationary time series means that with the passage of time, it is necessary to study that the value of the index does not change, or fluctuates in a small range. Quantitatively speaking, the mean and variance of the index do not change over time. For example, the figure below shows that the mean and variance remain unchanged over time. For this kind of time series, there are three forecasting methods: simple average method, moving average method and exponential smoothing method.

# 1. Simple average method

The simple average method, just like its name, is to simply average the existing data and take the average value as the forecast value of the next period.

For example, there are annual GDP values from 2000 to 2017 in China. The simple average method is to average the GDP values before 2018, and then use the average value as the GDP forecast value in 2018. # 2. Moving average method

The simple average method is suitable for the situation that the data in different periods basically remain unchanged, but if the simple average method is used for some periodic time series, the error will be very large. At this time, we can consider the moving average method. The moving average method does not use all the existing values to average, but uses the latest values to average.

For example, we can average the GDP from 2015 to 2017 and use the average value as the forecast value for 2018. Compared with the simple average method, the moving average method is more accurate than the simple average method.

We think that the closer the value is to the future, the greater the impact on the future, that is, it should occupy a greater weight in the predictionBased on the moving average method, different values are given different weights, and the weighted average value is used as the future prediction value.

For example, we still average the GDP from 2015 to 2017, and give the weights of these three years as 1, 2 and 3 respectively, and finally take the weighted average value as the forecast value of 2018. It can be seen that the accuracy of weighted moving average is higher than that of ordinary moving average.

The core of the weighted moving average method is how much to move and how much weight should be set for each period. This needs to be tested to see which value corresponds to a higher accuracy.

# 3. Exponential smoothing method

In fact, exponential smoothing is a special weighted average. In our previous moving weighted average, the weight of each period is given manually. In the exponential smoothing method, the weight of each period increases exponentially. The closer it is to the future, the higher the weight. The prediction model of exponential smoothing is as follows: XT + 1 is the predicted value of phase t + 1, and x1, X2 and XT are the actual values of phase 1, phase 2 and phase t, α For the weight value of each period, it should be noted that the last item is (1- α)， instead of α( 1- α)。

For example, we are still smoothing the GDP from 2015 to 2017 exponentially, so that α= 6, and take the final smoothing result as the forecast value of GDP in 2018. It can be seen that the accuracy of exponential smoothing is higher than that of weighted moving average.

The core of exponential smoothing is α It is worth to choose, and the specific number also needs to pass the test, and the corresponding accuracy is relatively high.

The above is about the prediction method of stationary time series correlation. We will introduce the prediction method of trend time series correlation in the next article.

## Detailed steps for installing Perl and Komodo IDE for windows

Perl official website: https://www.perl.org/Perl document: https://perldoc.perl.org/Download address: https://www.perl.org/get.html The installation package of Perl Windows version is divided into activestate Perl and strawberry Perl. For the difference between the two, see: http://www.zzvips.com/article/202134.htm Note: the download speed of activestate Perl is slow. You may need KX to surf the Internet I have uploaded all the versions of […]