Time Series Forecasting 101

Nadeem
Analytics Vidhya
Published in
4 min readJun 14, 2021

A time series is a sequence of observations taken sequentially in time.

Time series forecasting uses information regarding historical values and associated patterns to predict future activity. Most often, this relates to trend analysis, cyclical fluctuation analysis, and issues of seasonality.

Observation of trend, seasonality, and random

Why Time Series Forecasting?

If the independent variables are

  • Unknown
  • Not available
  • Might not fit the data
  • Difficult to forecast

Typical Time Series

Components of Time Series

  • Trend
  • Seasonality
  • Random Components

The trend

The first component to extract is the trend. There are a number of ways you can do this, and some of the simplest ways involve calculating a moving average or median.

The seasonality

Seasonality will be cyclical patterns that occur in our time series once the data has had trend removed.

Of course, the way to de-trend the data needs to additive or multiplicative depending on what type your time series is. Since we don’t know the type of time series at this point, we’ll do both.

The random/remainder

Now that we have our two components, we can calculate the residual in both situations and see which has the better fit.

Decomposing Time Series into the 3 components

CURVE FITTING / REGRESSION ON TIME METHODS

Regression on Time

Use when the trend is the most pronounced

Incorporating Seasonality — Dummy Variable Approach

Seasonal Regression Models

Incorporating Seasonality — Another Approach

• Take the trend prediction (ŷ) and the actual value (𝑦).
• Depending on additive or multiplicative model, compute the deviation

(𝑦 − ŷ, if additive or 𝑦/ŷ, if multiplicative) and map it as seasonality effect

for each prediction.

  • Take averages of the seasonality value. Use this to make future predictions.

Seasonality

Seasonality is a common characteristic of time series. It can appear in two forms: additive and multiplicative. In the former case the amplitude of the seasonal variation is independent of the level, whereas in the latter it is connected. The following figure highlights this:

Additive and Multiplicative seasonality
  • If the seasonality compenet is steady use Additive seasonality
  • If the seasonality compenet is not steady then go with Multiplicative seasonality
  • Note that in the example of multiplicative seasonality the season is becoming “wider”.

Obviously if the level was decreasing the seasonal amplitude of the multiplicative case would decrease as well.

For selecting the appropriate model to produce our forecasts we need to know the type of seasonality we are dealing with.

Let’s select the additive seasonality.

  • In an additive time series, the components add together to make the time series. If you have an increasing trend, you still see roughly the same size peaks and troughs throughout the time series. This is often seen in indexed time series where the absolute value is growing but changes stay relative.
Additive Seasonality

Now, Let’s See how multiplicative seasonality

  • In a multiplicative time series, the components multiply together to make the time series. If you have an increasing trend, the amplitude of seasonal activity increases. Everything becomes more exaggerated. This is common when you’re looking at web traffic.
Multiplicative seasonality

Issues with Regressing on Time

  • If there is no trend or if seasonality and fluctuations are more important than trend, then the coefficients behave weirdly

Let’s explore more on the limitations in upcoming blogs.

  • Holt-Winters
  • ARIMA
  • ARIMAX
  • SARIMA

References:

https://kourentzes.com/forecasting/2014/11/09/additive-and-multiplicative-seasonality/

Happy Learning!

--

--