In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "how to use R based on ARIMA model". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to use R based ARIMA model" can help you solve the problem.
1. Stationarity test
Draw the time sequence diagram of the annual relationship between the total retail sales of consumer goods in Henan Province. It can be seen from the picture that the total amount of retail sales of consumer goods increases year by year with the change of time.
Fig. 1 timing diagram of the original sequence
Fig. 2 the autocorrelation map of the original sequence makes the autocorrelation diagram of the original sequence, and makes two auxiliary dotted lines. It can be seen from the image that the coefficient is greater than zero for a long time, and the correlation between sequences is very strong. Then do the unit root test, we get a p value greater than 0.05, which we can say that the sequence is not significant, so we can judge that the sequence is non-stationary.
2. Difference operation
The first step is to make a first-order difference to the initial sequence, and we can get that the initial sequence to be studied is unstable. Fig. 3 after the first-order difference diagram of the original sequence makes the first-order difference to the initial sequence, it is found that the initial sequence is unstable, and then the second-order difference is made for the initial sequence. Fig. 4 second-order difference diagram of original sequence
The time series diagram of the sequence after the second-order difference fluctuates steadily near the mean. We can judge that the sequence is a stationary sequence, then we can go on to test the stationarity. Fig. 5 autocorrelation diagram of the sequence after the second order difference
To make an intuitive image as shown above, we make two additional auxiliary lines of dotted lines. By comparison, we can see that the autocorrelation map of the sequence after the second-order difference has short-term correlation. After the second-order difference, we do the unit root test again to verify whether the model is stable or not. the result of the unit root test of the sequence after the second-order difference is shown above, we see that the p value is less than 0.05, and we get that the model is significant. the sequence after the second-order difference is a stationary sequence.
The white noise test is continued after the second-order difference, and the results of the test are as follows. We get that the p value at this time is 0.004043, obviously, the result is less than the significant level, so from the above data results, we can conclude that the sequence after the first-order difference is a stationary non-white noise sequence, so we can do the next test.
3. Model order determination
Then we start to fit the ARMA model, then the fitting way is to construct a stationary white noise sequence to fit the trend, so that we can get the values of p and Q, determine the fitting value of the model, and finally determine the order of the model.
The first step begins to make a partial autocorrelation diagram of the model. Fig. 6 partial autocorrelation diagram of second-order difference sequence
The partial autocorrelation diagram of the sequence after making the second-order difference is shown above. First of all, a virtual auxiliary line is made. It can be clearly seen that the sequence has the characteristics of first-order truncation and partial autocorrelation map trailing. Build an ARIMA model for model analysis and research. The value of BIC information is calculated, and the order of the model is determined by the number with the lowest BIC value. The BIC figure is as follows. Fig. 7 BIC diagram
Based on the principle of BIC minimization, an ARIMA (1-1-1-0) model is established for the original sequence.
4. ARIMA model prediction
The time series model of ARIMA is used to predict the total retail sales of social consumer goods in Henan Province in the next five years. It is concluded that the total retail sales of social consumer goods in Henan Province from 2019 to 2023 are 21166.3, 21517.8, 21734.4, 21867.7 and 2.19498 trillion yuan respectively. Moreover, it can be seen from the forecast images that the total retail sales of consumer goods in Henan Province increase year by year with the increase of time. Fig. 8 Forecast of total retail sales of consumer goods figure # ARIMA Model R Program library (forecast) library (fUnitRoots) Data
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.