1
$\begingroup$

I'm optimizing prediction model for time series data trends. Each trend may have seasonality effect or may not. I want to classify each trend into one of the following groups: "seasonality" or "no seasonality". What is the best way to classify trends into those group?

I have tried already to calculate the variance of each trend but it is not good enough. More complex solution is to use Kmeans or PCA but maybe there can be another solution.

$\endgroup$
3
  • $\begingroup$ as a first starting point, you can have a look here: stats.stackexchange.com/questions/241590/… $\endgroup$ – PV8 Jun 18 '19 at 12:29
  • $\begingroup$ Thanks, but I don't care about what seasonality there is, all I care is if there is seasonality or not. $\endgroup$ – Aline Jun 18 '19 at 12:40
  • $\begingroup$ I think the adequate tool would be a Fourier transformation of your time series. After transforming you should check the power at period of 1 year and if it is significantly different than zero then you have seasonality in your time series. $\endgroup$ – nukimov Jun 18 '19 at 12:45
2
$\begingroup$

There are multiple statistical tests for seasonality. For instance, auto.arima() in the forecast package for R uses an OCSB test, and Rob Hyndman explained why he switched to it from the Canova-Hansen test here.

$\endgroup$
0
$\begingroup$

To add to Stephans post, in python you can run the package:

import statsmodels.api as sm
decomposition = sm.tsa.seasonal_decompose(y, model='additive', freq=12)
fig = decomposition.plot()
plt.show()
import matplotlib.pyplot as plt

to get an first graphical impression about it...

$\endgroup$
2
  • 1
    $\begingroup$ True, but I assume that similar to R's stl(), this will show a seasonal component whether or not it exists. $\endgroup$ – Stephan Kolassa Jun 18 '19 at 12:48
  • $\begingroup$ Thanks! but I need something automatic, I need it to run over a large amount of trends and classify them as seasonal trends or non seasonal trends $\endgroup$ – Aline Jun 18 '19 at 12:50

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.