Introduction to Time Series
Time Series modelling is a fascinating area with practical relevance and impact. Time Series techniques work on numerical data collected over a considerable period of time. It is further used to generate future values of the series (termed as forecast). In a nutshell, predicting the future by understanding the past numerical observations is the key outcome of Time Series based techniques. Time Series forecasting can be applied in voluminous (data) areas such as economics, e-commerce, finance and banking. In light of data-driven software engineering, we have attempted to use some of the Time Series models in this field. Time Series is a popular and proven approach that is widely used across different business segments, such as:
- Finance – NSE Stock Exchange scripts data over a period of time
- Economics – Monthly data of unemployment
- Environment – Weather forecasting and daily temperature rate, etc.
- Ecommerce – Forecasting sales data, orders, and website hits data
I applied Time Series in the software engineering domain specifically in the testing, defects, and support phases. Some of the use cases I’m working on are the estimation of new test cases that are likely to be added to the repository on a yearly basis; to predict the support ticket volume on a daily basis, and forecast possible customer reported defects on a weekly basis.
Time Series graphs are plotted with varied granularity – hourly, weekly, monthly, and yearly
Seasonal and Non-Seasonal Patterns
Seasonality is a component of a Time Series, which defines the repetitive movement around the trend line in a specific period of time. It is measured for time intervals of days, weeks, months, or quarters.
Data of Airline Passengers has been used for the analysis here which is one of the base packages in R. This data has a seasonal variation of air passengers, monthly from 1949 to 1960.
Non-Seasonal Time Series doesn’t follow any trend. The Time Series data below is for airline passengers, with random observations over a 12-year period of data.
To estimate the trend component on seasonal or non-seasonal Time Series, Holt-Winters’ smoothing methods are used.
Holt-Winter is used for exponential smoothing to make short-term forecasts by using “additive” or “multiplicative” models with increasing or decreasing trend and seasonality. Smoothing is measured by beta and gamma parameters in Holt’s model.
- If the beta parameter is set to FALSE, the function performs exponential smoothing
- The gamma parameter is used for the seasonal component. If the gamma parameter is set to FALSE, a non-seasonal model is fitted
When the gamma and beta values are set between 0 and 1, the values close to 0 (zero) specifies that weight is placed on the most recent observations while constructing the forecast of future values. The example below shows the smoothing factor of Holt-Winters, trains 48 months defects data of builds, and forecasts the future for 12 months.