0% found this document useful (0 votes)
58 views16 pages

MIT BA 12 - Time Series Session Notes

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views16 pages

MIT BA 12 - Time Series Session Notes

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

MIT BA 12

Time Series Analysis – Session 1

Types of data :
1. String
2. Integer
3. Float
4. Character
5. Structured & Unstructured
6. Variables
7. Date and Time
8. Qualitative Data
9. Quantitative Data
10. Binary
11. Discrete
12. Continuous
13. Finite and Infinite data
14. Time Series Data
15. Cross Sectional Data
16. Panel Data
Time Series Data : Focuses on how a single
variable changes over time.
Eg : Temperature, Sales of a particular product,
Stock price of a particular stock, Weather etc
Cross Sectional Data : When the data compares
different entities at a single point of time.
Eg : A survey that take responses from different
people about their income, expenditure etc.
taken on the same day, Political polls, Fashion
trends, Population data taken on a particular
day.
Panel data : Combines the aspect of the cross-
sectional data and the time series data by
observing multiple entities over multiple
periods in time. This analyses the change over
different subject across different time periods.
Eg: Research data, Academic performance of
various students over various years, income of
various individuals over various periods of time,
census data which taken over different time
intervals, appraisal data of various individuals.

How would you analyze any dataset that has


been given to you?
1. Understand the data
2. Analyzing the pattern and frequency
3. Analyzing the parameters
4. Defining goals
5. Output required
6. Process and the path required
7. Summarizing the data
8. Missing value treatment
Approaches to deal with Time Series Data
1. Null Value Treatment
2. Data Visualization
- Trends
- Seasonality
- Cyclicity
3. Models based on the time series data
4. Forecasting
5. Error Analysis : To check how accurate
the data is.
Time Series Methods :
1. Simple Moving Average
2. Naïve Methods
3. Autoregressive Models
4. Autoregressive Moving average models
(ARMA)
5. Autoregressive Integrated Moving
Average Models (ARIMA)
6. Monte Carlo Simulations
NULL VALUE TREATMENT
Suppose you have recorded the daily
temperatures for a particular city. Sometimes,
there might be missing values to the data due
to various.
1. Backward Fill Method:
- Looks into the past and fills the values
- It takes the data from one time period
behind and fills the next value.
- Suppose you have missing values for the
5th , and 6th day. We take the data from
the 4th day and fill it to the next days.
2. Forward Fill Method:
- Instead of looking into the past, you’re
looking into the future to fill the gaps.
- It takes the data from one time period
ahead and fills the values.
- Suppose you have missing values of the
5th day, we take the data from the 6th day
and fill it to the 5th day.
3. Interpolation method
- It takes a combination of the backward fill
method and the forward fill method to fill
the null values.
4. Taylor Approximation Series
- It uses derivatives to fill the null values
MIT BA 12
Time Series Analysis – Session 2
Types of data that take time as one of the
constraints:
1. Time Series Data
2. Cross Sectional Data
3. Panel Data
Steps to be followed while analyzing a time
series data:
1. Null Value Treatment
- Backward Fill Method
- Forward Fill method
2. Data Visualization
- 2D line chart
- Trend : Follows a random pattern over
time. It can be upward or downward.
Eg : Stock Prices, Sales, Gold rate etc.
- Seasonality : Fluctuations at a particular
season.
Eg: Sales of crackers during Diwali, Price
of food items according to different
seasons, Demand of items during wedding
seasons, Hotel prices during vacations,
Flight charges during vacations etc.
- Cyclicity : Shows a particular pattern at
not a fixed interval of time
Eg : Price of medicines, Price of petrol,
business cycles, real estate prices , prices of
import and export etc.
3. Model Building
4. Forecasting
5. Error Analysis
Model Building
The method of Simple Moving Average
- It is calculated by averaging out a set of
data points over a certain time frame to
create a single, smoothed data point.
- It is a technique that helps to smooth out
the data or fluctuations and reveal trends
over a period of time.
1. Select a time : It can be short term,
medium term, long terms etc.
2. Calculate the average
3. Repeat the process
Problem Statement:
To find out the cement sold in Dec-10. And find
out which of them is the most accurate
prediction.
Error Analysis:
Tells us which of the predictions is the most
accurate.
The lesser the Error more Accurate is the
prediction.
- Less Error More Accuracy
1. Average Error Method
• Step 1: Actual – Predicted value

• Step 2 : Average (step 1)

• Whichever model has lesser error we will

choose that as the most accurate


prediction.
2. Mean Absolute Percentage Error
Output:
Since the error is the least in case of SMA 3 we
can say that the Cement sold in Dec 2010
would be 710729
MIT BA 12
Time Series Analysis – Session 3
Error Analysis using the method of (MAPE)
1. Mean Absolute Percentage Error
Step1 :
Calculate absolute(Error SMA / Actual SMA)
Step2:
Convert this value that you have obtained in
step 1 to percentage
Step 3:
Find the Mean or Average of the Absolute
percentage error.
Problem Statement:
- Download the daily stock price of Apple
from yahoo finance for a period of 5
months
- Calculate SMA 3,4,5,6
- Perform the Error Analysis using Average
Error method and MAPE method
- Find out the most accurate prediction of
stock for the next 2 days.

Naïve Methods
In the Grayson food data we can see long term
trend in the data. When there is a trend
detected in the data it is difficult to get
accurate results using the method of SMA.
Hence, we use Naïve methods to get the
necessary outputs.
1. Simple Naïve Method
- Moving average of order 1
- We will predict the next lag value based
on the previous value
- We will predict the most recent value.
2. Trend Naïve Method
- Trends can vary over different intervals of
time, that is yearly, monthly, quarterly,
daily etc.
- SNM + ((t-1)-(t-2))
3. Seasonal Naïve Method
- There can be a strong correlation on a
monthly or a yearly basis dataset.
- If you have a monthly data, then there
months will have a similar pattern in the
following months as well.
E.g.: If there is a hike in sales in July 2019
then the same hike in sales can be
observed in July 2020 as well.
If you have monthly dataset, then these
months will show a similar pattern in the
following months.
MIT BA 12
Time Series Analysis – Session 4
Error Analysis:
Method of Mean Square Error :
- To find the error (Actual value – Predicted
value)
- Find the squared error (Actual value –
Predicted value)2
- Mean of the squared error
Problem Statement :
- Use the sales (2010-19) data
- Check for null values
- Use the method of forward fill or
backward fill to remove null values
- Plot the data and check for long term
trends
- Forecast the data for the next day using
the method of SNM, Trend Naïve and
Seasonal Naïve.
- Perform the error analysis using MAPE
and MSE and find out which forecast is
the most accurate.
Time Series Decomposition
Time Series data can be affected by:
- Trend
- Seasonality
- Irregularity
1. Additive Model
Y=T+S+C+I
2. Multiplicative Model
Y = Trend * Seasonality
Steps to be followed for forecasting Sales Data:
1. Moving Average
2. Central Moving Average
3. Residual and Seasonal Component
4. Seasonal variation
5. Deseasonalize the data
- Remove the seasonal variation from the
original data
6. Trend
- Ytrend = Intercept + Slope(time)*Time Period
- Y = mX + C
7.Multiplicative model
- Y = Trend * Seasonality

You might also like