Bangda Sun

Practice makes perfect

Time Series Models Overview (1) - ARIMA

ARIMA Family.

1. Introduction

Recently I’m working on Anomaly Detection Problem. Our team is using a developed framework called NBM (Normal Behavior Modeling), intuitively we model on normal data - then when there are abnormal data, the model should tell us it get something different. There are many models could work: One-class SVM, AutoEncoder, Clustering, etc. At the very beginning we cannot get acceptable results using Basic AutoEncoder and Denoising AutoEncoder in NBM and we decide to find alternative models, and my direction is using classical statistical time series models. I think it’s reasonable for following reasons:

  • Some time series models assume the data to be stationary, which could be one of the assumption for normal data;
  • Most of the time series models are simple (linear), which could help us understand the relationships among features and easy to interpret.

2. ARIMA Family

  • AR - Autoregressive Model

Autoregressive model is simply a regression model plus a sequence model, where the output depends linearly on its own previous values. We denote a autoregressive model of order p as AP(p),

Yt=ψ0+i=1pψiYti+ϵt,

where ψi are the parameters of the model, ϵt is noise. If we denote a backshift operator B (or say lag operator), the model is equivalent with

Yt=ψ0+i=1pψiBiYt+ϵt.

With more mathematics, we can get

(1i=1pψiBi)Yt=ψ0+ϵt.

  • MA - Moving-average Model

For moving-average model, the output depends linearly on the current and previous value of a imperfectly predictable stochastic term. A Moving-average model with order q is denoted as MA(q),

Yt=θ0+i=1qθiϵti+ϵt,

by applying backshift operator B we have

Yt=θ0+i=1qθiBiϵt+ϵt=θ0+(1+i=1qθiBi)ϵt.

  • ARMA - Autoregressive Moving-average Model

ARMA model is denoted as ARMA(p,q) and it contains AR(p) and MA(q) models:

Yt=C+i=1pψiYti+i=1qθiϵti+ϵt.

  • ARIMA - Autoregressive Integrated Moving-average Model

ARIMA model is based on ARMA model, the difference is the data is the difference between current value and previous value. For example, if the data has linear trend, take a difference of the data will filter out the linear trend which satisfy the assumption of ARMA model. The model denoted as ARIMA(p,d,q), where d denote the number of difference operation.

dYt=C+i=1pψidYti+i=1qθiϵti+ϵt,

here d is the difference operator, for example 1st order difference is

Yt=YtYt1=(1B)Yt,

then 2nd order difference is therefore represented as

2Yt=(Yt)=(YtYt1)=YtYt1=(1B)Yt=(1B)2Yt.

and higher order difference is therefore

dYt=(1B)d1Yt=(1B)(1B)d1Yt=(1B)dYt.

  • ARIMAX - Autoregressive Integrated Moving-average Model with eXogenous Features

As the model become more complex, we denote it as ARIMAX(p,d,q,b), given by

dYt=C+i=1bβiXi,t+i=1pψidYti+i=1qθiϵti+ϵt,

here the Xi,t is external time series, the base version is just use the current value, we can definitely add previous values of exogenous features.

  • SARIMAX - Seasonal Autoregressive Integrated Moving-average Model with eXogenous Features

SARIMAX model is denoted as SARIMAX(p,d,q,b)×(P,D,Q,s), where s is periodicity of the time series. Here seasonal correction is applied by adding previous value with lag equal to multiple of periodicity (autoregressive) or previous noise term with lag equal to multiple of periodicity (moving-average). The seasonal AR and MA components in SARIMAX are

Seasonal AR(P): Yt=ϕ0+i=1PϕiYtis+ϵt,Seasonal MA(Q): Yt=λ0+i=1Qλiϵtis+ϵt.

For example we have monthly data with monthly periodicity, we should set s=12, SARIMAX(1,0,1,0)×(1,0,1,12) is

Yt=C+ψ1Yt1+ψ12Yt12+ϕ1ϵt1+ϕ12ϵt12+ϵt.

The general form of SARIMAX(p,d,q,b)×(P,D,Q,s) is

DdYt= C+i=1pψiDdYti+i=1qθiϵti+ϵt+ i=1PψisDdYtis+i=1Qθisϵtis+ i=1bβiXi,t.

To be continued …