This paper takes Hongyong China as an example, extracts the data and uses the ARIMA algorithm to predict the time series.
Crawl data
# Crawl Line Kanhong China FundFrom BS4 import BeautifulSoupImport requestsheaders = {' Accept ': ' Text/javascript, Application/javascript, */*; q=0.01 ',' accept-encoding ': ' gzip, deflate ',' Accept-language ': ' zh-cn,zh;q=0.8 ',' Connection ': ' Keep-alive
, and then use the Arima method to predict (Arima method has three core parameters, the specific meaning and determine the parameters of the method to find the relevant articles of Arima)
From Statsmodels.tsa.arima_model import Arima
Model_arima = Arima (residual, (2,0,2)).
irregular changes, including strict random changes and irregular abrupt effects of sudden changes in two types of models
Combinatorial model addition model of time series: Y=t+s+c+i (y,t the same gross index of measurement units) (S,c,i deviations from long-term trends or positive or negative) multiplication model: y=t S. C. I (commonly used models) (Y,t Unit of measure the same total amount of indicators) (S,c,i to the original number of indicators to increase or decrease the percentage)
Yesterday with R toss a simple time series data Arima automatic fitting and prediction. The process is not complicated, but it is not used much, in order to prevent forgetting, the author records.
Open R and install a package called "Forecast". Each time you turn on R, use theLibrary (' forecast ')Load the package.
Here I use the legendary airline model data. Load data, convert to TS formatAirdataAirts
The then automatically fits the
The main purpose of time series analysis is to predict the future based on the historical data. such as food and beverage sales forecasts can be seen as a time series based on short-term data projections, the predicted object when the sales of specific dishes.1. Time Series algorithm:A common time series model;?2. Preprocessing of time series models1. For a pure random sequence, also known as the white noise sequence, there is no relationship between the sequence of the items, the sequence in a
The principle of what Baidu a bunch of search, do not understand, first learn to use this tool.ARIMA: All called autoregressive integral sliding average model (autoregressive integrated moving Average model, denoted Arima), is by Boxe (Box) and Jenkins (Jenkins) A famous time series prediction method was proposed in the early 70, so it is also called Box-jenkins model and Boxe-Jenkins method. Arima (P,D,Q)
Reprinted from http://blog.sina.com.cn/s/blog_70f632090101bnd8.html#cmt_3111974
Today study Arima prediction time series.
The exponential smoothing method is very helpful for forecasting, and it has no requirement for the correlation between successive values in the time series. However, if you want to use the exponential smoothing method to calculate the prediction interval, then the predictive error must be irrelevant, and it must be a normal distri
What is an Arima model
The full name of the Arima model is called the autoregressive moving average model, which is the full name (Arima, autoregressive Integrated moving Average model). Also known as Arima (P,D,Q), it is one of the most common models of statistical models (statistic model) used to predict time series
First look at the following picture:
This is the monthly price of crude oil from 1986 to 2006. It can be seen that after 2001 years, crude oil prices have a significant climb, then it is not reasonable to assume that the mean is a fixed value (constant), that is, the second stationary model in this case is too applicable. This is why we have this talk today.
To deal with this non-stationary data (for example, the mean in the above image is not a constant), a non-stationary model is required: su
First of all, from the point of view of time can be a series of basically divided into 3 categories:
1. Pure random sequence (white noise sequence), this time can stop the analysis, because it is like predicting the next coin which side is as irregular as possible.
2. Stationary non-white noise sequences , whose mean and variance are constants, for such sequences, there are mature models to fit the future development of this sequence, such as Ar,ma,arma (Specific model
, let's examine the smoothness of the final sequence.Adf.test (diff (Log (airpassengers)), alternative= "stationary", k=0)#这里可能会显示没有这个函数, need to install. Install.packages ("Tseries")#加在这个包, library (tseries)Augmented Dickey-fuller TestData:diff (log (airpassengers))Dickey-fuller = -9.6003, Lag order = 0,P-value = 0.01Alternative hypothesis:stationaryWe can see that this sequence is smooth enough to do any time series model.The next step is to find the correct parameters for the
Java merge sort algorithm, bubble sort algorithm, selection sort algorithm, insert sort algorithm, description of Quick Sort Algorithm, java bubbleAn algorithm is a set of clearly defined rules used to solve a problem within a lim
Algorithm Is a set of clearly defined rules used to solve a problem within a limited step. In layman's terms, it is the process of solving computer problems. In this process, no matter whether it is a problem-solving idea or writing
Program All are implementing certain algorithms. The former is an algorithm implemented by reasoning, and the latter is an algorithm
An algorithm is a set of well-defined rules that are used to solve a problem within a finite step. Popular point, that is, the process of computer problem solving. In this process, whether the formation of a problem-solving ideas or writing programs, are in the implementation of some kind of algorithm. The former is the algorithm of inference implementation, the
Page substitution occurs because of paged-request storage management, which is one of the ways to implement virtual storage management, where one feature is multiple--and multiple times the page is swapped in or out of memory.Best-performing page replacement algorithm: the best permutation algorithmThe more commonly used page substitution algorithms are: FIFO permutation algorithm, LRU permutation
Genetic Algorithm (GA), as a classical evolutionary algorithm, has formed a more active research field in the world since Holland was put forward. A lot of researches on GA are presented, and various improved algorithms are proposed to improve the convergence speed and accuracy of the algorithm. Genetic algorithm
The essence of the "algorithm path" is the classic algorithm, and the "algorithm path" AlgorithmThe essence of "algorithm path" in the classic algorithm Section
This book is written by Yan hengming, the author has another book, "The string of data structures", and "the phi
Introduction of Ant colony algorithm, genetic algorithm and simulated annealing algorithm
Exhaustive method
Enumerate all the possibilities and go on to get the best results. As figure one, you need to go straight from point A to point G to know that F is the highest (best solution). The optimal solution obtained by this alg
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.