Get this book -> Problems on Array: For Interviews and Competitive Programming

In this article, we will get an understanding of Time Series Data along with different types of time series, analysis and forecasting.

### Table of contents

- Introduction
- Time series data
- Types of time series
- Analysis and forecasting
- Applications

# Introduction

To determine what type of data we are working with, we analyze what component we need to identify a unique record in our dataset. Based on this we can categorize our data as time series, cross-section and panel. If we need only a timestamp to identify a unique record, then it may be time series data. If we need any other element than a timestamp, then it may be cross sectional data. If we need both a timestamp and another determining factor like register number or ID, then it may be a panel data.

In **time series**, we have a collection of observations of a single entity at different time intervals. Here, we distinctly have 'time' as an axis and this axis plays a major role. Eg: Sales of 4 ice cream flavors in Seattle on every Saturday.

In **cross-sectional data**, our data consists of observations of many entities at a single point in time. Eg: Sales of the same 4 ice cream flavors in Seattle, Berlin and Shanghai on Christmas day in the year 2020.

**Panel data** is a collection of observations of many entities at multiple time periods. It is also known as cross-sectional time series data as it is a combination of the two. Eg: Sales of the same 4 ice cream flavors in Seattle, Berlin and Shanghai on every Saturday.

# Time series data

As we discussed previously, when our data has observations for a single entity where the data points are ordered in time, it is referred to as time series data. Given below is an example of time series.

The time intervals may or may not be equally be spaced. It is known as **regular time series** if the data points are at regularly spaced time intervals. For example: weekly weather data and stock data on the hour over the business day. Else, it is called **irregular time series**. For example: event logs. If our data contains only one variable that is varying over time, then it becomes **univariate time series**. If there is more than one variable changing with time, it is known as **multivariate time series**.

# Types of time series

There are four broad types of time series:

- Deterministic time series
- Non-deterministic time series
- Stationary time series
- Non-stationary time series

## Deterministic time series

When our time series does not contain probabilistic aspects and can be expressed by an analytical expression, it is known as deterministic time series. With the help of this expression, we can predict its behavior in future and also get to know how it behaved in the past.

*y _{i} = ci + Îµ* is an example of linear deterministic time series. This will basically produce a straight line in time, with some tiny fluctuations at each point.

## Non-deterministic time series

When our time series contains probabilistic aspects and cannot be expressed by an analytical expression, it is known as non-deterministic time series. Since it has a random aspect, it follows the laws of probability and the data is defined by distributions, variances, averages and other statistical expressions. Example: an electroencephalogram (EEG) time series.

## Stationary time series

When different statistical properties of a time series such as mean, variance,etc., do not depend on time, it is known as stationary time series. Here, we can simply conclude that the statistical properties have been same in the past and will remain the same in future, and are simpler to predict.

## Non-stationary time series

When different statistical properties of a time series change over time, it is known as non-stationary time series. Presence of a seasonal component, cyclical component, random component, etc., makes a time series non-stationary.

# Analysis and forecasting

Time series analysis (TSA) is the method of analyzing time series data and extracting useful insights and other valuable statistical information from it, by using statistical methods. It is useful for forecasting as TSA helps us find the nature of the time series and also examine how a certain data point changes when other influencing variables are changed over a time period.

Time series forecasting is using historical values to predict future observations. Here, data regarding the past observations are fed into the ML model as the training set and the future activity is predicted by the model. Some time series forecasting methods include trend analysis, cyclical fluctuation analysis and seasonal pattern analysis.

# Applications

Time series is widely used in many areas such as finance, marketing, healthcare industry and many more.

- In the finance sector, time series analysis is used for price estimation, inventory analysis, stock market analysis and business forecasting.
- In healthcare industry, it is used for patient monitoring and predicting insurance benefits.
- Astronomy heavily relies on time series to discover variable stars and observe transitory events.
- Time series is used in weather forecasting for temperature estimation, climate change and to identify seasonal shifts.
- Time series is also used to predict network usage, detect anomalies in the network and in predictive maintenance.

With this article at OpenGenus, you must have the complete idea of Time Series Data.