How to model multi-modal distribution or cyclical time series data?


#1

I am looking for help on best practice to model this particular distribution. This is hourly sales volume of a particular item.

image

As you can see, the sales have peaks around 6:00, 9:00, 13:00. Otherwise, it has slow declines throughout the day.

What’s the best way to model this kind of behaviour?

I have tried:
a = pm.Normal(‘a’, mu=0.0, sd = 0.1, shape=2)
pm.math.exp(a[0]*hour_of_day + a[1]*hour_of_day**2)

Is there a better way of doing this?

Many thanks for suggestions.


#2

If the data is indeed cyclical (night time is missing in the plot?) then you might want to try out the Von Mises distribution. It’s the equivalent of a Normal distribution for periodic data.

You might need a mixture of multiple components to account for the multiple peaks.

Another option might be to transform the data into frequency space using a Fourier series.

However, I’ve never put that to practice and just wanted to give you a direction. Surely someone else has more experience!
Best,

Falk