Too few decomposition periods ()

The error looks like this:

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

I want to know what is the problem? I mainly write forecasting code using ARIMA, and I want to knoe if there are any seasonality or trends in my data.

Waiting for a quick reply !!!!!

+4
source share
1 answer

The error is pretty clear. Your time series, however you created it, has no seasonal cycles or less than 2 seasonal cycles. (This may not indicate that the data is not seasonal, you may have created samplets .) For example, I can reproduce the error by having time series with 7 quarterly observations that are clearly not two complete full seasonal cycles: / p>

 R> TS <- ts(1:7, frequency = 4) R> decompose(TS) Error in decompose(TS) : time series has no or less than 2 periods R> TS Qtr1 Qtr2 Qtr3 Qtr4 1 1 2 3 4 2 5 6 7 

Similarly, if I do not specify any sub-frequency (i.e. frequency = 1 in the ts() call, creating your samplets time series samplets [default]), I get the same error:

 R> TS <- ts(1:7) R> decompose(TS) Error in decompose(TS) : time series has no or less than 2 periods 

In any case, this indicates that you incorrectly created your "ts" object without specifying the correct frequency or deltat , or that you have a time series of insufficient length (number of years) to cover two full seasonal cycles.

Read ?ts in more detail to make sure that you are creating samplets . If you need more help, post a reproducible example.

+23
source

Source: https://habr.com/ru/post/1433129/


All Articles