1-Introduction To Time Series2022
1-Introduction To Time Series2022
INTRODUCTION TO
FORECASTING & TIME
SERIES STRUCTURE
Dr. Susan Simmons
Institute for Advanced Analytics
2
Source: xkcd.com/2620
3
Thermometer was
Station was changed
relocated
Forecasting Process
Propose
Fit Model
Model
Diagnose
Repeat
Model
21
Statistical Forecasting
Time
Signal Noise
Series
23
Statistical Forecasting
Time
Signal Noise
Series
Statistical Forecasting
Time
Signal Noise
Series
Statistical Forecasting
Time
Signal Noise
Series
Statistical Forecasting
Time
Signal Noise
Series
Time
Signal Noise
Series
𝑌𝑡 = 𝑇𝑡 + 𝑆𝑡 + 𝐸𝑡
• Multiplicative:
𝑌𝑡 = 𝑇𝑡 × 𝑆𝑡 × 𝐸𝑡
30
𝑌𝑡 = 𝑇𝑡 + 𝑆𝑡 + 𝐸𝑡
Trend / Cycle
• Multiplicative:
𝑌𝑡 = 𝑇𝑡 × 𝑆𝑡 × 𝐸𝑡
31
𝑌𝑡 = 𝑇𝑡 + 𝑆𝑡 + 𝐸𝑡
Seasonal
• Multiplicative:
𝑌𝑡 = 𝑇𝑡 × 𝑆𝑡 × 𝐸𝑡
32
𝑌𝑡 = 𝑇𝑡 + 𝑆𝑡 + 𝐸𝑡
Error
• Multiplicative:
𝑌𝑡 = 𝑇𝑡 × 𝑆𝑡 × 𝐸𝑡
33
𝑌𝑡 = 𝑇𝑡 + 𝑆𝑡 + 𝐸𝑡
• Multiplicative:
𝑌𝑡 = 𝑇𝑡 × 𝑆𝑡 × 𝐸𝑡
OR
log(𝑌𝑡 ) = log(𝑇𝑡 ) + log(𝑆𝑡 ) + log(𝐸𝑡 )
34
𝑌𝑡 = 𝑇𝑡 + 𝑆𝑡 + 𝐸𝑡
𝑌𝑡 − 𝑆𝑡 (𝑇𝑡 + 𝐸𝑡 )
𝑌𝑡
=
𝑆𝑡
+
𝑇𝑡
+
𝐸𝑡
39
𝑌𝑡
=
𝑆𝑡 Original
+ data
𝑇𝑡
+
𝐸𝑡
40
𝑌𝑡
=
𝑆𝑡
+
Seasonal
𝑇𝑡 Component
+
𝐸𝑡
41
𝑌𝑡
=
𝑆𝑡
+
𝑇𝑡
+
𝐸𝑡 Trend
Component
42
𝑌𝑡
=
𝑆𝑡
+
𝑇𝑡
Remainder
+ (What’s left
𝐸𝑡 over)
43
autoplot(decomp_stl)
44
45
autoplot(Passenger)+
geom_line(aes(y=decomp_stl$time.series[,2]),
color="blue")
seas_adj=Passenger-decomp_stl$time.series[,1]
autoplot(Passenger) +
geom_line(aes(y=decomp_stl$time.series[,2]),color="blue")
+ geom_line(aes(y=seas_adj),color="orange")
𝑇𝑡
𝑌𝑡 − 𝑆𝑡 = 𝑇𝑡 + 𝐸𝑡
49
ggsubseriesplot(Passenger)
50
Decomposition Techniques
• There are many different ways to calculate the trend/cycle
and seasonal effects inside time series data.
• Here are 3 common techniques:
1. Classical Decomposition
52
Decomposition Techniques
• There are many different ways to calculate the trend/cycle
and seasonal effects inside time series data.
• Here are 3 common techniques:
1. Classical Decomposition
a. Default in SAS (Can be done in R)
b. Trend – Uses Moving / Rolling Average Smoothing
c. Seasonal – Average De-trended Values Across Seasons
53
Decomposition Techniques
• There are many different ways to calculate the trend/cycle
and seasonal effects inside time series data.
• Here are 3 common techniques:
1. Classical Decomposition
2. X-13 ARIMA Decomposition (self study)
a. Trend – Uses Moving / Rolling Average Smoothing
b. Seasonal – Uses Moving / Rolling Average Smoothing
c. Iteratively Repeats Above Methods and ARIMA Modeling
d. Can handle outliers
54
Decomposition Techniques
• There are many different ways to calculate the
trend/cycle, and seasonal effects inside time series data.
• Here are 3 common techniques:
1. Classical Decomposition
2. X-12 ARIMA Decomposition
3. STL (Seasonal and Trend using LOESS estimation)
Decomposition
a. Default of stl Function in R (Not available in SAS)
b. Uses LOcal regrESSion Techniques to Estimate Trend
and Seasonality
c. Allows Changing Effects for Trend and Season
d. Adapted to Handle Outliers
55