TITLE: Given several beta distributions, what is the probability that one is the highest?
QUESTION [6 upvotes]: Given several random variables distributed according to different beta distributions, how can I calculate the probability that any one of those random variables is actually the highest?
The application for this is that I have several ads which people can view and possibly click.  Over time I collect more and more data about each ad (views and clicks, which I can use to determine a beta distribution), and I'm interested in picking the ad that people most like to click on.
I need to determine when it is safe to select the ad with the highest click-through rate, so I need to know when a particular ad exceeds a threshold probability of being the best.
ps. I'm a software engineer not a mathematician, I would appreciate it if answers could bear this in mind by avoiding any complex notation ;)

REPLY [4 votes]: For the case of two beta random variables, and the beta parameters alpha and beta both being integers, which I think they should be given that the use case is views versus clicks, there is a closed form analytical solution for the probability that one distribution is greater than the other, from Evan Miller's web article :http://www.evanmiller.org/bayesian-ab-testing.html#cite1.
Specifically eqn 6 of the article gives a closed form solution and there is also some pseudocode included.