Time-series

Time series is series of Data points plotted with respect to time.

Beginner’s guide to time series analysis

By Andrew Sam

There are high chances that you have interacted with time series data even if you are not a data scientist. Whether you are looking at Stock prices or weather records every time dependent data qualifies for time series analysis. In this article we will cover basics of time series data, how it is analyzed and various examples. 

What is time series data?

Any non-stationary value that is dependent on time can be a part of time series. We can consider time series analysis as inferring about what has happened to certain data points in past and trying to predict the future based on the same. 

If this concepts sound similar it is because you have recorded time series data in your day-to-day life. It could be when you record your calories burnt in a day through your smart watch or whether you are maintaining records of your expenses on day-to-day basis.  Time series data can have different granularity. It can be hourly, weekly, monthly or yearly. Sometimes we even have second or minute data. 

What are the components of time series data?

Any time series data can include one or more of the following mentioned components: 

Source: https://github.com/ashishpatel26/ML-Notes-in-Markdown/blob/master/11-TimeSeries/01-Introduction.md 

Trend:

A trend can be referred to as long term consistent upward or downward movement in a series. A trend in which the cause is identifiable is called deterministic trend and trend in which cause is un-identifiable is called stochastic trend.  

Cycle:

Cyclic behaviors can be considered as up and down movement that happens around the trend. Cycles are not bound to show regularity with respect to time. The first cycle may reach the peak in 5 hours whereas the second cycle may reach peak in 10 hours. 

Seasonality:

Seasonality refers to variations that occur at predictable and fixed frequency. Unlike Cycles if the first pattern reaches peak in 5 hours it necessary in seasonality that second pattern also reaches peak in 5 hours. For example, cold-drinks sales must be highest in summer season every year, as more people will be consuming it to manage warmer weather. 

Noise:

Noise can be considered as whatever is left over when you take out trends or seasonality from the pattern. It is also referred as irregularity. Noise can be random and unpredictable. 

What are anomalies and their types in time series?

A data point that is too far from the rest can be considered as an anomaly. Real world example of it could be when amount of electricity generated by a plant is plotted and during particular days the electricity generation is very low due to any natural disaster. Anomalies can be generally of two types – contextual and collective anomalies. Contextual anomalies are common in time series data and abnormality is context specific. For example – large number of increase in tourist during holiday season can be considered normal. When a set of data instances collectively help to detect an anomaly are called Collective anomalies. When same Ip address is requesting a particular web page many times it could be considered as bot attack and query could be flagged. 

What does Irregular time series mean?

When data is plotted at consistent time intervals then it is called as regular time series. Contrary to this when data is plotted at random time intervals then it is called as irregular time series. Some of the example of irregular time series could be a phone sensor collects data only when device is picked up, another example could be ATM records a transaction only when there is withdrawal of cash. Both the above events are not necessarily happening at perfect intervals of time. 

What is difference between Additive and Multiplicate time series?

In additive time series changes overtime are consistently made by same amount, whereas this is not the case in Multiplicate time series. In case of additive value can be considered as – base level + trend + seasonality + error but in case of multiplicate it would be –base level * trend * seasonality * error. Generally additive series shows a linear trend and straight line, whereas multiplicate series shows non-linear trend and curved line. Additive series shows linear seasonality which has same frequency and amplitude. On the other hand, multiplicate series shows non-linear seasonality which has increasing/decreasing frequency and/or amplitude. 

What is the difference between time series data and cross-sectional data?

Time series can be easily spotted as there is only one variable that is plotted with respect to equal time periods. Whereas case is different for cross-sectional data. In cross-sectional data generally there are multiple variables that are tracked during fixed period of time. Cross-sectional data gives more importance on comparing various entities among themselves rather than comparing entity throughout various time periods.  

Example of cross-sectional data could be comparison of average income of several cities during a particular period. Whereas example of time series data could be changes in average income of Mumbai with respect to months throughout year. We can also combine time series data with cross-sectional data, the resulting data is called panel data and can be used to track effect of social benefits on employment rate over period of time. 

What is time series analysis used for?

As we know that time series analysis is used to track variations of particular variable with respect to time. Based on the past data, intelligent conclusions could be made to understand behaviors across various industries like finance, retail, real-estate, e-commerce and many more.  

Time series could be used for forecasting purposes, for example – decades of weather data could be used to forecast the monsoon this year. It helps us to decide future values based on past values, for example – based on retail products sale throughout past year, it’s price could be decided based on demand. With the help of time-series you could pin-point the fraudulent activities, for example – based on the previous years’ time series any unusual activity in this years’ time series could be traced easily. 

Conclusion

Here in this article, we have briefly discussed about time series and its components. This article will help you to lay a foundation and study more about time series. There are many important concepts like SARIMA and ARIMA in time series forecast modeling which are very important, we have covered them in our upcoming articles.