Stl() for non seasonal time series data In R


#1

Hi All,

Can someone help me on the below ?

Can we use stl() for the non seasonal time series data. if yes, what is the value i should mention in s.window when there is no seasonality in data. I checked ACF and PACF on the data and found the if the data has trend and seasonality.

Thanks,
Sirisha.


#2

Why not use decompose() instead of stl()? Also, how are you checking whether your series has non-seasonality? If it’s just a visual analysis, I suggest you to go for stl() with s.windows=“periodic” and see the results.


#3

Thanks Gaurav for the reply and sharing your views. I have checked ACF and PACF to find the seasonality and i dont see any spikes in amplitude manner(postive and negative direction) and come to a conclusion that there is no seasonality.
i have used the stl() in the following way , then forcasting for 9 days . is that a right approch ?
can i forecast using the output of stl model ?

stlStockr = stl(Stock_traints,s.window=“periodic”)
stlStockr

#Forecasting using stl model
forecast_stl <- forecast(stlStockr, h=9)
forecast_stl$mean


#4

ACF and PACF graphs are majorly used to identify the autocorrelation in the series. This become necessary when your series is non-stationary.

Basic time series analysis says, you check for stationarity in your time series first before you move for any model. So here is what I would suggest:

  1. Apply the dickey-fuller test on your data to check if you have a stationary data. Read more about it’s application and usage.

  2. Use command plot(stl(Stock_traints,s.window=“periodic”)). This will decompose your series into trend, seasonlity and noise. Also, plot will give you a better understanding if your data has the seasonality or not.

  3. If the data is found to be non-seasonal, use ACF and PACF plots to ideantify what degree of differentiation is required to make the series stationary.

  4. Post this, you can run different models on your time-series for forecasting. I wouldn’t suggest you to use the stl object for forecasting, because it is the most basic forecasting technique that simply desasonalize the data for prediction and then seasonalize the output data to match the trend.

Hope this will help.

Peace.


#5

Sure,thanks for the inputs.

when we use Auto.arima() and holtwinters() models, these two will take care to make the data stationary by adding d (non seasonal) ,seasonal(D) parameters and alpha,beta,gamma respectively.

Please let me know if my understanding is corrrect.


#6

Not really. These model may come up with some values for d and D but it won’t result in good forecasting. You need to understand your series first before you get into it.

If you want to give these additional complications a miss, I’d suggest you to take a look at the Facebook prophet library. It’s easy to understand and implement, and doesn’t require you to input the paramaters such as trend and seasonality.

Peace.


#7

Great, thank you so much.