Time series analysis is characteristic of a process at regular time intervals. so, It’s a significant method for understanding how a metric changes over time and forecasting future values.
Why is Time series analysis important?
Because time series forecasting is essential Business forecasting, understanding past performance and planning for the future especially for policymakers heavily rely on time series analysis.
Time series data Vs Non-Time series data:
If time is what uniquely identifies one observation from another, then it is very likely that it is a time-series dataset. so, Not every data collected for time represents a time series. The observations must be dependent on time.
A Time series has 4 components are:
- Level − Is the mean value around which the series varies.
- Trend − Is the increasing or decreasing behaviour of a variable with time.
- Seasonality − This is the cyclic behaviour of the time series.
- Noise − Is the error in the observations added due to environmental factors.
Autocorrelation:
Autocorrelation It is the similarity between the observations according to the time lapse between them
Seasonality:
This is the cyclic behaviour of the time series.
Stationarity:
Stationarity is a very important characteristic of the time series. Time series data is said to be stationary if its statistical properties don’t change over time. Time series has constant mean and variance, and covariance is independent of time
How to know if a process is stationary?
We can use a statistical test called the Dickey-Fuller test. This test is used to determine if a time series is stationary or not.
Dickey-Fuller test is used to examine the null hypothesis that a unit root is present.
If it is, p > 0, and the process is not stationary.
if p = 0, the null hypothesis is rejected, and the process is considered to be stationary.
Time Series Modeling Techniques:
For these components, there are several popular time series modelling techniques
Moving average:
also, The moving average model is probably the most used approach to time series modelling. so, This simply states that the next observation is the mean of all past observations.
Naive Methods:
There are simple estimation techniques, such as the predict value is given the value equal to the mean of preceding values of the time-dependent variable, or previous actual value. so, These all are use for comparison with sophisticat modelling techniques.
Auto Regression:
AR predicts the values of future periods as a function of values at previous periods. Predictions of the AR model may fit the data better than that of naïve methods, but it may not be able to account for seasonality.
ARIMA Model:
An ARIMA models the value of a variable as a linear function of previous values and residual errors at previous time steps of a stationary time series. The real-world data may be non-stationary and have seasonality, thus Seasonal-ARIMA and Fractional-ARIMA(SARIMA) were developed.
The ARIMA model use to work on the univariate time series, to handle multiple variables ARIMA also introduce it.
thus, In ARIMA, AR(Auto-Regressive) and MA(Moving Average) are completely different methodologies for univariate forecasting. If we combine AR and MA later it is the ARMA and ARIMA (Autoregressive integrated moving average). The difference between ARMA and ARIMA i.e. to make the data stationary in ARIMA models. otherwise, both follow the same methodology.
AR model: Lags in the stationary series
MA model: Error lags in the series
Exponential Smoothing:
Exponential Smoothing models the value of a variable as an exponential weighted linear function of previous values. so, This model can handle trends and seasonality as well.
Long Short-Term Memory model(LSTM): however, LSTM Is a recurrent neural network which is use for the time series to account for long term dependencies. so, This can be train with large amounts of data to capture the trends in multivariate time series.
Step 1: Visualize the Time Series
It is important to analyze the trends before building any kind of time series model. The details we are interest in obtaining any kind of trend, seasonality, or random behaviour in the series.
Step 2: Stationarizing the Series
so, After we know the patterns, trends, cycles, and seasonality, we can check if the series is stationary or not. Dickey-Fuller test is one of the popular tests to check stationarity and seasonality.
There is three frequently use technique to make a time series stationary:
i. Detrending: In this method, we simply remove the trend component from the time series.
ii. Differencing: This technique is use to remove non-stationarity. For this, we try to model the differences between the terms and not the actual term.
iii. Seasonality: Seasonality can easily be incorporate in the ARIMA model directly.
Step 3: Find Optimal Parameters
The parameters p(number of autoregressive terms), d(number of non-seasonal differences need for stationarity),q(number of lagged forecast errors) can be find using ACF and PACF plots. thus, If ACF and PACF continuously decrease, it indicates that we should make the time series data stationary and introduce a value in “d”.
Step 4: Build the ARIMA Model
With the parameters we have, we can try to build an ARIMA model. The value find in the previous step can be estimate and we need to explore more (p,d,q) combinations.
Step 5: Make Predictions
The final ARIMA model is to make predictions on future time points. We can also visualize the trends to cross-validate if the model works fine.
Conclusion:
so, Time Series Forecasting is an essential part of Machine Learning that evaluates and understands the time series data to predict future outcomes. therefore, It has extensive applications in Banking, Finance, Weather Forecasting and Sales Forecasting among others.
written by: Prudvi Raj
reviewed by: Rushikesh Lavate