1

I am attempting to use the 'forecast' package. I have a series of 54 monthly observations, read from a CSV file, and converted to a time series. Here is the raw data:

37.1 0 0 0 0 44.4 5.2 0 0 0 0 0 34.7 0 0 2 0 0 16.5 0 0 0 0 1.5 0 0 45.4 
0 0.2 0 3 16.2 4 0 0 0 32 0 2.9 0 0 0 0 35.2 0 0 35.6 1.2 0 0 0 0 4 0

When plotted using

plot.ts(TPS_TS)

I generate the following graphic:

enter image description here

It appears to me that there is at least some periodic component to this data. I then attempt to identify seasonal components with

TPS_Components <- decompose(TPS_TS)

But that generates the following error message

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

Am I doing something wrong or is there truly nothing there that can be identified?

jerH
  • 1,085
  • 1
  • 12
  • 30
  • 1
    The [first result on google](https://www.google.com/?q=Error+in+decompose+%3A+time+series+has+no+or+less+than+2+periods): http://stackoverflow.com/questions/12330581/too-few-periods-for-decompose – lukeA May 26 '16 at 20:09
  • That function does not detect periods. You have to supply it. If you are looking for a function that can identify periods for you, try Hyndman's brilliance http://stats.stackexchange.com/questions/1207/period-detection-of-a-generic-time-series – Pierre L May 26 '16 at 20:11
  • I'm using R-Studio, and when I begin typing decompose() it presents a parameter list that looks like this: decompose(x, type=c("additive", "multiplicative"), filter=NULL). The reference I'm working from (A Little Book of R for Time Series release 0.2) also makes no reference to specifying a period and indicates that the function will estimate the trend, seasonal, and irregular components of a time series. I'll check out the link you provided, but I can't help thinking I'm missing something here. It's not a "clean" period but there are significant spikes every 5-7 months.... – jerH May 26 '16 at 20:22
  • Thanks @lukeA....I wasn't creating my ts correctly. – jerH May 27 '16 at 04:52
  • Try Facebook's "Phophet Model" instead of Holt Winters. It takes care of seasonality ( At hour, day, week, month etc level) , trend, trend change points at day and hour level. http://machinelearningstories.blogspot.in/2017/05/facebooks-phophet-model-for-forecasting.html https://research.fb.com/prophet-forecasting-at-scale/ – Arpit Sisodia May 21 '17 at 07:32

0 Answers0