# Updating discrete probability distribution: Bayesian or something else?

I have a discrete probability distribution which I want to update as new evidence comes in. I thought about it in a Bayesian context, but I don't think that will work because I don't have any formulation of the likelihood. Perhaps I'm missing something… Here's the problem statement:

Suppose I am running an online store, and people can order stuff online and choose a time slot for it to be delivered.Assume I have three delivery time slots [6:00-8:00, 8:00-10:00, 10:00-12:00]. My goal is to get a real-time estimate for the amount of orders I will receive at the end of the day for each slot.

More formally, let the three slots be denoted $$[x_1,x_2,x_3]$$. I am interested in knowing the values of orders ($$y$$) in each of the slots $$[y_1,y_2,y_3]$$ at the end of the day. So predicting number of orders in each time slot.

I was thinking: if I assume an initial distribution (normalized) of orders $$[p_1, p_2, p_3]$$, I want to update this distribution over time as new orders are coming in. We here assume the total number of orders to remain constant. More practically:

I have initial probability distribution $$[p_1, p_2, p_3] = [0.4, 0.4, 0.2]$$ (based on domain knowledge, people tend to order less later in the day for some reason)

After 10 orders have come in, almost everyone ordered in the first time slot. $$y_10 = [9, 1, 0]$$

I want to update my prior to reflect this. Perhaps it would be something like $$[0.5, 0.4, 0.1]$$ based on the evidence that came in

Repeat throughout the day. Because I assume the total number of orders to be constant, this would give me a direct estimate of the orders $$[y_1,y_2,y_3]$$.

If I knew the likelihood function I could use some kind of discrete Bayesian updating with prior distribution being $$[p_1, p_2, p_3]$$ and update as orders come in. The problem is I don't know the likelihood function. How could I achieve this?

• The way you describe the problem the data sounds multinomial and posterior is a Dirichlet distribution. – Xi'an Apr 18 '20 at 14:15
• @Xi'an agree it sounds like this, but it’d be probably incorrect. – Tim Apr 18 '20 at 14:26

## 1 Answer

As noticed by Xi'an in the comment, your description sounds as if you described a multinomial distribution, where given that $$N$$ people are to visit the store on a single day, on one of the three exclusive periods of the day, with probabilities $$p_1,p_2,p_3$$, then the distribution would describe the counts of people to be observed in those bins. Assuming multinomial likelihood, you could use Dirichlet distribution as a prior, to have closed-form Dirichlet-multinomial model for updating the probabilities.

However, I don't think this is a valid approach. First of all, it would need you to know the total number of people per day $$N$$, I assume you don't? Second, this assumes that one person can visit the store only once per day. Those constraints do not seem realistic. You would rather need a distribution for the counts, that is not bounded. For example, you could assume that the number of people visiting the store at the 8:00-10:00 time slot as Poisson distribution, with the average number of people shopping being equal to $$\lambda_2$$. You could assume that the time slots are independent from each other--this is also not true, but makes sense that if visiting the store once, does not prohibit someone from visiting it at different time. In such case, for each time slot you would estimate $$\lambda_i$$ independently of other slots. For Bayesian updating, you could use closed-form Gamma-Poisson model.

Of course, those are just trivial models, while in more realistic scenario you would need to build a model that takes different things into account (e.g. time of the year, day of the week, ongoing marketing campaigns, etc).

• Yes that makes way more sense. I understand the underlying process (Poisson with Gaussian prior), but I am struggling with how I would implement this in a simulation. $\lambda_i$ is the average number of orders coming in in a single day. How would I do Bayesian updating if an order comes in? I would have to somehow take into account the time component. Would it make sense to run the simulation and keep track of the time that passed by, and then extrapolate that to the full day and use that as my observed data? – BarkingCat Apr 19 '20 at 15:28