10
$\begingroup$

What are the most simple seasonality tests for time series?

Being more specific, I want to test if in specific time series the seasonal component is meaningful.

What are the recommended packages in Python/ R?

$\endgroup$
5
$\begingroup$

Before you test for seasonality you should reflect which type of seasonality you have. Note that there are many different types of seasonality:

  • Additive vs. Multiplicative seasonality
  • Single vs. Multiple seasonalities
  • Seasonality with even vs. uneven number of periods. Each year has twelve months, but 52,1429 weeks.
  • Trend vs. Seasonality: A seasonality pattern always appears in the same period, but a trend may appear a little bit later or earlier and not exactly each 5 years. One example for a trend are business cycles.

One of the most common methods to detect seasonality is to decompose the time series into several components.

In R you can do this with the decompose() command from the preinstalled stats package or with the stl() command from the forecast package.

The following code is taken from A little book of R for time series

births <- scan("http://robjhyndman.com/tsdldata/data/nybirths.dat")
birthstimeseries <- ts(births, frequency = 12, start = c(1946,1))
birthstimeseriescomponents <- decompose(birthstimeseries)
plot(birthstimeseriescomponents)

enter image description here

You can check the single components with

  • birthstimeseriescomponents$seasonal

  • birthstimeseriescomponents$random

  • birthstimeseriescomponents$trend


An other method is to include seasonal dummies and to check whether they have significant p-values when you compute the regression. If the single months have siginificant coefficients your monthly time series is seasonal.


An other method to detect seasonality is either to plot the data itself or to plot the ACF (autocorrelation function). In our case you can easily notice, that there is seasonality.

enter image description here

enter image description here


And last, but not least there are some "formal" hypothesis tests in order to detect seasonality such as the Student T-Test and the Wilcoxon Signed Rank Test.

$\endgroup$
  • $\begingroup$ in my case, I don't know by myself (additive vs multiplicative , Single vs. Multiple seasonalities Seasonality with even vs. uneven number of periods), I have a lot of time series and would like to have a approch generich as much as possible. For begining I would like to start with additive, single seasonality, even + not even. @Ferdi $\endgroup$ – Michael D May 16 '18 at 8:49
  • $\begingroup$ maybe you should think about your data: is it daily, weekly, monthly or quarterly data? are there any shocks or irregularities? what do you observe, when you visualise it? $\endgroup$ – Ferdi May 16 '18 at 8:51
  • $\begingroup$ some of the time series have weekly, daily, hourly. And some other doesn't have at all. For the first step I want to detect if the seasonal component meaning full at all. For your second example it has Lag 3 and 12. But somehow by eye I don't find any seasonality at lag 3. Is it better to look on pacf instead? If I look on ACF or PACF how I distinguish AR(p) model (which is not seasonal) versus a seasonal model?@Ferdi $\endgroup$ – Michael D May 16 '18 at 9:11
  • $\begingroup$ I am not aware of any algorithm you can blindly run on any kind of time-series to test for seasonality $\endgroup$ – Ferdi May 16 '18 at 9:33
  • 1
    $\begingroup$ I am ... AUTOBOX automatically searches for both stochastic i.e ARIMA structure and deterministic structure (fixed effects like day-of-the-week , month-of-the-year, day-of-the-month,quarter-of-the-year etc) while dealing with complications like step/level shifts,local time trends,pulses,changes in both parameters and error variance over time. There is an R version . It is an outgrowth of my PHD dissertation to automate time series model identification in both univariate and multivariate settings. $\endgroup$ – IrishStat May 16 '18 at 10:50
0
$\begingroup$

My thoughts are to check the amplitude of the:

  • ACF autocorrelation function
  • PACF partial autocorrelation function
  • Fourier Coefficients

(Fourier Coefficients are related to ACF via Wiener-Khinchin theorem.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.