# How to derive Bayes prior given large amounts of sample data from different population members

In Poker, it is important to judge the likelihood of an opponents action, but for unknown opponents, we have few samples available. One method proposed in http://www.husng.com/content/interpreting-small-sample-sizes-bayesian-estimators was to use bayesian estimators, but the author used a simple heuristic for constructing the prior.

Assume we have a database with a large number of opponents and their frequencies of the actions (however, the number of samples per opponent might be very different, e.g. there might be opponents where we have just 5 hands and others we have 10000 hands). In my understanding, each opponent can be described by a binomial distribution and our prior could be determined by "combining" those into a Beta distribution.

The questions I have are:

1. Is the thought process so far correct? Especially, does it make sense to split the observations into several opponents or can we see all different ones as a single "default" opponent and it leads to the same prior?
2. Is it a problem that we have a different sample size for each opponent? I'm thinking especially on cases where we have a tiny sample size for an opponent.
3. How can calculate the parameters of our prior beta distribution with parameters $(\alpha, \beta)$ based on the data?

## 1 Answer

This topic is covered in depth in chapter 5 of Gelman's Bayesian Data Analysis. I would highly recommend picking it up, as the example about rat tumors is basically identical to the problem you have outlined here.

1. The broad outlines of your approach sound correct. It sounds like hierarchical Bayesian modeling is exactly what you are looking for. In this application, each player has his/her preferences for a game action drawn from a common beta distribution with parameters $(\alpha, \beta)$. These parameters themselves are drawn in turn from a hyperprior and then updated to also include the data. So, treat each player as a different binomial trial with parameters drawn from this common beta distribution. One player's preference for a particular game action is a result of that player's disposition having been drawn from that common beta distribution.

2. Having different sample sizes for each opponent is not a problem. It just means that the $N$ parameter in your model will vary from player to player. Part of the point of hierarchical modeling is to incorporate the evidence from other, comparable experiments into the model and "shrink" the parameter estimates toward their common distribution.

3. I do not think that I could adequately explain the estimation procedure here, as Gelman spends about ten pages and a number of graphs on the topic. But following the lead of the rat tumor example will surely set you down the correct path. The broad outlines are reparameterizing the model as $y=log(\alpha+\beta)$ and $x=log(\alpha)-log(\beta)$ so that the beta parameters are continuous on the whole real line. Gelman chose a noninformative hyperprior density $p(\alpha, \beta) \propto (\alpha+\beta)^{-5/2}$ which is essentially flat. Then he computed a grid of points $(x,y)$around the point estimate of maximum likelihood and established the posterior density at each point using standard Bayesian methods. The resulting posterior density for $(x, y)$ describes the uncertainty about the parameters $(\alpha, \beta)$; with a little algebra, you can move from one coordinate system to the other. Simple point estimates of $(\alpha, \beta)$ are not necessarily helpful, as they would not convey the uncertainty contained in the prior beta distribution. However, we can still summarize our results by conducting a number of draws $(\alpha, \beta)$ from the posterior and evaluating inferring parameter values for our different players given our data of their performance, and choose, say, the middle 95% of draws as a plausible range of values for the binomial probability parameter.