Signal Processing and Time Series (Data Analysis)
Last Updated :
05 Mar, 2020
Signal processing is a field of engineering that focuses on analyzing analog and digital signals with respect to time.
Time Series Analysis is one of the categories of signal processing.
A time series is a sequence of data points recorded at regular intervals of time. Time series analysis is an important step before you develop a forecast of the series, and the order of the values is important in time series analysis. This process helps to extract meaningful statistics and other characteristics of data which helps to create an accurate forecast. Time series are widely used for data like weather, stock price, retail sales, etc…
We will cover the following topics in this section:
1. Moving Average
2. Autoregressive Models
3. ARMA Models
These are explained as following below.
1. Moving Average:
A moving average (MA) is a widely used calculation to analyze time series. This specifies a window of data for a particular time period which is averaged each time by one period when new data is available.
The two commonly used moving averages are:
- Simple Moving Average (SMA) –
SMA’s calculation provides the average data for a defined number of time periods. The mathematical formula as follows:
Where,
= parameter of the model
n = total no of days
- Exponential Moving Average (EMA) –
Exponential moving average gives more priority to recent data. The mathematical formula as follows:
Where,
= current closing price
= previous periods EMA [SMA for first calculation]
k = 2 / (N+1) [exponential or smoothing constant]
N = Total no of days considered for EMA calculation
EMA Calculation:
Here we calculate EMA for 5 days. Normally for the first case either we take the current close price or previous 5 days SMA value to get the first EMA. For the below example, the current close price ($22.81) is taken as the first EMA value.
The next step is to calculate the k value. Since the calculation is based on 5 days, N = 5 and k value is calculated as follows:
k = 2/(5+1) = 0.3
DAY |
CLOSE PRICE |
EMA |
SMA |
1 |
22.81 |
22.81 |
– |
2 |
23.09 |
– |
– |
EMA for 2nd day is calculated as follows:
Current closing price = 23.09
Previous period EMA = 22.81
k = 0.3
EMA
= 22.81 + 0.3 * (23.09 - 22.81)
= 22.81 + 0.3 * 0.28
= 22.81 + 0.084
= 22.894
DAY |
CLOSE PRICE |
EMA |
SMA |
1 |
22.81 |
22.81 |
– |
2 |
23.09 |
22.89 |
– |
3 |
22.91 |
– |
– |
EMA for 3rd day is calculated as follows:
Current closing price = 22.91
Previous period EMA = 22.89
k = 0.3
EMA
= 22.89 + 0.3 * (22.91 - 22.89)
= 22.89 + 0.3 * .02
= 22.89 + .006
= 22.896
DAY |
CLOSE PRICE |
EMA |
SMA |
1 |
22.81 |
22.81 |
– |
2 |
23.09 |
22.89 |
– |
3 |
22.91 |
22.89 |
– |
SMA Calculation:
Since we considered total days (N) as 5, the SMA is calculated as the average of 5 latest close price.
DAY |
CLOSE PRICE |
EMA |
SMA |
1 |
22.81 |
22.81 |
– |
2 |
23.09 |
22.89 |
– |
3 |
22.91 |
22.89 |
– |
4 |
23.23 |
22.99 |
– |
5 |
22.83 |
22.94 |
– |
SMA for 5 days is calculated as follows:
SMA
= (22.81 + 23.09 + 22.91 + 23.23 + 22.83) / 5
= 114.87 / 5
= 22.97
DAY |
CLOSE PRICE |
EMA |
SMA |
1 |
22.81 |
22.81 |
– |
2 |
23.09 |
22.89 |
– |
3 |
22.91 |
22.89 |
– |
4 |
23.23 |
22.99 |
– |
5 |
22.83 |
22.94 |
22.97 |
6 |
23.05 |
– |
– |
2. Autoregressive Models:
An autoregressive model can be used to predict future data based on past data. In this model, data is assumed to depend on its previous data. Since autoregressive models totally depend on past data to generate future models, there are chances of generating inaccurate data under certain conditions such as financial crises or sudden technological changes.
The mathematical formula as follows:
AR Calculation:
The below data provide the stock price of today(t), one day before (t-1), two days before (t-2) and three days before (t-3).
t |
t-1 |
t-2 |
t-3 |
23.23 | 22.91 | 23.09 | 22.81 |
22.83 | 23.23 | 22.91 | 23.09 |
23.05 | 22.83 | 23.23 | 22.91 |
23.02 | 23.05 | 22.83 | 23.23 |
23.29 | 23.02 | 23.05 | 22.83 |
23.41 | 23.29 | 23.02 | 23.05 |
23.49 | 23.41 | 23.29 | 23.02 |
24.6 | 23.49 | 23.41 | 23.29 |
24.63 | 24.6 | 23.49 | 23.41 |
24.51 | 24.63 | 24.6 | 23.49 |
23.73 | 24.51 | 24.63 | 24.6 |
23.31 | 23.73 | 24.51 | 24.63 |
23.53 | 23.31 | 23.73 | 24.51 |
23.06 | 23.53 | 23.31 | 23.73 |
23.25 | 23.06 | 23.53 | 23.31 |
23.12 | 23.25 | 23.06 | 23.53 |
22.8 | 23.12 | 23.25 | 23.06 |
22.84 | 22.8 | 23.12 | 23.25 |
With the above stock price data, you need to perform the linear regression to get the parameters required for AR model. For this, you can use data analysis feature from excel. For regression, you can provide t data as Y input and (t-1), (t-2), (t-3) as X input. Microsoft excel will provide you the below result.
Regression Statistics:
Multiple R: 0.786903932
R Square: 0.619217798
Adjusted R Square: 0.537621612
Standard Error: 0.398415364
Observations: 18
|
Coefficients |
Standard Error |
Intercept | 8.59250239 | 4.494566177 |
t-1 | 0.840795074 | 0.249566271 |
t-2 | 0.100511124 | 0.331626753 |
t-3 | -0.308260596 | 0.250400704 |
Let’s look into how to use the output values from regression.
Previous Stock Data:
Coefficient of t-1 = 0.840795074 and Close price = 22.8
Coefficient of t-2 = 0.100511124 and Close price = 23.12
Coefficient of t-3 = -0.308260596 and Close price = 23.25
Value of Constant:
Coefficient of Intercept = 8.59250239 = 8.6
Standard Error:
t-1 = 0.249566271
t-2 = 0.331626753
t-3 = -0.250400704
Standard Error
= 0.25 + 0.33 - 0.25
= 0.33
AR
= 8.6 + [ (0.84*22.8) + (0.1*23.12) + (-0.31*23.25) ] + 0.33
= 8.6 + [ 19.15 + 2.31 - 7.20] + 0.33
= 8.6 + 14.26 + 0.33
= 23.19
Rather than going through the entire calculation, you can predict tomorrow stock price with today stock price and R square value (refer regression statistics output above).
Suppose that, the stock price of today is $22.84, then tomorrow’s stock price is calculated as:
AR(t+1) = Coefficient of Intercept + (R square * Today's Price)
+ Standard Error
R Square = 0.619217798
Standard Error (from regression statistics) = 0.398415364
AR
= 8.6 + (0.619*22.84) + 0.39
= 8.6 + 14.14 + 0.39
= 23.13
3. ARMA Models:
ARMA model is another tool used to forecast a time series. These models are based on the combination of both autoregressive and moving average models. In the AR model, we use past data for regressing the variable and in the MA model, we use the sum of the mean of the time series for a forecast.
Since the ARMA model is the combination of both AR part and MA part, this model is referred to as ARMA(p, q) model where p is the AR part and q is the MA part.
The mathematical formula is as follows:

Where,

= the autoregressive model’s parameter

= the moving average model’s parameter
c = a constant

= error term’s [White Noise]
Similar Reads
Advantages and Disadvantages of Digital Signals
Digital signals, which are the basic encoding of modern technology and communication, represent data as a discrete binary number, 0 or 1. It is therefore implemented in a much more reliable binary format with easier processing and noise immunity, which gives highly efficient digital signals for appl
5 min read
Analog Signal
A signal is an electromagnetic or electrical current that transfers data from one system or network to another. Though it can sometimes take other forms, including current, a signal in electronics is often a time-varying voltage that is also an electromagnetic wave conveying information. Analog and
4 min read
Overview of Data and Information
In this article, we will discuss what is data, the importance of data, and how it played a great role in today's generation along with that we will discuss what is information and its uses. So, let's go a little bit deep into this article to understand the concept well. Data :Data is derived from th
3 min read
Various terms in Data Mining
Data mining has applications in multiple fields like science and research. It is a prediction based on likely outcomes. Its focuses on the last data set. Data mining is the procedure of mining knowledge from data. The knowledge extracted so can be used for any of the following applications such as p
3 min read
Properties of Fourier Transform
Fourier Transform: Fourier transform is the input tool that is used to decompose an image into its sine and cosine components. Properties of Fourier Transform: Linearity: Addition of two functions corresponding to the addition of the two frequency spectrum is called the linearity. If we multiply a f
2 min read
Applications of Digital Signal Processing
Digital Signal Processing (DSP) is one of those technologies that play the crucial role in the development of the entire world today. DSP is the process of employing digital processing methods for the quantification, filtering/ and or amplification of continuous analog signals. It is an operation th
9 min read
What is Digital Signal Processing (DSP)?
Digital Signal Processing (DSP) is a branch of engineering and applied mathematics that deals with the processing and analysis of digital signals. A digital signal is a discrete-time signal, that is represented by a sequence of numbers sampled at regular intervals. DSP involves various algorithms, t
15 min read
Introduction to Signals and Systems: Properties of systems
In this article, we will go through Signal and systems, First, we will define what is a signal and what is a system, then we will go through the calculation of the Energy and Power of Signals with their transformation, At last we will conclude our article with Properties, Applications and some FAQs.
6 min read
What is State Space Analysis ?
The State Space analysis applies to the non-linear and time-variant system. It helps in the analysis and design of linear, non-linear, multi-input, and multi-output systems. Earlier the transfer function applied to the linear time-invariant system but with the help of State Space analysis, it is pos
7 min read
Difference Between Analog and Digital Processing
In the realm of signal processing and data management, it is vital to distinguish between analog and digital processing. Analog processing involves continuous signals that fluctuate with time and are therefore able to capture real-world phenomena in their most natural forms. Conversely, digital proc
5 min read