使用 prophet 包进行反向预测

Backwards forecasting using the prophet package

我有 Jul'17 到 Jul'18 的零售销售数据,想将该系列扩展到 Jan'17 ~ Jun'17 期间,我没有任何数据。

由于这是零售数据,我想使用 prophet 包,因为它考虑了假期和 monthly/yearly 趋势。但是我看不到让它预测过去的数据,因为我不能调用 make_future_dataframe 给我一个过去的时期。

我无法共享数据,因此在我的示例中 y 是从 rnorm()

生成的
data = structure(list(ds = structure(c(17683, 17652, 17622, 17591, 17563, 
17532, 17501, 17471, 17440, 17410, 17379, 17348), class = "Date"), 
y = c(104.668732663406, 98.3902718818212, 109.061616978181, 
109.838504824619, 111.732728009024, 102.108143707743, 99.4680518699638, 
84.228075141372, 110.844516862675, 92.5728013090567, 80.8504745693786, 
108.721168531315)), .Names = c("ds", "y"), row.names = c(NA, 
-12L), class = "data.frame")

m <- prophet(data,seasonality.mode = "multiplicative",yearly.seasonality = T)
future <- make_future_dataframe(m, periods = 6, freq = "1 month")
forecast <- predict(m, future)  %>% data.table() 

有什么方法可以让我 prophet 无需填写假日期就可以给我过去的预测?

谢谢

如果以后有人偶然发现这个问题,解决方案是手动创建未来的数据框:

future = data.frame(
  "ds" = as.Date(c(
  "01/01/2017", #No Data
  "02/01/2017", #No Data
  "03/01/2017", #No Data
  "04/01/2017", #No Data
  "05/01/2017", #No Data
  "06/01/2017", #No Data
  "07/01/2017", #Data
  "08/01/2017", #Data
  "09/01/2017", #Data
  "10/01/2017", #Data
  "11/01/2017", #Data    
  "12/01/2017", #Data
  "01/01/2018", #Data
  "02/01/2018", #Data
  "03/01/2018", #Data
  "04/01/2018", #Data
  "05/01/2018", #Data
  "06/01/2018"),
  format = "%m/%d/%Y"
  )
)

predict() 将 return 所有时期的预测,即使您只提供 "future" 的数据。