0

I have weekly time series data having 35 weeks starting from 2016-10-17 and would like to see decompose plot. However decompose plot throws error saying less than two periods which i guess needs two or more years of data.

a <- ts(1:35,frequency = 52,start = c(2016,41))  
plot(decompose(a))

Error in decompose(a) : time series has no or less than 2 periods

Does ts function works only if there is 2 years of data or more or is there any work around? Is there any other way to see the plots?

joy
  • 3
  • 4
  • Yes it only works with 2 years of data – Rick Oct 27 '17 at 12:50
  • The data set has weekly seasonality say every 1st week of the month expenditure is high and then goes down and it repeats next month and so on...I have 35 weeks of data and is there any other way to do it. – joy Oct 27 '17 at 14:02
  • Not the best solution, but if you say one month is 4 weeks you can generate your series like this: a <- ts(1:35,frequency = 4,start = c(2016,41)), then decompose is working – Rick Oct 27 '17 at 14:58
  • @Zephro ts normally consider a year as a cycle and hence with frequency = 4 ts consider it as a quarterly data. But my cycle is week and i have 1 observation per week. – joy Oct 31 '17 at 07:53

0 Answers0