LZago
March 10, 2021, 12:46am
1
Hi guys,
I was trying to combine some models to get a better forecast, I did not find any particular resource to follow, here you can find my dummy data to try it.
Any help would be very appreciated.
Regards,
Lucas
library(tidyverse)
library(tsibble)
library(fable)
iniciativa <- tibble(
data_planejada = seq(as.Date("2020-01-01"), length = 200, by = "1 day"),
demanda = sample(seq(100), size = 200, replace = TRUE)
) %>%
as_tsibble(index = data_planejada)
iniciativa_cv <- iniciativa %>%
slice(1:(n() - 5)) %>%
stretch_tsibble(.init=180, .step=1)
comb_model <- iniciativa_cv %>%
model(
cmbn = combination_model(RW(demanda ~ drift(),ETS(demanda ~ error("A") + trend("Ad", phi = 0.8) + season("N"), ARIMA(demanda ~ pdq(1, 0, 0) + PDQ(0, 0, 0)))))
)
suppressPackageStartupMessages({
library(fable)
library(dplyr)
library(tsibble)
library(tsibbledata)
})
iniciativa <- tibble(
data_planejada = seq(as.Date("2020-01-01"), length = 200, by = "1 day"),
demanda = sample(seq(100), size = 200, replace = TRUE)
) %>%
as_tsibble(index = data_planejada)
iniciativa_cv <- iniciativa %>%
slice(1:(n() - 5)) %>%
stretch_tsibble(.init=180, .step=1)
iniciativa_cv %>%
model(
cmbn = combination_model(
RW(demanda ~ drift()),
ETS(demanda ~ error("A") + trend("Ad", phi = 0.8) + season("N")),
ARIMA(demanda ~ pdq(1,0,0) + PDQ(0,0,0))
))
#> # A mable: 16 x 2
#> # Key: .id [16]
#> .id cmbn
#> <int> <model>
#> 1 1 <COMBINATION>
#> 2 2 <COMBINATION>
#> 3 3 <COMBINATION>
#> 4 4 <COMBINATION>
#> 5 5 <COMBINATION>
#> 6 6 <COMBINATION>
#> 7 7 <COMBINATION>
#> 8 8 <COMBINATION>
#> 9 9 <COMBINATION>
#> 10 10 <COMBINATION>
#> 11 11 <COMBINATION>
#> 12 12 <COMBINATION>
#> 13 13 <COMBINATION>
#> 14 14 <COMBINATION>
#> 15 15 <COMBINATION>
#> 16 16 <COMBINATION>
system
Closed
March 17, 2021, 6:03am
3
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.