Please enable JavaScript.
Coggle requires JavaScript to display documents.
4307 - Forecasting Analytics - Coggle Diagram
4307 - Forecasting Analytics
INTRO
2 methods
time series
Associative models (predict future)
TIME SERIES
PAtterns
horizontal= around constant mean
seasonal
cyclical = like sseason but happen not in a fixed time period
trend
SCATTERPLOTS
FORECASTER TOOL BOX incld
workflow
Tidy (prep)
Plot (visualize)
Define model (specify)
train model (estimate)
check performance (evaluate)
Forecast
&. Visualize forecast
forecast methods
naive: forecast = last value
seasonal naive = last value fr same season
drift method = seasonal, but take trend into consideration
Fitted values & Residuals
residuals = diff actual n forecast, yt based on y(t-1)
gg_tsresiduals()
function
y(t-1) = fitted value
good characteristics
o corelation between them
0 mean, or else biased
data training = use majority of past data as training, rest as test data to evaluate model
measure of accuracy (page 33)
accuracy
Prediction interval
hilo() converts into distribution
DECOMPOSITION
Trànomration = modify data for simpler forecasting
calendar
population
infliation
math
box cox transformation
tranform value using an equation, then forcast, then reverse the transformation (ex slide 17)
a math transformation
TS components
seasonal, trend, cycle
Decomposition method
simple moving method
smooth data to reduce variation
for example average of 5 years in a row
Additive decomposition/nultiplicative decomposition
Modern decomposition STL
"Seasonal and Trend decomposition using Loess"
EXPONENTIAL SMOOTHING (there is short version on brightspace)
?
extended moving average, weighted averages
a,b,y
a controls level
=0 -> never update (mean), =1 -> updates constantly (naive)
b controls flexibility
0-> linear, 1-> changes every observation
y controls seasonality
0 -> seasonality never update, 1 -> update completely
ETS ExponenTial Smoothing = error, trend, seasonality
Simple ETS
Single ETS
weights most recent obs = a and most recent forecast 1-a
𝐹𝑡+1 = α𝑌𝑡 + 1 − α 𝐹𝑡
Holt's method
extended single smoothing, model with trend
slide 25 w4
Holt-Winters' Method - captures seasonality
Taxonomy: different ways in familty, page 40
State Space Model
produce interval forecast
ARIMA
vs exp smoothing
smoothing = based on trend and seasonality
ARIMA describes autcorration
BASICALLY MESURES THE CHANGES
Stationary time series
properties not depend time
is
roughly horizontal
constant variance
no pattern
needs transform to stabilize
Differencing
= change between obsv
random walk model
yt - y(t-1) = c+et
might need 2nd diff
c is average changes
instead of -1 can -m to account for seasonal diff
can apply both, no matter order
How to know if differencing is required
Unit root tests
in this course, use KPSS
google_2018 %>% features(Close, unitroot_kpss)
backshift notation
describe process of differecing, aka how many period go back
A dth-order difference can be written (1-B)^d*yt
first difference
AUTO CHOOSE DIFFERENCE
google_2018 %>% features(Close, unitroot_ndiffs)
ndiff=1 -> need 1 difference
Autoregressive Model
in multiple regression use combinaiton of predictors
autoreression mode uses linear combination of past values
important: slide 35
moving average model
multiple regression past errors as predictor, as opposed to using past values
diff than m.a.smoothing: smoothing is for detrend
Non-seasonal ARIMA
= AUTOREGRESSION + MOVING AVERAGE
use both past values and past errors
ARIMA(p, d, q)
p = order of autoregressive
d = degree of first differencing
q = order of moving average
could be represent as like (1,0,0)
there is a code to look for p d q
MODEL W ARENA
example: slide 41 w8, steps on slide 38
Afircan, has trend, no chnaging variance
Take first differencing
look at pacf, choose the first line that crosses the blueline
SeasonalARIMa (p,d,q)(P,D,Q)m, with m = sumber of periods per season
Estimation & Order selection
When R estimates ARIMA, uses Max Likelihood Estimation
its a technique
How to choose p & q
manual way:L page 42 week 8 L the pacf leg of 4, so choose 4
automated: ARIMA()
Akaike’s Information Criterion AIC
used to evaluate model accuracy, lower better
STEPS
https://otexts.com/fpp3/arima-r.html
- modeling procedure
SEASONAL ARIMA
ARIMA (p,d,q)(P,D,Q)m
p,d,q = non seasonal
P,D,Q = seasonal, with m = period
Q > 0 if q >0, also same for p
Find P,D, Q by looking at the last significant spike IN SEASON (12, 24), as opposed to p,d,q in which look for small time frame
example
https://otexts.com/fpp3/seasonal-arima.html#fig:usemployment2
ARIMA vs ETS
ETS = combine mulpiple components, while ARIMA = autocorrelation