首页 > 解决方案 > 当鲁棒参数设置为 TRUE 时,为什么 R 中的 STL 函数会识别随每个周期增加的季节性分量?

问题描述

我正在使用 R 中的每周时间序列数据。我想检查我的数据的季节性和趋势,我正在使用stl()R 中的函数。这是我的数据。

x <- c(1229.65,1273.65,1219.15,1164.65,1292.65,1304.65,1372.65,1361.65,1240.65,
   1281.65,1248.65,997.65,1237.65,1265.65,1281.65,1338.65,1322.65,1039.65,
   1195.65,1251.65,1100.15,948.65,1023.65,986.65,999.65,963.65,996.65,
   1248.65,1202.65,1221.65,1303.65,1186.65,1327.65,1368.65,1760.65,1370.65,
   1286.65,1290.65,1325.65,1332.65,1493.65,1448.65,1466.65,1324.65,1306.65,
   1319.65,1277.65,1510.5,1684.5,1658.5,1528.5,1279.5,1476.65,1408.65,
   1575.65,1506.65,1366.65,1368.65,1417.65,1413.65,988.65,1275.65,1379.65,
   1376.65,1383.65,1191.65,1361.65,1618.5,1901.5,1934.5,1830.5,1323.5,
   1282.65,1218.65,1302.65,1334.65,1483.65,1233.65,1316.65,1349.65,1289.65,
   1225.65,1251.65,1364.65,1477.65,1482.65,1533.65,1467.65,1583.65,1308.65,
   1525.65,1596.65,1480.65,1713.65,1574.65,1847.5,1928.5,2160.65,1959.5,
   1436.5,1817.65,1951.65,1927.65,1898.65,2046.65,1951.65,1838.65,1748.65,
   1568.65,1728.65,1796.65,1977.65,1957.65,1943.65,1997.65,1962.65,1766.65,
   1807.65,1735.65,1504.65,1365.65,1846.65,1510.65,1361.65,1599.65,1433.65,
   1535.65,1647.65,1450.65,1676.65,1712.65,1694.65,1807.65,1697.65,1789.65,
   2040.65,2460.65,2819.65,2974.65,3264.65,5819.65,8960.65,4926.65,4786.65,
   3921.65,3281.65,2982.65,2332.65,1332.65,1234.65,1032.65,954.65)

我将此数据转换为每周时间序列。

ts.x <- ts(x, freq=365.25/7)

当我使用 像这样分解它时stl(),我得到以下信息。

ts.stl.robF <- stl(ts.x, s.window = 365.25/7, t.window = 13, robust = F)
autoplot(ts.stl.robF)

使用鲁棒 = FALSE 进行分解。

当我用 调用相同的函数时robust=TRUE,我得到以下信息。

ts.stl.robT <- stl(ts.x, s.window = 365.25/7, t.window = 13, robust = T)
autoplot(ts.stl.robT)

使用robust=TRUE 分解。

robust=TRUE季节性成分随着每个周期而增加时。为什么会这样?我什么时候可以预料到这种行为以及如何防止它发生?

编辑:我在以下链接的交叉验证中发布了相同的问题。 https://stats.stackexchange.com/questions/484842/why-does-the-stl-function-in-r-identify-a-seasonal-component-that-increase-with

标签: rstltime-seriesforecastdecomposition

解决方案


推荐阅读