具有每周数据的 X-13 Arima 座位不起作用

X-13 Arima Seats with weekly data does not work

我正在使用 R 并且我有每周数据(总共 660 个观察),我想使用季节性包中的 X-13 Arima-Seats 来季节性调整我的数据。我将数据存储在 ts 对象中:

library(lubridate)
x <- ts(data, freq=365.25/7, start=decimal_date(ymd("2004-02-01")))
library(seasonal)
x_sa <- seas(x)

但是,我收到错误消息:

Error: X-13 run failed

Errors:
- Seasonal period too large. See Section 2.7 of the Reference Manual on program limits
- Expected argument name or "}" but found ".1785714285714"
- Time series could not be read due to previously found errors
- Expected specification name but found "}"
- Specify series before user-defined adjustments
- Need to specify a series to identify outliers

我也试了更短的时间,但是还是一样的错误。

我会按月和 运行 以下 ts 对象对您的每周数据进行平均:

ts(data, freq=12, start=c(2004,2))

您将失去一些数据粒度转换为月而不是周,但季节性包至少能够处理您的数据。

尝试 STL(使用 Loess 进行季节性和趋势分解)。您可以将其用于任何类型的季节性,而不仅仅是每月和每季度。

它有自动分解mstl()。因此,对于您的数据,公式为:

x_sa <- mstl(x)

函数 t.windows.window 有调整参数,你可以控制趋势周期和季节性成分的变化速度。 您可以从 Rob J Hyndman 和 George Athanasopoulos "Forecasting: Principles and Practice" 的书中获得更多详细信息。在 "Time series decomposition" 部分。