DEV Community

Cover image for The Complete Guide to Time Series Model
Michael Obed
Michael Obed

Posted on

The Complete Guide to Time Series Model

Time series analysis comprises methods for analyzing time series data in order to extract meaningful statistics and other characteristics of the data while time series forecasting is the use of a model to predict future values based on previously observed values.

Combining time series analysis and time series forecasting we derive time series model which refers to data points ordered in time used in forecasting the future.

Forecasting Models

The tool used in conducting time series model is referred to as ARIMA an acronym for Auto Regressive Integrated Moving Average.

How ARIMA is applied
It is specified by three order parameters: p, d, q.
P refers to the number of autoregressive terms (AR)
d refers to how many non – seasonal differences are needed to achieve stationarity (I)
q refers to the number of lagged forecast errors in the prediction equation (MA)

Stationarity of Time Series

The stationarity of time series depends on:
• Mean
• Variance
• Co-variance

Image description

The variance of the series should not be a function of time.

Image description

The covariance of the i th term and the (i + m) th term should not be a function of time.

When the values are constant over a period of time.

Image description

Components Affecting Time Series

Trend
This is the increase or decrease in the series over a period of time. It persists over a long period of time.

Example: Population growth over the years can be seen as an upward trend.

Seasonality
Seasonality refers to the regular pattern of up and down fluctuations. It is a short –term variation occurring due to seasonal factors.

Example: sale of ice-cream increases on summer.

Cyclicity
This is a medium – term variation caused by circumstances, which repeat in irregular intervals.

Example: 5 years of economic growth, followed by 2 years of economic recession, followed by 7 years of economic growth followed by 1 year of economic recession.

Irregularity
This refers to the variations that occur due to unpredictable factors and also do not repeat in particular patterns.

Example: Variations caused by incidents like earthquakes, war, floods and other variations that have unpredictable factors.

**

Moving Average

**
The moving average model is probably the most simple approach to time series modeling. This model simply states that the next observation is the mean of all past observations.

Exponential Smoothing
Exponential smoothing uses similar logic to moving average, but this time, a different decreasing weight is assigned to each observation. In other words, less importance is given to observations as we move further from the present.
Mathematically, exponential smoothing is expressed as:

Image description

Alpha is a smoothing factor that takes values between zero and one. It determines how fast the weight decreases for previous observations.

Double Exponential Smoothing
Double exponential smoothing is used when there is a trend in the time series. In that case, we use this technique, which is simply a recursive use of exponential smoothing twice.
Mathematically:

Image description

Here, beta is the trend smoothing factor, and it takes values between zero and one.

Triple Exponential Smoothing
This method extends double exponential smoothing by adding a seasonal smoothing factor. Of course, this is useful if you notice seasonality in your time series.
Mathematically, triple exponential smoothing is expressed as:

Image description

Why Time Series Models?

There are a number of reasons why businesses and organizations through their respective Data personal conduct Time series analysis. The following are some of the applications of the Time Series Modeling.

_Forecasting Future Trends _
Based on previous data collected through time series models, businesses can predict how future trends may develop to protect their financial resources, explore new markets, restock inventory and perform other tasks.

Detecting Anomalies
Time series models also allow organizations to more easily spot data shifts that may signal unusual behavior or changes in the market.

Determining Patterns
Businesses that rely on seasonal sales, monthly online traffic spikes and other repetitive behavior can establish expectations based on time series models, gauging their overall health and performance.

Forecasting with Time Series Models

Healthcare
Time series models can be used to monitor the spread of diseases by observing how many people transmit a disease and how many people die after being infected.

Agriculture
Time series models take into account seasonal temperatures, the number of rainy days each month and other variables over the course of years, allowing agricultural workers to assess environmental conditions and ensure a successful harvest.

Finance
Financial analysts can leverage time series models to record sales numbers for each month and predict potential stock market behavior.

Cybersecurity
IT and cybersecurity teams can develop patterns in user behavior with time series models, allowing them to be aware of when behavior doesn’t align with normal trends.

Retail
Retailers may apply time series models to study how other companies’ prices and the number of customer purchases change over time, helping them optimize prices.

Top comments (0)