### Type to search # Time series: steps involved in time series modeling

##### Share ## Steps involved in time series modeling

Check for stationary or Non-Stationary – Now What is Stationary OR Non-stationary ?

Stationary:- A series is said to be stationary if it’s mean and variance is constant over a time of period. If a series does not follow any pattern

Non- Stationary:- A Series is said to be Non-stationary if it follows some pattern like trend, seasonality, cyclic, Randomness (In General, In time series there are only two pattern Trend and Seasonality)

Trend, Seasonality, Cyclic, and Randomness are also known as time series component

The Next Step is about fixing making a non-stationary series to a stationary series.

### 2. Techniques to Make a series stationary from non-stationary:-

Differencing:- This is a very common and best approach to make a series stationary from non-stationary. It is done by substracting previous observations from the current observations. Many times we are required to perform many rounds of differencing to eradicate the patterns from our series.

Smoothing – After plotting or using some statistical tests if you come across with non-stationary situation or find some pattern in data you can use smoothing techniques to fix it. Exponential smoothing techniques – It assigns exponentially decreasing weights from newest to older. Means it Older data(observation) is given less weight, New Observations are given more weights

Simple Exponential Smoothing – It uses a weighted moving average with exponentially decreasing weights.

```St = αyt-1 + (1 – α) St-1
```

#### Hyperparameters:

Alpha: Smoothing factor for the level.

Double Exponential Smoothing:– If you find a trend in your series you can use Double exponential smoothing technique.

```bt = γ(St – St-1) + (1 – γ)bt-1
```

#### Hyperparameters:

Alpha: Smoothing factor for the level.

Beta: Smoothing factor for the trend.

Phi: Damping coefficient.

Triple Exponential Smoothing Technique:- If your series or data shows trend and Seasonality, use Triple exponential smoothing technique, In this Technique, In addition to the alpha and beta smoothing factors, a new parameter is added called gamma (g) that controls the influence on the seasonal component.

### Hyperparameters:

Alpha: Smoothing factor for the level.

Beta: Smoothing factor for the trend.

Gamma: Smoothing factor for the seasonality.

Phi: Damping coefficient.

Period: Time steps in the seasonal period.

Other Techniques to fix non-stationary series are POWER TRANSFORMATION, MA smoother

### 3. After fixing or making our Non Stationary series to a stationary- It is time to build or decide which model to use. There are many times of Models in Time series

AR (Auto-Regressive)– We will use this model if we want to forecast new value based on previous value. It has just one parameter P (It is order)

AR – We write this if the current value is based on 1 previous value, AR if the current value is based on 2 previous values, etc.

MA (Moving Average) We will use this model if we want to forecast taking error term. It has one parameter q, where q is the number of lags

```yt = f{et, et-1, et-2....}
```

et is error term or white noise with a time interval

ARMA ( Auto-Regressive and moving average) – This model forecast new value by taking previous value as well as error term. it has two parameters p and q

ARIMA( Auto-Regressive integrated moving average) – This model is basically used if data is non-stationary because it has a parameter d (stands for differencing which is one of the techniques to make a non-stationary to stationary) is basically I integration.

Once our data is Stationary we use ACF, PACF to know which model to use

ACF plot – Autocorrelation function plot. It is also a plot that shows autocorrelation if it finds a positive autocorrelation at lag 1 we can go with the AR model If negative autocorrelation at lag 1 we can go with MA.

PACF Plot– It shows the degree of autocorrelation or strength of the relationship

Above we understood about ACF and PACF plot- Now let’s understand their functions

ACF stands for Autocorrelation function- It helps us to find difference between the observation at the current time spot and the previous time spot.

PACF stands for Partial Autocorrelation function – It does the same thing as ACF-adding a few extra points like PACF calculate the influence of other previous days value on current value.

After deciding the model, You can pick a model to forecast, or you can also try with many models for the same data. and check its correctness by using metrics like AIC and BIC- Consider a model as good if it gives the lowest AIC or BIC.