error in stl .series is not periodic

落花浮王杯 提交于 2019-12-21 21:28:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!