I am interested in creating a tool in Excel which would find estimates of the rate of occurrences of non conforming items received from suppliers. Based on the literature, the best way of approaching this problem is through Empirical Bayes method, and in particular through the Poisson - Gamma model (even if you have a better idea on how to approach it, please, I am solely interested in the aforementioned method). My main problem (at least for now) though is not its operation in the software, but the methodology, thus the steps that I have to follow in order to calculate the rates.

I have read an abundance of papers in which the authors indicate theoretically each step demanded for the production of the estimated rate through Empirical Bayes Method, and I have understood the concept, however no one illustrates these steps with a clear numerical example, but just present their findings for the cases they have delved (I would highly appreciate it if you had a tutorial to recommend though). As I am thinking its application, there are some details which I am missing, therefore I would be more than grateful if you could enlighten me. Let me try to concisely explain the situation:

The non conforming items are following a Poisson distribution with parameter λi (each supplier i has his own rate of non conforming items), and let's assume that the best estimate is that the latter rate follows a Gamma distribution (the prior) with parameters (α,β). According to Empirical Bayes approach, we conclude that the α and β parameters estimates of the prior distribution can be calculated through the formulae (let's consider these closed forms good approximations, therefore not discuss their adequacy in that case but just accept them as they are) :

α(estimate)=U^2/[W-U^2] (1) and β(estimate)=U/[W-U^2] (2)

with U=Σni/Σki (3) and W=[Σni^2-Σni]/Σki^2 (4)

ni=number of non conforming items from supplier i

ki=number of total items received from supplier i

*Question 1:*The ni and ki values are picked from the pool of the suppliers (meaning all of the data that we have available, from all the suppliers). So let's assume that I have gathered data for 2months from supplier 1, 12months for supplier 2, etc...., do I use all the data? so, do I sum all the data that I have collected (where appropriate) regardless of the periods that they are gathered even if they are inconsistent between the suppliers as in the example I provided?

So now with the α and β estimates we can calculate the EB estimate of λi for each of the suppliers based on the posterior distributions through the formula:

λi=[α(estimate)+ni]/[β(estimate)+ki] (5)

*Question 2:*The λi of (5) for each of the suppliers is calculated by inserting as ni and ki the data that we have for the specific suppliers? So, as soon as I calculate the α and β parameters, then immediately, with the same data, I calculate the λi as explained above?

*Question 3:*Now let's suppose that a month has passed, and I have new data. I update the λi of each supplier only with the new data that I received during that period as ni and ki? So, every time that we have a new order from the respective suppliers, we update the λis with the new data? Therefore, I have found my prior distribution (thus specific α and β estimates) and every time that a supplier is bringing me products and I assess the amount of them which are non conforming, I can manually find his λi based on the equation (5) with the specific α and β estimates found?

*Question 4:*Assuming that what I said is correct, do I ever have to recalculate the α and β estimates after for example a big time period or it is enough to just renew the λi based on new data?

I apologise for not being sufficiently mathematically accurate in some occasions (eg not including mathematical notations of prior and posterior distributions or derivations of formulae). I hope I was accurate enough though and made my points clear!

Thank you very much for your time in advance. Your thoughts on my problem will be highly appreciated.