问题
I am pretty sure I am missing something which is very simple but still not able to figure out why this error is showing up . The data I have is of every month end data from 2013 Apr to 2014 Mar. Now I want to understand the trend over the 12 months period .
xx <- structure(c(41.52, 41.52, 41.52, 41.68, 41.68, 41.68, 41.84,
41.84, 41.84, 42.05, 42.05, 42.05), .Tsp = c(2013.25, 2014.16666666667,
12), class = "ts");
is my time series data . Now when I use
stl(xx,s.window ="periodic")
I get error :
Error in stl(xx, s.window = "periodic") :
series is not periodic or has less than two periods
i am not sure what is wrong as I understand the series has 12 periods .Please assist
回答1:
The terminology is a little misleading. In R, the frequency
is the number of observations in one "period". For monthly data, frequency=12
and you have just one period. You need two periods, or 24 observations, to use stl()
.
来源:https://stackoverflow.com/questions/34191768/error-in-stl-series-is-not-periodic