-
Notifications
You must be signed in to change notification settings - Fork 0
/
05.R
33 lines (25 loc) · 824 Bytes
/
05.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
library(fpp3)
library(tidyquant)
library(timetk)
library(gridExtra)
library(ggrepel)
aus_production_long <- aus_production %>%
pivot_longer(!Quarter, names_to = 'Name', values_to = 'Value')
aus_fit <- aus_production_long %>%
filter(Name == 'Beer') %>%
model(holt_winters = ETS(Value ~ error('A') + trend('A') + season('A')),
holt_winters_m = ETS(Value ~ error('M') + trend('A') + season('A')),
hw_m_d = ETS(Value ~ error('M') + trend('Ad') + season('A')))
report(aus_fit)
components(aus_fit) %>%
autoplot()
components(aus_fit) %>%
left_join(fitted(aus_fit), by = c('.model', 'Quarter', 'Name'))
aus_fit %>%
forecast(h = 8) %>%
autoplot(aus_production_long)
fit <- aus_production_long %>%
model(ets = ETS(Value))
fit %>%
forecast(h = 8) %>%
autoplot(aus_production_long)