I have a dataset containing monthly sales data for different product categories spanning five years (60 months of data). I am using a Python process to calculate the seasonality for each category, resulting in a 12-item vector representing the expected monthly sales distribution over a year (it always adds up to 1). The code looks like this:

for category, data_5_years in sales_data:
    seasonality = get_seasonality(data_5_years)
    # outputs: (0.11, 0.14, 0.17, 0.15, 0.13, 0.1, 0.08, 0.06, 0.05, 0.05, 0.06, 0.09)

My concern is that this process always produces a seasonality estimate, even when the data might not exhibit any seasonality.

To address this issue, I've implemented the following method to check for the presence of seasonality:

  1. Get the seasonality from my get_seasonality function using the entire five-year dataset.
  2. Get the seasonality again, 5 times, using a single-year dataset each time.
  3. Compare each year with the original seasonality, by calculating the euclidean distance between the single-year array and the five-years array.
  4. If the max difference exceeds a certain value (that we defined after trial and erroring), the corresponding year is removed, and the process is repeated without said year.

If it gets to a point in which there are only two years left, the process concludes that there is no seasonality to be found, and it moves on to the next category.

My issue is, this lets through a lot of "wrong seasonalities". While this approach is practical, I'm seeking guidance on a more statistically sound method to determine whether seasonality exists in the data.


1 Answer 1


As a forecaster, my approach would be to take the first four years of history, fit a seasonal and a non-seasonal model to it, forecast each model out into the fifth year, and assess each forecast's mean squared error. If a seasonal model yields a lower MSE than a nonseasonal one, that would be good enough evidence for me. The proof of the pudding is in the eating.

You can start adding wrinkles, like checking whether the forecast improvement is statistically significant (using a Diebold-Mariano test), or running this on an aggregate level in the product hierarchy, but I would assume this simple approach is already helpful.

In terms of models, you could fit exponential smoothing models or use an auto-ARIMA method, in each case allowing for seasonality or not.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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