Skip to content

Issues with holiday  #17

@benshing1984

Description

@benshing1984

I m beginner, how could I add holidays into the model?

library(fable.prophet)
library(prophet)
library(tsibble)
library(dplyr)

#try to add Holiday into tsibble
cn_holiday <- data_frame(
  holiday = 'cn',
  ds = as.Date(c('2019-01-01','2019-02-04','2019-02-05',
                 '2019-02-06','2019-02-07','2019-02-08',
                 '2019-02-09','2019-02-10','2019-04-05',
                 '2019-05-01','2019-06-07','2019-09-13',
                 '2019-10-01','2019-10-02','2019-10-03',
                 '2019-10-04','2019-10-05','2019-10-06',
                 '2019-10-07')),
  lower_window = 0,
  upper_window = 1
)
usa_holiday <- data_frame(
  holiday = 'usa',
  ds = as.Date(c('2019-01-01','2019-01-21','2019-02-18',
                 '2019-05-12','2019-05-27','2019-06-16',
                 '2019-07-04','2019-09-02','2019-10-14',
                 '2019-11-11','2019-11-28','2019-11-29',
                 '2019-12-25')),
  lower_window = 0,
  upper_window = 1
)
holidays <- bind_rows(cn_holiday, usa_holiday)
holidays<- as_tsibble(holidays, index = ds, key = holiday)

fit <- cafe %>% 
  model(
    prophet = fable.prophet::prophet(Turnover ~ season("year", 4, type = "multiplicative") + holiday( holidays = holidays))
  )

Warning message:
8 errors (1 unique) encountered for prophet
[8] object 'holidays' not found

it shown this warning message, do I miss anything ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions