You are on page 1of 12

04-01-2021

Time Series Analysis


MR. U.A. NULI

Time Series

Time series contains sequence of data points which are indexed in an order. This order is
Basically the time in which the happened or recorded.

The points are recorded at discrete time with equal time interval.

A time series is a set of observations xt, each one being recorded at a specific time t

A series of data points collected in time order is known as a time series.

Example: Temperature over the years, stock prices over the years at every hour interval
Average passengers travelled per day over years.

2
04-01-2021

Which of the following do you think is an example of time


series?

Time Series is generally data which is collected over time and is dependent on it.

Here we see that the count of cars is independent of time, hence it is not a time series. While the
CO2 level increases with respect to time, hence it is a time series.

Examples-stock price

4
04-01-2021

Passenger Count of an airlines :

Temperature over time :

6
04-01-2021

Time series Analysis and forecasting:

Time series analysis includes methods to analyse the time series data and make meaningful
Insights.
These insights are useful in making business decision

Time series forecasting is the way to predict the behaviour by using past data. Forecasting is
Very much useful to the direction of data
Time series forecasting is a way to predict the value in future based on past experience.

Time series forecasting is different from the supervised learning. In supervised learning we assume
That all the observations are independent from each other and any observation can be used at
Any time. Data recorded can be used in any sequence.

However in time series analysis data points need to be used in the same sequence in which they
are recorded

8
04-01-2021

Components/properties of a Time Series:

Any time series has four components/properties or features:

1. Trend
2. Seasonality
3. Cyclical movements
4. Unexpected variations

Trend :

Trend is a general direction in which something is developing or changing. So we see


an increasing trend in this time series. We can see that the passenger count is
increasing with the number of years. Let’s visualize the trend of a time series:

10
04-01-2021

The general trend in the time series is due to fundamental shifts or systemic changes of the
process or system it represents. For example, the upward movement of CO2 concentrations
during 1974 through 1987 can be attributed to the gradual rise in automobiles and
industrialization over these years

A general trend is commonly modelled by setting up the time series as a regression against
time and other known factors as explanatory variables. The regression or trend line can then
be used as a prediction of the long run movement of the time series. Residuals left by the
trend line is further analysed for other interesting properties such as seasonality, cyclical
behaviour, and irregular variations

11

Seasonality :

Seasonality : Another clear pattern can also be seen in the above time series, i.e., the pattern is
repeating at regular time interval which is known as the seasonality. Any predictable change or
pattern in a time series that recurs or repeats over a specific time period can be said to be
seasonality. Let’s visualize the seasonality of the time series:

12
04-01-2021

Seasonality manifests as repetitive and period variations in a time series.

Seasonality is manifested as periodic deviations such as those seen in the de-trended


observations of CO2 emissions. Peaks and troughs in the monthly sales volume of seasonal
goods such as Christmas gifts or seasonal clothing is another example of a time series with
seasonality.

A practical technique of determining seasonality is through exploratory data analysis


through the following plots:
• Run sequence plot
• Seasonal sub series plot
• Multiple box plots

13

Cyclical changes:

Cyclical changes are movements observed after every few units of time, but they occur less
frequently than seasonal fluctuations. Unlike seasonality, cyclical changes might not have a
fixed period of variations. Besides, the average periodicity for cyclical changes would be
larger (most commonly in years), whereas seasonal variations are observed within the same
year and corresponds to annual divisions of time such as seasons, quarters, and periods of
festivity and holidays and so on.

A long run plot of the time series is required to identify cyclical changes that can occur, for
example, every few years and manifests as repetitive crests and troughs. In this regard, time
series related to economics and business often show cyclical changes that correspond to
usual business and macroeconomic cycles such as periods of recessions followed by every
of boom, but are separated by few years of time span. Similar to general trends, identifying
cyclical movements might require data that dates significantly back in the past.

14
04-01-2021

Unexpected variations:

Unexpected variations are stochastic and cannot be framed in a mathematical model for a
definitive future prediction.

This type of error is due to lack of information about explanatory variables that can model these
variations or due to presence of a random noise.

15

Models to forecast the time series:

Methods which we will be discussing for the forecasting are:

i) Naive Approach
ii) Moving Average
iii) Simple Exponential Smoothing
iv) Holt’s Linear Trend Model

16
04-01-2021

Naive Approach:

In this forecasting technique, we assume that the next expected point is equal to the
last observed point. So we can expect a straight horizontal line as the prediction. Lets
understand it with an example and an image:

https://courses.analyticsvidhya.com/courses/take/creating-time-series-forecast-using-
python/texts/8783545-datahack-summit-2019-india-s-largest-applied-artificial-intelligence-and-
machine-learning-conference

17

Suppose we have passenger count for 5 days as shown below:

Passenger
Day
Count
1 10
2 12
3 14
4 13
5 15

18
04-01-2021

And we have to predict the passenger count for next 2 days. Naive approach will assign the 5th
day’s passenger count to the 6th and 7th day, i.e., 15 will be assigned to the 6th and 7th day.

Passenger
Day
Count
1 10
2 12
3 14
4 13
5 15
6 15
7 15

19

Moving Average

In this technique we will take the average of the passenger counts for last few time periods only.

20
04-01-2021

Simple Exponential Smoothing

• In this technique, we assign larger weights to more recent observations than to observations
from the distant past.
• The weights decrease exponentially as observations come from further in the past, the
smallest weights are associated with the oldest observations.

NOTE - If we give the entire weight to the last observed value only, this method will be similar
to the naive approach. So, we can say that naive approach is also a simple exponential
smoothing technique where the entire weight is given to the last observed value.

21

Holt’s Linear Trend Model

• It is an extension of simple exponential smoothing to allow forecasting of data with a trend.

• This method takes into account the trend of the dataset. The forecast function in this method is
a function of level and trend.

22
04-01-2021

First of all let us visualize the trend, seasonality and error in the series.

We can decompose the time series in four parts.

• Observed, which is the original time series.


• Trend, which shows the trend in the time series, i.e., increasing or decreasing
behaviour of the time series.
• Seasonal, which tells us about the seasonality in the time series.
• Residual, which is obtained by removing any trend or seasonality in the time series.

23

You might also like