The Beta-Binomial Experiment

Timeline
Beta Distribution graph
Beta-Binomial Distribution graph

In the beta-binomial experiment, a random probability \( P \) has a beta distribution with left parameter \( a \) and right parameter \( b \). Given \( P = p \), we conduct \( n \) Bernoulli trials with success probability \( p \). Random variable \( Y \) is the number of successes, and has the beta-binomial distribution with parameters \( n \), \( a \), and \( b \). The values of \( P \) and \( Y \) are recorded on each run, and the outcomes of the trials are shown in the timeline graph (red for success and green for failure). The probability density function of \( P \) is shown in the first graph, and the probability density function of \( Y \) is shown in the second graph and is given in the second table. On each run, the value of \( P \) is shown in the first graph, and the empirical probability density function of \( Y \) is shown in the second graph and recorded in the second table. Also recorded are \( M = Y / n \), the proportion of successes and \( Z = (a + Y) / (a + b + n) \). Random variable \( Z \) is the Bayesian estimator of the success parameter \( p \) when \( p \) is modeled by \( P \). As a function of \( n \), it is a martingale. The parameters \( n \), \( a \), and \( b \) can be varied with input controls.