# Time series Forecasting Techniques

One of the most often used data science methods in business, finance, supply chain management, production, and inventory planning is time series forecasting. A time component is often present in prediction difficulties, necessitating the extrapolation of time series data or time series forecasting. Another crucial field of machine learning (ML) is time series forecasting, which may be viewed as a supervised learning issue. It can be subjected to ML techniques including regression, neural networks, support vector machines random forests, and XGBoost. Using models created from historical data to anticipate future observations is known as forecasting. Forecasting or predicting the future value over a period of time is known as time series forecasting. It involves creating models based on historical data and using them to draw conclusions and direct future tactical decisions.

On the basis of the past, the future is predicted or estimated. A time order dependency between observations is added by time series. This reliance functions as a source of more knowledge as well as a limitation. Let’s define time series prediction more precisely before talking about time series forecasting techniques.

A method for predicting events over a period of time is called **time series forecasting. **It makes predictions based on historical tendencies, presuming that historical trends will continue.

**It is employed in numerous applications and many different disciplines of research, including:**

- Astronomy
- Business strategy
- Engineering control
- Earthquake forecast
- Econometrics
- Computational Finance
- Pattern identification
- Allocation of resources
- Processing of signals
- Statistics
- Weather prediction

A historical time series is the foundation of time series forecasting. Analysts look at the historical data and search for time decomposition patterns such as trends, seasonal patterns, cyclical patterns, and regularity.

Time series data models come in a variety of shapes and can depict various stochastic processes.

**Models for Time Series Forecasting**

On the basis of confirmed historical data, time series models are used to forecast events. Moving average, smooth-based, and ARIMA are examples of common types. The optimum model must be chosen based on each time series because different models will not produce the same results for the same dataset.

Understanding your purpose is crucial when forecasting.

#### Ask questions about the following to help you focus on the particulars of your predictive modeling issue:

- The amount of data that is available. More data is frequently more beneficial, providing more opportunities for exploratory analysis, model testing and tuning, and model quality.
**Required forecasts time horizon**: Shorter time horizons are frequently simpler to make with greater confidence than longer ones.**Forecast temporal frequency:**Forecasts can frequently be performed at lower or higher frequencies, enabling the use of data up- and down-sampling (this in turn can offer benefits while modeling).

**Time series analysis vs. time series forecasting**

Time series analysis focuses on comprehending the dataset, whereas forecasting focuses on making predictions about it. It refers to techniques for deriving useful statistics and other aspects of time series data through analysis.

Predictive modeling has three components, which are:

**Sample data**: the information we compile about our issue with known associations between outputs and inputs.**Learn a model**: the procedure we apply to the test data to produce a model that we can then employ repeatedly.**Making predictions:**applying our previously learned model to fresh data for which we are unsure of the outcome.

**Time series forecasting** is difficult due to a number of reasons, including:

- Time dependence of a time series – In this situation, the fundamental tenet of a linear regression model, that observations are independent, is not true.
- Time-series forecasting cannot rely on conventional validation procedures because of the temporal relationships in time series data.

On a specific dataset, time series models may perform better than others; nevertheless, a model’s performance may not be consistent across other dataset types.

**Types of forecasting methods:**

**Decompositional:**Use for Deconstruction of time series**Smooth-based:**Use for Removal of anomalies for clear patterns**Moving-Average:**Use for Tracking a single type of data**Exponential Smoothing:**Use for Smooth-based model + exponential window function

** **** ****Time series forecasting examples**

Predicting consumer demand for a specific product across seasons, the cost of fuel for home heating, hotel occupancy rates, hospital inpatient care, fraud detection, and stock prices are a few examples of time series forecasting. Using either storage or machine learning models, you can forecast.

**Model decomposition**

- It is frequently advantageous to divide a time series into components, each of which represents an underlying pattern category since time series data can display a variety of patterns. Decompositional models perform this.
- A statistical procedure called time series decomposition breaks down a time series into a number of components, each of which represents one of the underlying types of patterns.

**Decomposition can be divided into two categories:**

- Predictability-based decomposition and
- Decomposition based on rates of change.

**Various time series forecasting techniques**

Autoregression (AR), Moving Average (MA), Autoregressive Moving Average (ARMA), Autoregressive Integrated Moving Average (ARIMA), and Seasonal Autoregressive Integrated Moving-Average are examples of common kinds (SARIMA).

The key is to choose the **best forecasting technique** based on the properties of the time series data.

**Models based on smoothing**

Data smoothing reveals underlying trends and cyclical components while removing or reducing random variance.

**A model with a moving average**

The movable model (MA model), commonly referred to as the moving-average process, is a popular method for modeling univariate time series in time series analysis. According to the moving-average model, the output variable is linearly dependent on the present value as well as various previous values of a stochastic (imperfectly predictable) factor.

The moving-average model is a specific instance of the more general ARMA and ARIMA models of time series, which have a more complex stochastic structure, along with the autoregressive (AR) model (discussed below)

**Models for forecasting with seasonality**

**Both SARIMA and ARIMA**

It is useful to first define autoregression in order to define ARIMA and SARIMA. The time series model of autoregression predicts the value at the following time step using observations from prior time steps as input to a regression model. (A good tutorial on how to use an autoregressive model for time series forecasting in Python is “Autoregression Models for **Time Series Forecasting** With Python”).

ARIMA (AutoRegressive Integrated Moving Average) models are among the most used methods for predicting time series:

- The forecasts in an autoregressive model are a linear combination of the variable’s prior values.
- The finite MA model is consistently stationary in contrast to the AR model.

**Model for exponential smoothing**

- The exponential window function is a general method for smoothing time series data known as exponential smoothing. When making a decision based on the user’s past assumptions, such as seasonality, exponential smoothing is a simple to learn and apply process.

**Exponential Smoothing vs. Moving-Average Model**

The two methods are combined in ARIMA models. Differentiating (Integrating) the time series, that is, taking into account the time series of the differences rather than the original one, may be important since they call for the time series to remain stationary.

By using a linear mixture of seasonal past values and/or forecast errors, the SARIMA model (Seasonal ARIMA) expands upon the ARIMA.

**TBATS**

The TBATS model is an exponentially smoothed forecasting model. Trigonometric, Box-Cox transform, ARMA errors, Trend, and Seasonal components make up the term.

The fundamental advantage of the TBATS model is that it can handle many seasonalities by modeling each seasonality using a trigonometric description based on the Fourier series. Daily measurements of sales quantities, which frequently exhibit both weekly and yearly seasonality, are a classic illustration of complex seasonality.