Reputation: 191
I'm trying to use the seasonal::seas()
function to do a seasonal decomposition on my time series data and plot the results. Wrapping the autoplot()
function around seas()
usually works great but for the data below I am getting an error. I have seen some posts with subscript out of bounds errors around seasonal decomposition but none that have fixed the issue. The seas()
function has the warning Model used in SEATS is different: (1 1 2)
but I dont know why that would cause an error. Any help in resolving this issue would be greatly appreciated.
The code:
library(forecast)
library(seasonal)
data <- c(11666, 18526, 14955, 13791, 13508, 15682, 23039, 24190, 23628, 23411, 25068, 20204, 16084, 15726, 13677, 14668, 17915, 25673, 30529, 31990, 31334, 30129, 24323, 19584, 20827, 19766, 21886, 25119, 31832, 31032, 26647, 28725, 26160, 22611, 20698, 21711, 20014, 21698, 27068, 27181, 23442, 25894, 22482, 21894, 20365, 20078, 20995, 22959, 25745, 33074, 29875, 27740, 29499, 27302, 19854, 19658, 20850, 20130, 21415, 25808, 35240, 31326, 31128, 29594, 25660, 26359, 25723, 26995, 25283, 26823)
time_series <- ts(data, freq=12, start=c(2013, 10))
autoplot(seas(time_series))
Produces the error:
Model used in SEATS is different: (1 1 2)
Error in `[.default`(object$data, , c("trend", "seasonal", "irregular")) :
subscript out of bounds
Upvotes: 0
Views: 810
Reputation: 31800
This occurs because the decomposition has no seasonal component and autoplot()
is assuming that it does.
I've now updated the dev version of the package (https://github.com/robjhyndman/forecast) to allow this case.
Upvotes: 1