[PYTHON] Time series analysis 2 Stationary, ARMA / ARIMA model

Aidemy 2020/10/29

Introduction

Hello, it is Yope! I am a liberal arts student, but I was interested in the possibilities of AI, so I went to the AI-specialized school "Aidemy" to study. I would like to share the knowledge gained here with you, and I am summarizing it on Qiita. I am very happy that many people have read the previous summary article. Thank you! This is the second post of time series analysis. Nice to meet you.

What to learn this time ・ About stationarity ・ About ARMA / ARIMA model

Stationarity

What is stationarity?

-In time-series data, __ "always fluctuates and changes with a constant value around a constant value regardless of the passage of time" __ is expressed as __ stationarity . -It is necessary to visually check whether the data has the above characteristics by visualizing the data once to check whether it has stationarity. -In time series analysis, if a time series without stationarity is treated as it is, a meaningless correlation ( spurious correlation ) may be detected, so it is converted to a time series with stationarity. There is a need.

Weak stationarity / strong stationarity

-__Weak stationarity __ means that the __expected value and autocovariance of time series data are always constant __. ・ Since the expected value is constant, it can be said that "always a constant value is the axis", and since the autocovariance is constant, it can be said that "it fluctuates and changes within the same range", so it is stationary. It can be said that there is a certain state.

White noise

-White noise means that the expected value is 0, the variance is constant, and the covariance is 0 at all __ (weak stationarity). -Of the patterns of the time series model, __irregular fluctuation (error) __ is difficult to express mathematically, so white noise is used to deal with it.

ARMA / ARIMA / SARIMA model

About ARMA / ARIMA / SARIMA model

-__ ARMA / ARIMA model __ is a model used when performing time series analysis. -There is also a model called __SARIMA __ in these two types of developments, and finally the SARIMA model will be used for time series analysis. -The ARMA / ARIMA model is a combination of the models __ "AR" and "MA" __. This will be described in detail in the following sections.

AR model

-In the AR model, an autocorrelation is created by expressing __the time-series data "yk" at a certain point in time k using the data "yk-1" at the previous point in time __. -Since the data value is regressively estimated from the past value in this way, the AR model is also called __ "autoregressive model" __. At this time, when the next data is predicted using the past p data, it is expressed as __AR (p) __.

MA model

-In the MA model, an autocorrelation is created by __ expressing the white noise "εk" in the time series data at a certain point in time using the previous white noise "εk-1". -Since white noise shows irregular fluctuations (errors), it can be said that the MA model is __ a model that is affected by past errors. At this time, when predicting the next data using the past q errors, it is expressed as __MA (q) __.

ARMA model

-As mentioned above, the ARMA model is a model made by combining the AR model and the MA model. -When AR (p) and MA (q) are combined, it is expressed as __ARMA (p, q) __.

ARIMA model

-The ARIMA model is an "ARMA model that converts the data passed in the original series into a difference series". -The ARMA model to which the original series is passed can handle only stationary data and processes, but the ARIMA model that converts to a difference series can also handle non-stationary data and processes.

-When the model is ARMA (p, q) and the difference at the time of conversion is d (the difference is taken before the d point), it is expressed as __ARIMA (p, d, q) __. -At this time, "p" is called __autocorrelation degree __, "d" is called __induction __, and "q" is called __moving average __.

Summary

-Weak stationarity means that the __expected value and autocovariance of time series data are always constant. -White noise means that the expected value is 0, the variance is constant, and the covariance is 0 at all __. -There are ARMA model and ARIMA model as models used when performing time series analysis. These models are made by combining the AR model and the MA model, and since the ARIMA model converts the data into a step difference series, it can handle non-stationary data.

This time is over. Thank you for reading until the end.

Recommended Posts

Time series analysis 2 Stationary, ARMA / ARIMA model
Python: Time Series Analysis: Stationarity, ARMA / ARIMA Model
I tried time series analysis! (AR model)
Time series analysis Part 2 AR / MA / ARMA
Time series analysis 4 Construction of SARIMA model
[Statistics] [Time series analysis] Plot the ARMA model and grasp the tendency.
Python: Time Series Analysis
RNN_LSTM1 Time series analysis
Time series analysis 1 Basics
Python: Time Series Analysis: Building a SARIMA Model
Time series analysis related memo
Fitting to ARMA, ARIMA model
Time series analysis part 4 VAR
Time series analysis Part 3 Forecast
Time series analysis Part 1 Autocorrelation
Python: Time Series Analysis: Preprocessing Time Series Data
Time series analysis practice sales forecast
Time series analysis 3 Preprocessing of time series data
Time series analysis # 6 Spurious regression and cointegration
Time Series Decomposition
Introduction to Time Series Analysis ~ Seasonal Adjustment Model ~ Implemented in R and Python
I implemented "Basics of Time Series Analysis and State Space Model" (Hayamoto) with pystan
Python 3.4 Create Windows7-64bit environment (for financial time series analysis)
Python time series question
Display TOPIX time series
Time series plot / Matplotlib
Challenge to future sales forecast: ② Time series analysis using PyFlux
A study method for beginners to learn time series analysis
Challenge to future sales forecast: ⑤ Time series analysis by Prophet
Challenges for future sales forecasts: (1) What is time series analysis?
Time series analysis using a general Gaussian state-space model using Python [Implementation example considering exogenous and seasonality]