SlideShare a Scribd company logo
Intro to Forecasting in R
Part Deux!
Houston R Users Group
Ed Goodwin, CFA
Last time at HRUG…
• we left off discussing linear
trend models.
• there was something VERY
wrong with this forecast.
• WHAT WAS IT?
How accurate was it?
RMSE Training = 38.3
RMSE Test = 76.6
Our forecast was really
inaccurate!
• the 95% confidence interval
is doing a poor job of
predicting recent values.
• there seems to be a seasonal
trend in the data that is
increasing over time.
• we are not accounting for
things like lower cost of travel
and population growth that
are affecting the data
The solution?
We need to
transform
the data!
What are transformations?
Transformations replace data with a function
of that data
Types of transformations
• convenience transforms - changing scale to make
calculations easier (percentages, absolute values, Fahrenheit
to Celsius, miles to kilometers)
• log transforms - for compounded data (CPI inflators, market
returns, power laws)
• skew reductions - reduce left or right skewness
• additive transforms - makes multiplicative relationships linear
• spread transforms - reduce heteroskedasticity
Some common transforms
TRANSFORM EXAMPLE
Reciprocal x = 1/x
Log x = log(x)
Roots x = x^2; x=sqrt(x)
Common scale y = 1:100; x = 1/y
Forecast with transform
• Use log( ) to account for growth factor
in Air Passenger data
More accurate?
RMSE Training = 0.134
RMSE Test = 0.167
Don’t forget to transform the
data back!
Back Transformed Plot
Linear Models
• lm( ) function to
create a linear
model
• tslm( ) is an lm( )
wrapper and adds
season and trend
variables
• season is a dummy
variable based on
data decomposition
What does our model look
like?
• Use the
summary( )
function to get
details
How well does it fit?
• Use the residuals( ) function to look at the std
error
Plot of Log Forecast using
seasonal Dummy Variable
Creating our own dummy
variables
• Time series with ‘1’ where variable is TRUE, ‘0’ where
FALSE
• Factors are a good place to start when creating
dummy variables
• Always have n-1 dummy variables (e.g. days of week
would have 6 dummy variables, since all ‘0’ would
represent one of the days)
Examples of dummy
variables
• Employment status (for credit scores)
• Bank holidays (for econometrics and market data)
• Black Friday and Christmas shopping season for retail
sales
• Days of critical events that move (e.g. Super Bowl
Sunday, worker strikes, natural disasters)
Easter Holiday 2014-2017
• Let’s say you’re in charge
of forecasting sales of
Cadbury Eggs for Cadbury
Schweppes. The sales
peak near the Easter
holiday in the US.
• Easter falls at various times
of the year (March or April)
• Solution? Create a dummy
variable for Easter
EASTER HOLIDAY
2014 April 20th
2015 April 5th
2016 March 27th
2017 April 16th
Easter Dummy Variable

More Related Content

What's hot

Data Science - Part X - Time Series Forecasting
Data Science - Part X - Time Series ForecastingData Science - Part X - Time Series Forecasting
Data Science - Part X - Time Series Forecasting
Derek Kane
 
Machine Learning - Time Series
Machine Learning - Time Series Machine Learning - Time Series
Machine Learning - Time Series
Rupak Roy
 
Sales forecasting of an airline company using time series analysis (1) (1)
Sales forecasting of an airline company using time series analysis (1) (1)Sales forecasting of an airline company using time series analysis (1) (1)
Sales forecasting of an airline company using time series analysis (1) (1)
Ashish Ranjan
 
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
 
Sales Data Forecasting for Airline
Sales Data Forecasting for AirlineSales Data Forecasting for Airline
Sales Data Forecasting for Airline
Anurag Shandilya
 
Control charts[1]
Control charts[1]Control charts[1]
Control charts[1]
66784532
 
Latihan Carta Kawalan
Latihan Carta KawalanLatihan Carta Kawalan
Latihan Carta Kawalan
Azlifa Aziz
 
Chapter 16
Chapter 16Chapter 16
Chapter 16
bmcfad01
 
Time Series Analysis - Modeling and Forecasting
Time Series Analysis - Modeling and ForecastingTime Series Analysis - Modeling and Forecasting
Time Series Analysis - Modeling and Forecasting
Maruthi Nataraj K
 
Qt presentation
Qt presentationQt presentation
Qt presentation
Devyani Jain
 
Demand time series analysis and forecasting
Demand time series analysis and forecastingDemand time series analysis and forecasting
Demand time series analysis and forecasting
M Baddar
 
Time Series FORECASTING
Time Series FORECASTINGTime Series FORECASTING
Time Series FORECASTING
Varun Khandelwal
 
Adj Exp Smoothing
Adj Exp SmoothingAdj Exp Smoothing
Adj Exp Smoothing
ahmad bassiouny
 
Week 4 forecasting - time series - smoothing and decomposition - m.awaluddin.t
Week 4   forecasting - time series - smoothing and decomposition - m.awaluddin.tWeek 4   forecasting - time series - smoothing and decomposition - m.awaluddin.t
Week 4 forecasting - time series - smoothing and decomposition - m.awaluddin.t
Maling Senk
 
Exponential smoothing
Exponential smoothingExponential smoothing
Exponential smoothing
Jairo Moreno
 
Time series, forecasting, and index numbers
Time series, forecasting, and index numbersTime series, forecasting, and index numbers
Time series, forecasting, and index numbers
Shakeel Nouman
 
Chap19 time series-analysis_and_forecasting
Chap19 time series-analysis_and_forecastingChap19 time series-analysis_and_forecasting
Chap19 time series-analysis_and_forecasting
Vishal Kukreja
 
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
Kiran Hanjar
 
Probabilistic data structures
Probabilistic data structuresProbabilistic data structures
Probabilistic data structures
Yoav chernobroda
 
Tools of total quality management
Tools of total quality managementTools of total quality management
Tools of total quality management
Tommie0607
 

What's hot (20)

Data Science - Part X - Time Series Forecasting
Data Science - Part X - Time Series ForecastingData Science - Part X - Time Series Forecasting
Data Science - Part X - Time Series Forecasting
 
Machine Learning - Time Series
Machine Learning - Time Series Machine Learning - Time Series
Machine Learning - Time Series
 
Sales forecasting of an airline company using time series analysis (1) (1)
Sales forecasting of an airline company using time series analysis (1) (1)Sales forecasting of an airline company using time series analysis (1) (1)
Sales forecasting of an airline company using time series analysis (1) (1)
 
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 ...
 
Sales Data Forecasting for Airline
Sales Data Forecasting for AirlineSales Data Forecasting for Airline
Sales Data Forecasting for Airline
 
Control charts[1]
Control charts[1]Control charts[1]
Control charts[1]
 
Latihan Carta Kawalan
Latihan Carta KawalanLatihan Carta Kawalan
Latihan Carta Kawalan
 
Chapter 16
Chapter 16Chapter 16
Chapter 16
 
Time Series Analysis - Modeling and Forecasting
Time Series Analysis - Modeling and ForecastingTime Series Analysis - Modeling and Forecasting
Time Series Analysis - Modeling and Forecasting
 
Qt presentation
Qt presentationQt presentation
Qt presentation
 
Demand time series analysis and forecasting
Demand time series analysis and forecastingDemand time series analysis and forecasting
Demand time series analysis and forecasting
 
Time Series FORECASTING
Time Series FORECASTINGTime Series FORECASTING
Time Series FORECASTING
 
Adj Exp Smoothing
Adj Exp SmoothingAdj Exp Smoothing
Adj Exp Smoothing
 
Week 4 forecasting - time series - smoothing and decomposition - m.awaluddin.t
Week 4   forecasting - time series - smoothing and decomposition - m.awaluddin.tWeek 4   forecasting - time series - smoothing and decomposition - m.awaluddin.t
Week 4 forecasting - time series - smoothing and decomposition - m.awaluddin.t
 
Exponential smoothing
Exponential smoothingExponential smoothing
Exponential smoothing
 
Time series, forecasting, and index numbers
Time series, forecasting, and index numbersTime series, forecasting, and index numbers
Time series, forecasting, and index numbers
 
Chap19 time series-analysis_and_forecasting
Chap19 time series-analysis_and_forecastingChap19 time series-analysis_and_forecasting
Chap19 time series-analysis_and_forecasting
 
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
 
Probabilistic data structures
Probabilistic data structuresProbabilistic data structures
Probabilistic data structures
 
Tools of total quality management
Tools of total quality managementTools of total quality management
Tools of total quality management
 

Similar to Intro To Forecasting - Part 2 - HRUG

Data Preparation with the help of Analytics Methodology
Data Preparation with the help of Analytics MethodologyData Preparation with the help of Analytics Methodology
Data Preparation with the help of Analytics Methodology
Rupak Roy
 
R - what do the numbers mean? #RStats
R - what do the numbers mean? #RStatsR - what do the numbers mean? #RStats
R - what do the numbers mean? #RStats
Jen Stirrup
 
HRUG - Linear regression with R
HRUG - Linear regression with RHRUG - Linear regression with R
HRUG - Linear regression with R
egoodwintx
 
forecast.ppt
forecast.pptforecast.ppt
forecast.ppt
RijuDasgupta
 
Logistical Regression.pptx
Logistical Regression.pptxLogistical Regression.pptx
Logistical Regression.pptx
Ramakrishna Reddy Bijjam
 
Automatic Forecasting at Scale
Automatic Forecasting at ScaleAutomatic Forecasting at Scale
Automatic Forecasting at Scale
Sean Taylor
 
CMG15 Session 525
CMG15 Session 525 CMG15 Session 525
CMG15 Session 525
Alex Gilgur
 
Large Scale Automatic Forecasting for Millions of Forecasts
Large Scale Automatic Forecasting for Millions of ForecastsLarge Scale Automatic Forecasting for Millions of Forecasts
Large Scale Automatic Forecasting for Millions of Forecasts
Ajay Ohri
 
Forecasting
ForecastingForecasting
Introduction to machine learning
Introduction to machine learningIntroduction to machine learning
Introduction to machine learning
Sanghamitra Deb
 
Statisics for hackers
Statisics for hackersStatisics for hackers
Statisics for hackers
Simon Belak
 
Lec 3.pptx
Lec 3.pptxLec 3.pptx
Lec 3.pptx
AliAkbar99386
 
need to realize in r studio (regression).pptx
need to realize in r studio (regression).pptxneed to realize in r studio (regression).pptx
need to realize in r studio (regression).pptx
SmarajitPaulChoudhur
 
15303589.ppt
15303589.ppt15303589.ppt
15303589.ppt
ABINASHPADHY6
 
"A Framework for Developing Trading Models Based on Machine Learning" by Kris...
"A Framework for Developing Trading Models Based on Machine Learning" by Kris..."A Framework for Developing Trading Models Based on Machine Learning" by Kris...
"A Framework for Developing Trading Models Based on Machine Learning" by Kris...
Quantopian
 
Day 1_ Introduction.pptx
Day 1_ Introduction.pptxDay 1_ Introduction.pptx
Day 1_ Introduction.pptx
AyushiAgarwal265370
 
Time Series Forecasting Using TBATS Model.pptx
Time Series Forecasting Using TBATS Model.pptxTime Series Forecasting Using TBATS Model.pptx
Time Series Forecasting Using TBATS Model.pptx
GowthamKumar470818
 
Regression
Regression Regression
Regression
JayeshGadhave1
 
Graphs and Financial Services Analytics
Graphs and Financial Services AnalyticsGraphs and Financial Services Analytics
Graphs and Financial Services Analytics
Neo4j
 
Marketing Analytics with R Lifting Campaign Success Rates
Marketing Analytics with R Lifting Campaign Success RatesMarketing Analytics with R Lifting Campaign Success Rates
Marketing Analytics with R Lifting Campaign Success Rates
Revolution Analytics
 

Similar to Intro To Forecasting - Part 2 - HRUG (20)

Data Preparation with the help of Analytics Methodology
Data Preparation with the help of Analytics MethodologyData Preparation with the help of Analytics Methodology
Data Preparation with the help of Analytics Methodology
 
R - what do the numbers mean? #RStats
R - what do the numbers mean? #RStatsR - what do the numbers mean? #RStats
R - what do the numbers mean? #RStats
 
HRUG - Linear regression with R
HRUG - Linear regression with RHRUG - Linear regression with R
HRUG - Linear regression with R
 
forecast.ppt
forecast.pptforecast.ppt
forecast.ppt
 
Logistical Regression.pptx
Logistical Regression.pptxLogistical Regression.pptx
Logistical Regression.pptx
 
Automatic Forecasting at Scale
Automatic Forecasting at ScaleAutomatic Forecasting at Scale
Automatic Forecasting at Scale
 
CMG15 Session 525
CMG15 Session 525 CMG15 Session 525
CMG15 Session 525
 
Large Scale Automatic Forecasting for Millions of Forecasts
Large Scale Automatic Forecasting for Millions of ForecastsLarge Scale Automatic Forecasting for Millions of Forecasts
Large Scale Automatic Forecasting for Millions of Forecasts
 
Forecasting
ForecastingForecasting
Forecasting
 
Introduction to machine learning
Introduction to machine learningIntroduction to machine learning
Introduction to machine learning
 
Statisics for hackers
Statisics for hackersStatisics for hackers
Statisics for hackers
 
Lec 3.pptx
Lec 3.pptxLec 3.pptx
Lec 3.pptx
 
need to realize in r studio (regression).pptx
need to realize in r studio (regression).pptxneed to realize in r studio (regression).pptx
need to realize in r studio (regression).pptx
 
15303589.ppt
15303589.ppt15303589.ppt
15303589.ppt
 
"A Framework for Developing Trading Models Based on Machine Learning" by Kris...
"A Framework for Developing Trading Models Based on Machine Learning" by Kris..."A Framework for Developing Trading Models Based on Machine Learning" by Kris...
"A Framework for Developing Trading Models Based on Machine Learning" by Kris...
 
Day 1_ Introduction.pptx
Day 1_ Introduction.pptxDay 1_ Introduction.pptx
Day 1_ Introduction.pptx
 
Time Series Forecasting Using TBATS Model.pptx
Time Series Forecasting Using TBATS Model.pptxTime Series Forecasting Using TBATS Model.pptx
Time Series Forecasting Using TBATS Model.pptx
 
Regression
Regression Regression
Regression
 
Graphs and Financial Services Analytics
Graphs and Financial Services AnalyticsGraphs and Financial Services Analytics
Graphs and Financial Services Analytics
 
Marketing Analytics with R Lifting Campaign Success Rates
Marketing Analytics with R Lifting Campaign Success RatesMarketing Analytics with R Lifting Campaign Success Rates
Marketing Analytics with R Lifting Campaign Success Rates
 

More from egoodwintx

Scaling in R
Scaling in RScaling in R
Scaling in R
egoodwintx
 
Boardgamegeek scraping
Boardgamegeek scrapingBoardgamegeek scraping
Boardgamegeek scraping
egoodwintx
 
HRUG - Text Mining to Construct Causal Models
HRUG - Text Mining to Construct Causal ModelsHRUG - Text Mining to Construct Causal Models
HRUG - Text Mining to Construct Causal Models
egoodwintx
 
Collaborative Package Development in R
Collaborative Package Development in RCollaborative Package Development in R
Collaborative Package Development in R
egoodwintx
 
Unit Testing in R with Testthat - HRUG
Unit Testing in R with Testthat - HRUGUnit Testing in R with Testthat - HRUG
Unit Testing in R with Testthat - HRUG
egoodwintx
 
Intro to RStudio
Intro to RStudioIntro to RStudio
Intro to RStudio
egoodwintx
 
Intro to Forecasting in R - Part 4
Intro to Forecasting in R - Part 4Intro to Forecasting in R - Part 4
Intro to Forecasting in R - Part 4
egoodwintx
 
Fantasy Football Draft Optimization in R - HRUG
Fantasy Football Draft Optimization in R - HRUGFantasy Football Draft Optimization in R - HRUG
Fantasy Football Draft Optimization in R - HRUG
egoodwintx
 
Eag 201110-hrugregexpresentation-111006104128-phpapp02
Eag 201110-hrugregexpresentation-111006104128-phpapp02Eag 201110-hrugregexpresentation-111006104128-phpapp02
Eag 201110-hrugregexpresentation-111006104128-phpapp02
egoodwintx
 

More from egoodwintx (9)

Scaling in R
Scaling in RScaling in R
Scaling in R
 
Boardgamegeek scraping
Boardgamegeek scrapingBoardgamegeek scraping
Boardgamegeek scraping
 
HRUG - Text Mining to Construct Causal Models
HRUG - Text Mining to Construct Causal ModelsHRUG - Text Mining to Construct Causal Models
HRUG - Text Mining to Construct Causal Models
 
Collaborative Package Development in R
Collaborative Package Development in RCollaborative Package Development in R
Collaborative Package Development in R
 
Unit Testing in R with Testthat - HRUG
Unit Testing in R with Testthat - HRUGUnit Testing in R with Testthat - HRUG
Unit Testing in R with Testthat - HRUG
 
Intro to RStudio
Intro to RStudioIntro to RStudio
Intro to RStudio
 
Intro to Forecasting in R - Part 4
Intro to Forecasting in R - Part 4Intro to Forecasting in R - Part 4
Intro to Forecasting in R - Part 4
 
Fantasy Football Draft Optimization in R - HRUG
Fantasy Football Draft Optimization in R - HRUGFantasy Football Draft Optimization in R - HRUG
Fantasy Football Draft Optimization in R - HRUG
 
Eag 201110-hrugregexpresentation-111006104128-phpapp02
Eag 201110-hrugregexpresentation-111006104128-phpapp02Eag 201110-hrugregexpresentation-111006104128-phpapp02
Eag 201110-hrugregexpresentation-111006104128-phpapp02
 

Recently uploaded

ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data LakeViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
Walaa Eldin Moustafa
 
Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......
Sachin Paul
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Kiwi Creative
 
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
74nqk8xf
 
Challenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more importantChallenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more important
Sm321
 
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
nyfuhyz
 
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
v7oacc3l
 
Experts live - Improving user adoption with AI
Experts live - Improving user adoption with AIExperts live - Improving user adoption with AI
Experts live - Improving user adoption with AI
jitskeb
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
aqzctr7x
 
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
g4dpvqap0
 
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
g4dpvqap0
 
DSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelinesDSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelines
Timothy Spann
 
University of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma TranscriptUniversity of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma Transcript
soxrziqu
 
The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
Social Samosa
 
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
Timothy Spann
 
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Aggregage
 
My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.
rwarrenll
 
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
74nqk8xf
 
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
sameer shah
 
Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...
Bill641377
 

Recently uploaded (20)

ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data LakeViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
ViewShift: Hassle-free Dynamic Policy Enforcement for Every Data Lake
 
Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
 
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
一比一原版(牛布毕业证书)牛津布鲁克斯大学毕业证如何办理
 
Challenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more importantChallenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more important
 
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
 
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
 
Experts live - Improving user adoption with AI
Experts live - Improving user adoption with AIExperts live - Improving user adoption with AI
Experts live - Improving user adoption with AI
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
 
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
 
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
 
DSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelinesDSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelines
 
University of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma TranscriptUniversity of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma Transcript
 
The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
 
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
 
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
 
My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.
 
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
 
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
 
Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...Population Growth in Bataan: The effects of population growth around rural pl...
Population Growth in Bataan: The effects of population growth around rural pl...
 

Intro To Forecasting - Part 2 - HRUG

  • 1. Intro to Forecasting in R Part Deux! Houston R Users Group Ed Goodwin, CFA
  • 2. Last time at HRUG… • we left off discussing linear trend models. • there was something VERY wrong with this forecast. • WHAT WAS IT?
  • 3. How accurate was it? RMSE Training = 38.3 RMSE Test = 76.6
  • 4. Our forecast was really inaccurate! • the 95% confidence interval is doing a poor job of predicting recent values. • there seems to be a seasonal trend in the data that is increasing over time. • we are not accounting for things like lower cost of travel and population growth that are affecting the data
  • 5. The solution? We need to transform the data!
  • 6. What are transformations? Transformations replace data with a function of that data
  • 7. Types of transformations • convenience transforms - changing scale to make calculations easier (percentages, absolute values, Fahrenheit to Celsius, miles to kilometers) • log transforms - for compounded data (CPI inflators, market returns, power laws) • skew reductions - reduce left or right skewness • additive transforms - makes multiplicative relationships linear • spread transforms - reduce heteroskedasticity
  • 8. Some common transforms TRANSFORM EXAMPLE Reciprocal x = 1/x Log x = log(x) Roots x = x^2; x=sqrt(x) Common scale y = 1:100; x = 1/y
  • 9. Forecast with transform • Use log( ) to account for growth factor in Air Passenger data
  • 10. More accurate? RMSE Training = 0.134 RMSE Test = 0.167
  • 11. Don’t forget to transform the data back!
  • 13. Linear Models • lm( ) function to create a linear model • tslm( ) is an lm( ) wrapper and adds season and trend variables • season is a dummy variable based on data decomposition
  • 14. What does our model look like? • Use the summary( ) function to get details
  • 15. How well does it fit? • Use the residuals( ) function to look at the std error
  • 16. Plot of Log Forecast using seasonal Dummy Variable
  • 17. Creating our own dummy variables • Time series with ‘1’ where variable is TRUE, ‘0’ where FALSE • Factors are a good place to start when creating dummy variables • Always have n-1 dummy variables (e.g. days of week would have 6 dummy variables, since all ‘0’ would represent one of the days)
  • 18. Examples of dummy variables • Employment status (for credit scores) • Bank holidays (for econometrics and market data) • Black Friday and Christmas shopping season for retail sales • Days of critical events that move (e.g. Super Bowl Sunday, worker strikes, natural disasters)
  • 19. Easter Holiday 2014-2017 • Let’s say you’re in charge of forecasting sales of Cadbury Eggs for Cadbury Schweppes. The sales peak near the Easter holiday in the US. • Easter falls at various times of the year (March or April) • Solution? Create a dummy variable for Easter EASTER HOLIDAY 2014 April 20th 2015 April 5th 2016 March 27th 2017 April 16th