TIME SERIES ANALYSIS.
Tags: datascience, datanerd, dataengineering
Published: 2023-10-25 06:34:13

> 
**Time Series Analysis** is a way of studying the characteristics of the response variable concerning time as the independent variable.
To estimate the target variable in predicting or forecasting, use the time variable as the reference point.
TSA represents a series of time-based orders, it would be Years, Months, Weeks, Days, Horus, Minutes, and Seconds. It is an observation from the sequence of discrete time of successive intervals.
_Some real-world application of TSA includes weather forecasting models, stock market predictions, signal processing, and control systems._

**What Is Time Series Analysis?**
Time series analysis is a specific way of analyzing a sequence of data points collected over time. In TSA, analysts record data points at consistent intervals over a set period rather than just recording the data points intermittently or randomly.

**Objectives of Time Series Analysis**

- To understand how time series works and what factors affect a certain variable(s) at different points in time.
- Time series analysis will provide the consequences and insights of the given dataset’s features that change over time.
- Supporting to derive the predicting the future values of the time series variable.
- Assumptions: There is only one assumption in TSA, which is “stationary,” which means that the origin of time does not affect the properties of the process under the statistical factor.

**How to Analyze Time Series?**
To perform the time series analysis, we have to follow the following steps:

- Collecting the data and cleaning it
- Preparing Visualization with respect to time vs key feature
- Observing the stationarity of the series
- Developing charts to understand its nature.
- Model building – AR, MA, ARMA and ARIMA
- Extracting insights from prediction

**Significance of Time Series**
TSA is the backbone for prediction and forecasting analysis, specific to time-based problem statements.

- Analyzing the historical dataset and its patterns
- Understanding and matching the current situation with patterns derived from the previous stage.
- Understanding the factor or factors influencing certain variable(s) in different periods.

With “_Time Series_,” we can prepare numerous time-based analyses and results.

- **Forecasting**: Predicting any value for the future.
- **Segmentation**: Grouping similar items together.
- **Classification**: Classifying a set of items into given classes.
- **Descriptive analysis**: Analysis of a given dataset to find out what is there in it.
- **Intervention analysis**: Effect of changing a given variable on the outcome.

**Components of Time Series Analysis**

- **Trend**: In which there is no fixed interval and any divergence within the given dataset is a continuous timeline. The trend would be Negative or Positive or Null Trend
- **Seasonality**: In which regular or fixed interval shifts within the dataset in a continuous timeline. Would be bell curve or saw tooth
- **Cyclical**: In which there is no fixed interval, uncertainty in movement and its pattern
- **Irregularity**: Unexpected situations/events/scenarios and spikes in a short time span.

**What Are the Limitations of Time Series Analysis?**

- Similar to other models, the missing values are not supported by TSA
- The data points must be linear in their relationship.
- Data transformations are mandatory, so they are a little expensive.
- Models mostly work on Uni-variate data.

**Data Types of Time Series**
There are two major types – stationary and non-stationary.

**Stationary**: A dataset should follow the below thumb rules without having Trend, Seasonality, Cyclical, and Irregularity components of the time series.

- The **mean** value of them should be completely constant in the data during the analysis.
- The **variance** should be constant with respect to the time-frame
- **Covariance** measures the relationship between two variables.

**Non- Stationary**: If either the mean-variance or covariance is changing with respect to time, the dataset is called non-stationary.

**Time Series Data Models.**

- **Autoregressive (AR) models**
AR model is a representation of a type of random process, which is why it is used for data describing time-varying processes, such as changes in weather, economics, etc.
- **Integrated (I) models**
Integrated models are series with random walk components. They are called integrated because these series are the sums of weakly-stationary components.
- **Moving-average (MA) models**
Moving-average models are used for modeling univariate time series. In MA models, the output variable depends linearly on the current and various past values of an imperfectly predictable (stochastic) term.

These three classes in various combinations produce the following three commonly used in time series data analytics models.

- **Autoregressive moving average (ARMA) models**
ARMA models combine AR and MA classes, where AR part involves regressing the variable on its own past values, while MA part is used to model the error term as a linear combination of error terms occurring contemporaneously and at various times in the past. ARMA models are frequently used for analytics and predicting future values in a series.
- **Autoregressive integrated moving average (ARIMA) models**
ARIMA models are a generalization of an ARMA model and are used in cases where data show evidence of non-stationarity qualities, where an initial differencing step, corresponding to the integrated part of the model, can be applied one or more times to eliminate the non-stationarity of the mean function.
Both ARMA and ARIMA models are frequently used for analytics and predicting future values in a series.
- **Autoregressive fractionally integrated moving average (ARFIMA) models**
ARFIMA model, in its turn, generalizes ARIMA models (or, basically, all the three basic classes) by allowing non-integer values of the differencing parameter. ARFIMA models are frequently used for modeling so-called long memory time series where deviations from the long-run mean decay slower than an exponential decay.
When it comes to nonlinear time series models, there are a number of models that represent changes in variability over time that are predicted by or related to recent past values of the observed series.
- **Autoregressive conditional heteroscedasticity (ARCH) models**
ARCH is one such model, which describes the variance of the current error term or innovation as a function of the actual sizes of error terms.in the previous time periods.