AR (Autoregressive model) _ Time series of time series

Source: Internet
Author: User

A sequence is recognized as a stationary non white noise sequence after preprocessing, which indicates that the sequence is a stationary sequence containing relevant information. In statistics, we usually establish a linear model to develop the sequence, and to extract useful information from the sequence, Arma is the most commonly used stationary sequence fitting model. AR model

Models with the following structures are called P-order Autoregressive models:

At that time, the Autoregressive model was also called the Central AR (p) model, and the non-central AR (p) sequence could be transformed into a central AR (p) sequence through the following transformations. The essence of the central change is a constant displacement of the whole translation of the unstructured sequence, which has no effect on the correlation relationship between the sequence values, so it can be simplified to analyze the relationship between AR model and its central model in the future. The smoothness difference of AR model

In order to fit the development of a stationary sequence, the model used to fit is obviously also stable. AR model is one of the usual fitting models of stationary sequences, but not all AR models are balanced.
R provides a variety of sequence fitting models, which are two of the most commonly used. Arima.sim function Fitting

This is a handy sequence fitting function that can fit the equilibrium ar sequence, MA sequence, balanced arma sequence, and Arima sequence.
In-style:
Arima.sim (N,list (ar=, ma=, order=), sd=)

-N: Fit sequence length
-list: Specifies the specific model constants, where:
(1) to fit the stationary AR (p) model, the regression coefficients should be given. If the fitting AR model is specified as Non-stationary, the system will make an error.
(2) to fit the MA (q) model, the moving average coefficient is given.
(3) to fit the stationary Arma (P,Q) model, it is necessary to give the regression coefficient and the moving average coefficient. If you specify a fitted Arma model as a nonstationary model, the system will make an error.
(4) Fitting Arima (P,D,Q) model, in addition to the need to give the autoregressive coefficient and moving average coefficient, also need to add order options. Order = C (p,d,q), p is autoregressive coefficient, D is difference coefficient, q is the moving average.
-SD: Specifies the standard deviation of the sequence, not specifically specified, system default: SD = 1.

The filter function can fit the AR sequence (whether stationary or not) and the MA sequence. The command format for the filter function is:
Filter (e,filter =,method =,circular =)

-e: Variable names for random wave sequences
-filter: Specify model coefficients, where
(1) AR (P) model is filter = C (O1,o2,..., op);
(2) The MA (q) model is filter = C (1,-o1,-o2,...,-OQ);
-method: Specify the fitting AR model or MA model
(1) method= "recursive" as AR model
(2) method= "convolution" as MA model
-circular: An option dedicated to fitting the MA model, circular = T, to avoid the presence of NA data.

The sequence values of the following four sequences are examined and the sequential graphs are plotted:

(a) the first formula

X1 = Arima.sim (n=100,list (ar=0.8))
Ts.plot (x1)


We can see that this model is stable.
(iii) A third formula

x3 = Arima.sim (N=100,list (Ar=c (1,-0.5)))
Ts.plot (x3)


We can see that this model is stable.
(b) A second formula

E = Rnorm (m)
x2 = Filter (E,filter = -1.1,method = "recursive")
Ts.plot (x2)


We can see that this model is non-stationary.

(iv) Fourth formula

E = Rnorm (m)
x4 = filter (e,filter= c (1,0.5), method = "recursive")
Ts.plot (x4)


We can see that this model is stable.

The graphic method is a rough visual discriminant method, we have two accurate stationary difference methods: characteristic root discrimination and stationary domain discrimination.

Distinguishing characteristic roots
In fact, the p characteristic root of AR (p) model is required to be in the unit circle, so the necessary and sufficient condition of the AR (p) model to be stationary is that its p characteristic root is in the unit circle.
According to the reciprocal property of the roots of the eigenvalue and the polynomial of autoregressive coefficients, the equivalence criterion of the AR model is the root of the polynomial of the autoregressive coefficients of the AR model, all in the unit circle.

Stationary field Differences
For an AR (p) model, if there is no requirement for smoothness, it also means that there is no restriction on the parameter vectors, they can take any point of the P-dimensional Euclidean space, but if the stationary limit is added, the parameter vectors can only take a subset of the p-dimensional Euclidean space, so that the feature root is set in the coefficients of the unit circle. A stationary field called the AR (p) model.
It is more convenient to judge the low order AR model by stationary domain method.
(1) the AR (1) Stationary field is " -1,1"
(2) the AR (2) Stationary field is a triangular type region

The characteristic root method is used to discriminate three models respectively:

Properties of self-correlation coefficients for distinguishing characteristic roots from stationary domains

1. One is trailing sex.
2. Exponential attenuation.
The autocorrelation diagram of the following four stationary AR models is examined.

X1 = Arima.sim (n=1000,list (ar=0.8))
ACF (x1)

x2 = Arima.sim (N=1000,list (ar=-0.8))
ACF (x2)

x3 = Arima.sim (N=1000,list (Ar=c (1,-0.5)))
ACF (x3)

x4 = Arima.sim (N=1000,list (Ar=c ( -1,-0.5)))
ACF (x4)


As you can see from the diagram, these four stationary AR models, whether they are AR1 model or AR2 model, whether their characteristic root is real roots or complex root, are positive root or negative root, their autocorrelation all presents the drag-tail property and exponential attenuation to the near zero value.
However, due to the different characteristics of the root, their autocorrelation coefficients of the attenuation mode is not the same, some autocorrelation coefficients are exponential attenuation to 0 (such as model 1), some positive and negative attenuation (such as Model 2), and some autoregressive coefficients exhibit similar periodic cosine attenuation, i.e., "pseudo-periodic" characteristics (e.g. Model 3), These are the common characteristics of the self correlation of stationary models. Partial correlation coefficient

For a stationary AR (p) model, the delay k autocorrelation coefficient is calculated, it is not really a simple correlation between x (t) and X (T-K), because X (t) is also affected by the intermediate (k-1) random variable, and this (k-1) random variable is related to X (T-k). Therefore, the autocorrelation coefficient is actually doped with other variables related to X (k) and X (T-k), in order to measure the effect of X (T-k) on X (k) alone, the probability of the introduced partial autocorrelation coefficient.
The partial autocorrelation coefficients of the Stationary AR (p) model have P-step truncation.

PACF (x1)
PACF (x2) PACF (x3) pacf (
x4)







Because of the randomness of the sample, the sample bias autocorrelation coefficient is not as strict as the theoretical partial autocorrelation coefficient. However, it can be seen that the samples of the two AR (1) models are not 0, 1 are approximately 0, and the partial autocorrelation coefficients of the samples of two AR (2) models are approximate.
is zero. The partial autocorrelation graph of the sample can be used to validate the truncation of the partial autocorrelation coefficient of AR model visually.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.