-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path122-prophet.R
36 lines (31 loc) · 865 Bytes
/
122-prophet.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
34
35
36
library(fable.prophet)
cement <- aus_production |>
filter(year(Quarter) >= 1988)
train <- cement |>
filter(year(Quarter) <= 2007)
fit <- train |>
model(
arima = ARIMA(Cement),
ets = ETS(Cement),
prophet = prophet(Cement ~ season(period = 4, order = 2,
type = "multiplicative"))
)
fc <- fit |> forecast(h = "2 years 6 months")
fc |> autoplot(cement)
fc |> accuracy(cement)
fit <- elec |>
model(
prophet(Demand ~ Temperature + Cooling + Working_Day +
season(period = "day", order = 10) +
season(period = "week", order = 5) +
season(period = "year", order = 3))
)
fit |>
components() |>
autoplot()
fit |> gg_tsresiduals()
fc <- fit |>
forecast(new_data = elec_newdata)
fc |>
autoplot(elec |> tail(10 * 48)) +
labs(x = "Date", y = "Demand (MWh)")