0
$\begingroup$

I am working with weekly time series data in R. I want to check my data for seasonality and trend and I am using the stl() function in R. This is my data.

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)

I convert this data to weekly time series.

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

And when I decompose it like this using stl(), I get the following.

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

Decomposition with robust=FALSE.

When I call the same function with robust=TRUE, I get the following.

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

Decomposition with robust=TRUE.

When robust=TRUE the seasonal component is increasing with each cycle. Why is this the case? When can I expect this sort of behavior and how do I prevent it from occurring?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.