SlideShare a Scribd company logo

Demand time series analysis and forecasting

M Baddar
M Baddar
M BaddarData Scientist

Tutorial on time series analysis , modeling and forecasting.

Demand time series analysis and forecasting

1 of 15
Download to read offline
Time Series Modeling and
Forecasting
Mohamed Baddar
Data scientist - Careem Networks GmbH
mbaddar2@gmail.com
https://twitter.com/mbaddar2
https://mbaddards.blogspot.com/
Contents
A gentle introduction for time series analysis and forecasting, in this session we
introduce:
1. Application for time series analysis and forecasting
2. Visual analysis of time series
3. Stationarity of time series
4. Different Time Series models
5. Time series data preprocessing
6. Building Time Series Model
7. Evaluating Models
8. Demo
9. Questions
2
1. Applications of time series analysis
● Economic/Sales forecasting
● Stock market analysis
● User Behavior analysis
● Process and quality control
● Inventory Studies
● Weather Forecasting
● Workload projections
● Census Analysis
3
References:
http://www.itl.nist.gov/div898/handbook/pmc/section4/pmc41.htm
The Main idea behind time series analysis step:
Systematically Isolating each “assumed” component of the time series and identify
it as a “reproducible pattern” till the remainder becomes unexplainable white noise
4
2. Visual Analysis
Human eye and brain are one of the most complex analysis tools
What quick answers can we get from visual analysis
● Is there any abnormal values (outliers)
● Any detectable trend, seasonality
● For cross time series analysis (are the two serieses behaving in the same
way)
5
4. Stationarity of a Time Series
● Strict stationarity
○ Joint distribution of (Y_t, Y_t+1, … Y_t+n) is the same as (Y_t+k,Y_t+1+k, … Y_t+n+k)
Where 0<=t,n,k<=N , t+n+k<=N
○ In other words , the joint distribution of a n-window of the data doesn’t change as the window
moves over the series
○ Practically , hard to estimate the complete joint distribution of the moving n-windows, so
practically we use mean and variance
● Weak stationarity
○ u and sigma are the same for the window n at different K’s (formula to add)
○ Our next objective is to “Stationarize the time series”
■ Making mean stable over time
■ Making variance stable over time
6

Recommended

ANN ARIMA Hybrid Models for Time Series Prediction
ANN ARIMA Hybrid Models for Time Series PredictionANN ARIMA Hybrid Models for Time Series Prediction
ANN ARIMA Hybrid Models for Time Series PredictionM Baddar
 
Lesson08_new
Lesson08_newLesson08_new
Lesson08_newshengvn
 
Lesson08_static11
Lesson08_static11Lesson08_static11
Lesson08_static11thangv
 
Moving avg &amp; method of least square
Moving avg &amp; method of least squareMoving avg &amp; method of least square
Moving avg &amp; method of least squareHassan Jalil
 
Time series analysis- Part 2
Time series analysis- Part 2Time series analysis- Part 2
Time series analysis- Part 2QuantUniversity
 

More Related Content

What's hot

Time series, forecasting, and index numbers
Time series, forecasting, and index numbersTime series, forecasting, and index numbers
Time series, forecasting, and index numbersShakeel Nouman
 
Lesson 2 stationary_time_series
Lesson 2 stationary_time_seriesLesson 2 stationary_time_series
Lesson 2 stationary_time_seriesankit_ppt
 
Trend adjusted exponential smoothing forecasting metho ds
Trend adjusted exponential smoothing forecasting metho dsTrend adjusted exponential smoothing forecasting metho ds
Trend adjusted exponential smoothing forecasting metho dsKiran Hanjar
 
Winters Method
Winters MethodWinters Method
Winters Method3abooodi
 
Time Series, Moving Average
Time Series, Moving AverageTime Series, Moving Average
Time Series, Moving AverageSOMASUNDARAM T
 
Time Series Analysis - Modeling and Forecasting
Time Series Analysis - Modeling and ForecastingTime Series Analysis - Modeling and Forecasting
Time Series Analysis - Modeling and ForecastingMaruthi Nataraj K
 
Analyzing and forecasting time series data ppt @ bec doms
Analyzing and forecasting time series data ppt @ bec domsAnalyzing and forecasting time series data ppt @ bec doms
Analyzing and forecasting time series data ppt @ bec domsBabasab Patil
 
Machine Learning - Time Series Part 2
Machine Learning - Time Series Part 2Machine Learning - Time Series Part 2
Machine Learning - Time Series Part 2Rupak Roy
 
Machine Learning - Time Series
Machine Learning - Time Series Machine Learning - Time Series
Machine Learning - Time Series Rupak Roy
 
2b. forecasting linear trend
2b. forecasting   linear trend2b. forecasting   linear trend
2b. forecasting linear trendSudipta Saha
 
Trend analysis - Lecture Notes
Trend analysis - Lecture NotesTrend analysis - Lecture Notes
Trend analysis - Lecture NotesDr. Nirav Vyas
 
Dr. Syed Muhammad Ali Tirmizi - Special topics in finance lec 5
Dr. Syed Muhammad Ali Tirmizi - Special topics in finance   lec 5Dr. Syed Muhammad Ali Tirmizi - Special topics in finance   lec 5
Dr. Syed Muhammad Ali Tirmizi - Special topics in finance lec 5Dr. Muhammad Ali Tirmizi., Ph.D.
 
Mba 532 2011_part_3_time_series_analysis
Mba 532 2011_part_3_time_series_analysisMba 532 2011_part_3_time_series_analysis
Mba 532 2011_part_3_time_series_analysisChandra Kodituwakku
 
Deseasonalizing Forecasts
Deseasonalizing ForecastsDeseasonalizing Forecasts
Deseasonalizing Forecastsahmad bassiouny
 
Time Series Analysis - 1 | Time Series in R | Time Series Forecasting | Data ...
Time Series Analysis - 1 | Time Series in R | Time Series Forecasting | Data ...Time Series Analysis - 1 | Time Series in R | Time Series Forecasting | Data ...
Time Series Analysis - 1 | Time Series in R | Time Series Forecasting | Data ...Simplilearn
 

What's hot (20)

Time series, forecasting, and index numbers
Time series, forecasting, and index numbersTime series, forecasting, and index numbers
Time series, forecasting, and index numbers
 
Time series Forecasting
Time series ForecastingTime series Forecasting
Time series Forecasting
 
Lesson 2 stationary_time_series
Lesson 2 stationary_time_seriesLesson 2 stationary_time_series
Lesson 2 stationary_time_series
 
Trend adjusted exponential smoothing forecasting metho ds
Trend adjusted exponential smoothing forecasting metho dsTrend adjusted exponential smoothing forecasting metho ds
Trend adjusted exponential smoothing forecasting metho ds
 
1634 time series and trend analysis
1634 time series and trend analysis1634 time series and trend analysis
1634 time series and trend analysis
 
Winters Method
Winters MethodWinters Method
Winters Method
 
Time Series, Moving Average
Time Series, Moving AverageTime Series, Moving Average
Time Series, Moving Average
 
Time Series Analysis - Modeling and Forecasting
Time Series Analysis - Modeling and ForecastingTime Series Analysis - Modeling and Forecasting
Time Series Analysis - Modeling and Forecasting
 
Exponential Weighting Moving Average.
 Exponential Weighting Moving Average. Exponential Weighting Moving Average.
Exponential Weighting Moving Average.
 
Analyzing and forecasting time series data ppt @ bec doms
Analyzing and forecasting time series data ppt @ bec domsAnalyzing and forecasting time series data ppt @ bec doms
Analyzing and forecasting time series data ppt @ bec doms
 
Machine Learning - Time Series Part 2
Machine Learning - Time Series Part 2Machine Learning - Time Series Part 2
Machine Learning - Time Series Part 2
 
Machine Learning - Time Series
Machine Learning - Time Series Machine Learning - Time Series
Machine Learning - Time Series
 
2b. forecasting linear trend
2b. forecasting   linear trend2b. forecasting   linear trend
2b. forecasting linear trend
 
Time series Analysis
Time series AnalysisTime series Analysis
Time series Analysis
 
Chapter 18 Part I
Chapter 18 Part IChapter 18 Part I
Chapter 18 Part I
 
Trend analysis - Lecture Notes
Trend analysis - Lecture NotesTrend analysis - Lecture Notes
Trend analysis - Lecture Notes
 
Dr. Syed Muhammad Ali Tirmizi - Special topics in finance lec 5
Dr. Syed Muhammad Ali Tirmizi - Special topics in finance   lec 5Dr. Syed Muhammad Ali Tirmizi - Special topics in finance   lec 5
Dr. Syed Muhammad Ali Tirmizi - Special topics in finance lec 5
 
Mba 532 2011_part_3_time_series_analysis
Mba 532 2011_part_3_time_series_analysisMba 532 2011_part_3_time_series_analysis
Mba 532 2011_part_3_time_series_analysis
 
Deseasonalizing Forecasts
Deseasonalizing ForecastsDeseasonalizing Forecasts
Deseasonalizing Forecasts
 
Time Series Analysis - 1 | Time Series in R | Time Series Forecasting | Data ...
Time Series Analysis - 1 | Time Series in R | Time Series Forecasting | Data ...Time Series Analysis - 1 | Time Series in R | Time Series Forecasting | Data ...
Time Series Analysis - 1 | Time Series in R | Time Series Forecasting | Data ...
 

Similar to Demand time series analysis and forecasting

stock market prediction
stock market predictionstock market prediction
stock market predictionSRIGINES
 
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docxDescriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docxcarolinef5
 
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docxDescriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docxdonaldp2
 
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docxDescriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docxcuddietheresa
 
IRJET- Analysis of Crucial Oil Gas and Liquid Sensor Statistics and Productio...
IRJET- Analysis of Crucial Oil Gas and Liquid Sensor Statistics and Productio...IRJET- Analysis of Crucial Oil Gas and Liquid Sensor Statistics and Productio...
IRJET- Analysis of Crucial Oil Gas and Liquid Sensor Statistics and Productio...IRJET Journal
 
Machine learning Investigative Reporting NorthBaySolutions.pdf
Machine learning Investigative Reporting NorthBaySolutions.pdfMachine learning Investigative Reporting NorthBaySolutions.pdf
Machine learning Investigative Reporting NorthBaySolutions.pdfssusera5352a2
 
Stock market analysis using supervised machine learning
Stock market analysis using supervised machine learningStock market analysis using supervised machine learning
Stock market analysis using supervised machine learningPriyanshu Gandhi
 
Time Series Weather Forecasting Techniques: Literature Survey
Time Series Weather Forecasting Techniques: Literature SurveyTime Series Weather Forecasting Techniques: Literature Survey
Time Series Weather Forecasting Techniques: Literature SurveyIRJET Journal
 
Automatic Forecasting at Scale
Automatic Forecasting at ScaleAutomatic Forecasting at Scale
Automatic Forecasting at ScaleSean Taylor
 
Predicting Stock Market Price Using Support Vector Regression
Predicting Stock Market Price Using Support Vector RegressionPredicting Stock Market Price Using Support Vector Regression
Predicting Stock Market Price Using Support Vector RegressionChittagong Independent University
 
SFScon 2020 - Geri Skenderi - Statistical forecasting with exogenous factors
SFScon 2020 - Geri Skenderi - Statistical forecasting with exogenous factorsSFScon 2020 - Geri Skenderi - Statistical forecasting with exogenous factors
SFScon 2020 - Geri Skenderi - Statistical forecasting with exogenous factorsSouth Tyrol Free Software Conference
 
Planning Mode Simulator: A simulation tool for studying ALMA's scheduling be...
 Planning Mode Simulator: A simulation tool for studying ALMA's scheduling be... Planning Mode Simulator: A simulation tool for studying ALMA's scheduling be...
Planning Mode Simulator: A simulation tool for studying ALMA's scheduling be...Arturo Hoffstadt
 
FPP 1. Getting started
FPP 1. Getting startedFPP 1. Getting started
FPP 1. Getting startedRob Hyndman
 
Presentation - Msc Thesis - Machine Learning Techniques for Short-Term Electr...
Presentation - Msc Thesis - Machine Learning Techniques for Short-Term Electr...Presentation - Msc Thesis - Machine Learning Techniques for Short-Term Electr...
Presentation - Msc Thesis - Machine Learning Techniques for Short-Term Electr...Praxitelis Nikolaos Kouroupetroglou
 
Production-Ready BIG ML Workflows - from zero to hero
Production-Ready BIG ML Workflows - from zero to heroProduction-Ready BIG ML Workflows - from zero to hero
Production-Ready BIG ML Workflows - from zero to heroDaniel Marcous
 
Sales Data Forecasting for Airline
Sales Data Forecasting for AirlineSales Data Forecasting for Airline
Sales Data Forecasting for AirlineAnurag Shandilya
 
Statr session 25 and 26
Statr session 25 and 26Statr session 25 and 26
Statr session 25 and 26Ruru Chowdhury
 

Similar to Demand time series analysis and forecasting (20)

stock market prediction
stock market predictionstock market prediction
stock market prediction
 
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docxDescriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
 
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docxDescriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
 
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docxDescriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
Descriptionsordernametypeformatvallabvarlab1location_idint8.0gNum.docx
 
Time series
Time seriesTime series
Time series
 
IRJET- Analysis of Crucial Oil Gas and Liquid Sensor Statistics and Productio...
IRJET- Analysis of Crucial Oil Gas and Liquid Sensor Statistics and Productio...IRJET- Analysis of Crucial Oil Gas and Liquid Sensor Statistics and Productio...
IRJET- Analysis of Crucial Oil Gas and Liquid Sensor Statistics and Productio...
 
Machine learning Investigative Reporting NorthBaySolutions.pdf
Machine learning Investigative Reporting NorthBaySolutions.pdfMachine learning Investigative Reporting NorthBaySolutions.pdf
Machine learning Investigative Reporting NorthBaySolutions.pdf
 
Stock market analysis using supervised machine learning
Stock market analysis using supervised machine learningStock market analysis using supervised machine learning
Stock market analysis using supervised machine learning
 
Time Series Weather Forecasting Techniques: Literature Survey
Time Series Weather Forecasting Techniques: Literature SurveyTime Series Weather Forecasting Techniques: Literature Survey
Time Series Weather Forecasting Techniques: Literature Survey
 
Automatic Forecasting at Scale
Automatic Forecasting at ScaleAutomatic Forecasting at Scale
Automatic Forecasting at Scale
 
Predicting Stock Market Price Using Support Vector Regression
Predicting Stock Market Price Using Support Vector RegressionPredicting Stock Market Price Using Support Vector Regression
Predicting Stock Market Price Using Support Vector Regression
 
IC2IT 2013 Presentation
IC2IT 2013 PresentationIC2IT 2013 Presentation
IC2IT 2013 Presentation
 
IC2IT 2013 Presentation
IC2IT 2013 PresentationIC2IT 2013 Presentation
IC2IT 2013 Presentation
 
SFScon 2020 - Geri Skenderi - Statistical forecasting with exogenous factors
SFScon 2020 - Geri Skenderi - Statistical forecasting with exogenous factorsSFScon 2020 - Geri Skenderi - Statistical forecasting with exogenous factors
SFScon 2020 - Geri Skenderi - Statistical forecasting with exogenous factors
 
Planning Mode Simulator: A simulation tool for studying ALMA's scheduling be...
 Planning Mode Simulator: A simulation tool for studying ALMA's scheduling be... Planning Mode Simulator: A simulation tool for studying ALMA's scheduling be...
Planning Mode Simulator: A simulation tool for studying ALMA's scheduling be...
 
FPP 1. Getting started
FPP 1. Getting startedFPP 1. Getting started
FPP 1. Getting started
 
Presentation - Msc Thesis - Machine Learning Techniques for Short-Term Electr...
Presentation - Msc Thesis - Machine Learning Techniques for Short-Term Electr...Presentation - Msc Thesis - Machine Learning Techniques for Short-Term Electr...
Presentation - Msc Thesis - Machine Learning Techniques for Short-Term Electr...
 
Production-Ready BIG ML Workflows - from zero to hero
Production-Ready BIG ML Workflows - from zero to heroProduction-Ready BIG ML Workflows - from zero to hero
Production-Ready BIG ML Workflows - from zero to hero
 
Sales Data Forecasting for Airline
Sales Data Forecasting for AirlineSales Data Forecasting for Airline
Sales Data Forecasting for Airline
 
Statr session 25 and 26
Statr session 25 and 26Statr session 25 and 26
Statr session 25 and 26
 

Recently uploaded

Big Data Foundations Level 1-IBM SkillsBuild
Big Data Foundations Level 1-IBM SkillsBuildBig Data Foundations Level 1-IBM SkillsBuild
Big Data Foundations Level 1-IBM SkillsBuildOshri Bitton
 
Artificial Intelligence and its Impact on Society.pptx
Artificial Intelligence and its Impact on Society.pptxArtificial Intelligence and its Impact on Society.pptx
Artificial Intelligence and its Impact on Society.pptxVighnesh Shashtri
 
PredictuVu ProposalV1.pptx
PredictuVu ProposalV1.pptxPredictuVu ProposalV1.pptx
PredictuVu ProposalV1.pptxKapilSinghal47
 
Tableau User Group - Khi > First Meetup! Movies + Data Hands-On Vizathon (11t...
Tableau User Group - Khi > First Meetup! Movies + Data Hands-On Vizathon (11t...Tableau User Group - Khi > First Meetup! Movies + Data Hands-On Vizathon (11t...
Tableau User Group - Khi > First Meetup! Movies + Data Hands-On Vizathon (11t...Mesum Raza Hemani
 
Web 3.0 in Data Privacy and Security | Data Privacy |Blockchain Security| Cyb...
Web 3.0 in Data Privacy and Security | Data Privacy |Blockchain Security| Cyb...Web 3.0 in Data Privacy and Security | Data Privacy |Blockchain Security| Cyb...
Web 3.0 in Data Privacy and Security | Data Privacy |Blockchain Security| Cyb...Cyber Security Experts
 
SABARI PRIYAN's self introduction as a reference
SABARI PRIYAN's self introduction as a referenceSABARI PRIYAN's self introduction as a reference
SABARI PRIYAN's self introduction as a referencepriyansabari355
 
Big Data - large Scale data (Amazon, FB)
Big Data - large Scale data (Amazon, FB)Big Data - large Scale data (Amazon, FB)
Big Data - large Scale data (Amazon, FB)CUO VEERANAN VEERANAN
 
chatgpt-prompts (1).pdf
chatgpt-prompts (1).pdfchatgpt-prompts (1).pdf
chatgpt-prompts (1).pdfMuntherMurjan1
 
Soil Health Policy Map Years 2020 to 2023
Soil Health Policy Map Years 2020 to 2023Soil Health Policy Map Years 2020 to 2023
Soil Health Policy Map Years 2020 to 2023stephizcoolio
 
Oppotus - Malaysians on Malaysia 4Q 2023.pdf
Oppotus - Malaysians on Malaysia 4Q 2023.pdfOppotus - Malaysians on Malaysia 4Q 2023.pdf
Oppotus - Malaysians on Malaysia 4Q 2023.pdfOppotus
 
[IRTalks@The University of Glasgow] A Topology-aware Analysis of Graph Collab...
[IRTalks@The University of Glasgow] A Topology-aware Analysis of Graph Collab...[IRTalks@The University of Glasgow] A Topology-aware Analysis of Graph Collab...
[IRTalks@The University of Glasgow] A Topology-aware Analysis of Graph Collab...Daniele Malitesta
 
Morris H. DeGroot, Mark J. Schervish - Probability and Statistics (4th Editio...
Morris H. DeGroot, Mark J. Schervish - Probability and Statistics (4th Editio...Morris H. DeGroot, Mark J. Schervish - Probability and Statistics (4th Editio...
Morris H. DeGroot, Mark J. Schervish - Probability and Statistics (4th Editio...AkbarHidayatullah11
 
SABARI PRIYAN's self introduction as reference
SABARI PRIYAN's self introduction as referenceSABARI PRIYAN's self introduction as reference
SABARI PRIYAN's self introduction as referencepriyansabari355
 
GDSC Machine Learning Session Presentation
GDSC Machine Learning Session PresentationGDSC Machine Learning Session Presentation
GDSC Machine Learning Session Presentationgdsclavasa
 
Hashing and File Structures in Data Structure.pdf
Hashing and File Structures in Data Structure.pdfHashing and File Structures in Data Structure.pdf
Hashing and File Structures in Data Structure.pdfJaithoonBibi
 

Recently uploaded (17)

Big Data Foundations Level 1-IBM SkillsBuild
Big Data Foundations Level 1-IBM SkillsBuildBig Data Foundations Level 1-IBM SkillsBuild
Big Data Foundations Level 1-IBM SkillsBuild
 
Artificial Intelligence and its Impact on Society.pptx
Artificial Intelligence and its Impact on Society.pptxArtificial Intelligence and its Impact on Society.pptx
Artificial Intelligence and its Impact on Society.pptx
 
PredictuVu ProposalV1.pptx
PredictuVu ProposalV1.pptxPredictuVu ProposalV1.pptx
PredictuVu ProposalV1.pptx
 
Optimizing GenAI apps, by N. El Mawass and Maria Knorps
Optimizing GenAI apps, by N. El Mawass and Maria KnorpsOptimizing GenAI apps, by N. El Mawass and Maria Knorps
Optimizing GenAI apps, by N. El Mawass and Maria Knorps
 
Tableau User Group - Khi > First Meetup! Movies + Data Hands-On Vizathon (11t...
Tableau User Group - Khi > First Meetup! Movies + Data Hands-On Vizathon (11t...Tableau User Group - Khi > First Meetup! Movies + Data Hands-On Vizathon (11t...
Tableau User Group - Khi > First Meetup! Movies + Data Hands-On Vizathon (11t...
 
Web 3.0 in Data Privacy and Security | Data Privacy |Blockchain Security| Cyb...
Web 3.0 in Data Privacy and Security | Data Privacy |Blockchain Security| Cyb...Web 3.0 in Data Privacy and Security | Data Privacy |Blockchain Security| Cyb...
Web 3.0 in Data Privacy and Security | Data Privacy |Blockchain Security| Cyb...
 
SABARI PRIYAN's self introduction as a reference
SABARI PRIYAN's self introduction as a referenceSABARI PRIYAN's self introduction as a reference
SABARI PRIYAN's self introduction as a reference
 
Big Data - large Scale data (Amazon, FB)
Big Data - large Scale data (Amazon, FB)Big Data - large Scale data (Amazon, FB)
Big Data - large Scale data (Amazon, FB)
 
chatgpt-prompts (1).pdf
chatgpt-prompts (1).pdfchatgpt-prompts (1).pdf
chatgpt-prompts (1).pdf
 
Soil Health Policy Map Years 2020 to 2023
Soil Health Policy Map Years 2020 to 2023Soil Health Policy Map Years 2020 to 2023
Soil Health Policy Map Years 2020 to 2023
 
Oppotus - Malaysians on Malaysia 4Q 2023.pdf
Oppotus - Malaysians on Malaysia 4Q 2023.pdfOppotus - Malaysians on Malaysia 4Q 2023.pdf
Oppotus - Malaysians on Malaysia 4Q 2023.pdf
 
[IRTalks@The University of Glasgow] A Topology-aware Analysis of Graph Collab...
[IRTalks@The University of Glasgow] A Topology-aware Analysis of Graph Collab...[IRTalks@The University of Glasgow] A Topology-aware Analysis of Graph Collab...
[IRTalks@The University of Glasgow] A Topology-aware Analysis of Graph Collab...
 
Morris H. DeGroot, Mark J. Schervish - Probability and Statistics (4th Editio...
Morris H. DeGroot, Mark J. Schervish - Probability and Statistics (4th Editio...Morris H. DeGroot, Mark J. Schervish - Probability and Statistics (4th Editio...
Morris H. DeGroot, Mark J. Schervish - Probability and Statistics (4th Editio...
 
DELHI URBANIZATION
DELHI URBANIZATIONDELHI URBANIZATION
DELHI URBANIZATION
 
SABARI PRIYAN's self introduction as reference
SABARI PRIYAN's self introduction as referenceSABARI PRIYAN's self introduction as reference
SABARI PRIYAN's self introduction as reference
 
GDSC Machine Learning Session Presentation
GDSC Machine Learning Session PresentationGDSC Machine Learning Session Presentation
GDSC Machine Learning Session Presentation
 
Hashing and File Structures in Data Structure.pdf
Hashing and File Structures in Data Structure.pdfHashing and File Structures in Data Structure.pdf
Hashing and File Structures in Data Structure.pdf
 

Demand time series analysis and forecasting

  • 1. Time Series Modeling and Forecasting Mohamed Baddar Data scientist - Careem Networks GmbH mbaddar2@gmail.com https://twitter.com/mbaddar2 https://mbaddards.blogspot.com/
  • 2. Contents A gentle introduction for time series analysis and forecasting, in this session we introduce: 1. Application for time series analysis and forecasting 2. Visual analysis of time series 3. Stationarity of time series 4. Different Time Series models 5. Time series data preprocessing 6. Building Time Series Model 7. Evaluating Models 8. Demo 9. Questions 2
  • 3. 1. Applications of time series analysis ● Economic/Sales forecasting ● Stock market analysis ● User Behavior analysis ● Process and quality control ● Inventory Studies ● Weather Forecasting ● Workload projections ● Census Analysis 3 References: http://www.itl.nist.gov/div898/handbook/pmc/section4/pmc41.htm
  • 4. The Main idea behind time series analysis step: Systematically Isolating each “assumed” component of the time series and identify it as a “reproducible pattern” till the remainder becomes unexplainable white noise 4
  • 5. 2. Visual Analysis Human eye and brain are one of the most complex analysis tools What quick answers can we get from visual analysis ● Is there any abnormal values (outliers) ● Any detectable trend, seasonality ● For cross time series analysis (are the two serieses behaving in the same way) 5
  • 6. 4. Stationarity of a Time Series ● Strict stationarity ○ Joint distribution of (Y_t, Y_t+1, … Y_t+n) is the same as (Y_t+k,Y_t+1+k, … Y_t+n+k) Where 0<=t,n,k<=N , t+n+k<=N ○ In other words , the joint distribution of a n-window of the data doesn’t change as the window moves over the series ○ Practically , hard to estimate the complete joint distribution of the moving n-windows, so practically we use mean and variance ● Weak stationarity ○ u and sigma are the same for the window n at different K’s (formula to add) ○ Our next objective is to “Stationarize the time series” ■ Making mean stable over time ■ Making variance stable over time 6
  • 7. 5. Different Time Series Models ● Error , Trend , Seasonality Model ○ Y = F(E,T,S) ○ Different combinations ○ Additive : Y = T+S+E ○ Multiplicative Y = T.S.E ● ARIMA model ○ Main signal modeled as Autoregressive Moving average integrated model ■ AR : ■ MA : ■ I 7
  • 8. Time Series Data Transformation ● Make series stationary (as possible) ● Log transformation ○ Y_t = B0*u_t*S_t ○ Log(Y_t) = Log(B0)+log(u_t)+log(S_t) ○ Log makes variance stable (independent from mean value or trend) ● Box-cox transformation 8
  • 9. Moving average ● Help reduce outliers effect and transient fluctuations 9
  • 10. Differencing ● For discrete data is the same as differentiation for continuous data ● Idea is to remove nth order trend with nth order differencing ● Practically applying differencing 2 times is sufficient to stationarize the time series 10
  • 11. Seasonality adjustment ● Trend Seasonal Error (ETS) model ○ Estimate seasonal index for each period (month of year) ○ De-seasonalize by either subtracting or dividing by seasonal index 11
  • 12. Holt-Winters seasonal method ● Model trend and seasonality using exponential smoothing ● Three main components: ○ Level ○ Trend ○ Seasonal 12
  • 13. 13 Holt Winter modeling and forecast example (R Air-Passengers Data) Fitted Model Sample forecast Predictes vs test
  • 14. Holt Winter modeling and forecast example (AirPassengers Data) ● Default parameters used ● Forecast for future 12 months ● Test data = 1 year (should be >= on period) ● RMSE used to test performance ● RMSE to naive forecast (simple random walk) can be used as a benchmark ● More details in the notebook 14
  • 15. General Approach for time series modeling and forecasting 1. Plotting 2. Check stationarity 3. Data Transformations 4. Seasonal , trend decomposition 5. AR and MA model checking 6. Residual checking 7. Building time series model a. Separate data into train and test b. Build model and forecast based on train data c. Apply performance measures on test data 8. Grid search and rolling origin usually used to get the best model 15