我有关于产品销售的每日时间序列,我的系列从2016年1月1日至2017年9月30日开始 .

有一些重要的事情 . 首先,周日没有数据,因为这个商店周日不工作(因此,星期日的预期值为零),其次,有多种循环模式(每日和每周模式) .

例如,卖出的一周中最好的一天是星期二,最差的是星期四 . 我知道tbats模型是为有多个循环模式时使用而设计的,所以我使用的是这个模型 .

我的问题是我在预测时收到错误消息:

Error in try.xts(0) : 
  Error in as.xts.double(x, ..., .RECLASS = TRUE) :   
    order.by must be either 'names()' or otherwise specified.

这是我的代码:

library(lubridate)
library(xts)
library(dplyr)
library(forecast)

milk <- read.table("Series.txt", header = TRUE)
attach(milk)
df$Date = mdy(df$Date)

# Now I remove Sundays

ts_no_sunday = df %>%
filter(wday(df$Date) != 1) %>%
  {xts(.$Units, .$Date)}

最后,我的tbats模型

m_tbats = tbats(ts_no_sunday)
f_tbats = forecast(m_tbats, h=30)

这是我收到此错误的地方:

Error in try.xts(0) : 
  Error in as.xts.double(x, ..., .RECLASS = TRUE) :
    order.by must be either 'names()' or otherwise specified

我在这做错了什么?

非常感谢 !

Pdt:这是我的数据

https://drive.google.com/file/d/0BzIf8XvzKOGWMWFPcllhYnR5VDg/view?usp=sharing