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?
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It only takes a minute to sign up.Sign up to join this community
Before you test for seasonality you should reflect which type of seasonality you have. Note that there are many different types of seasonality:
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)
You can check the single components with
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.
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.
My thoughts are to check the amplitude of the:
(Fourier Coefficients are related to ACF via Wiener-Khinchin theorem.)