In this article, the Exponential-Gamma Conjugate Priors will be used to compute the Posterior values for the customer arrival rate in a retail shop (Inter-arrival times can be best modelled by an exponential distribution).
First, a \(\Gamma(\alpha,\beta)\) prior is chosen with \(\alpha=4,\; \beta=0.4\) (consistent with our belief that the mean cutomer arrival rate in the store is 1/3, so that mean arrival time is 3 mins, with a standard deviation of arrival rate of 1/9) to model the unknown mean customer arrival rate \(\lambda\) variable, so that \(\lambda \sim \Gamma(9,27)\).
Then a few trials of a random experiment simulating the customer arrival process are conducted to collect the data and update the prior belief about \(\lambda\) from the likelihood, which (the ) can be modeled as an exponetial random variable, \(Y \sim exp(\lambda), \; \lambda \sim \Gamma(\alpha, \beta)\).
The posterior probability distribution is also a Gamma distribution as shown in the figure below from the videos of professor Herbert Lee.
Then the recursive Bayesian updates and the prior and posterior hyper-parameters and the means are updated as and when a new datapoint is received. Also, the frequentist’s MLE and 95% confidence interval are computed, along with the Bayesian 95% credible interval.
The following animation shows the results of simulation of 20 customer arrivals and the inter-arrival times, starting with the prior \(\Gamma(9,27)\).
The left bottom plot visualizes the customers arrivals.
Every time a new datapoint is received (the next customers arrives at the shop), the prior belief is updated.
The right bottom table represents the summary statistics. Prior and Posterior means (of the arrival rate) respectively correspond to the previous and updated beliefs about the customers arrival rate at the shop.
The next animation shows the same results starting with a vague prior \(\Gamma(\epsilon,\epsilon)\).