# Binomial uniform prior bayesian statistics

Suppose to have a binomial distribution where the prior of the parameter is uniform. How can I get the posterior distribution of the parameter?

This is very simple to do if you use a prior distribution that is conjugate to the Binomial likelihood function. A prior and likelihood are said to be conjugate when the resulting posterior distribution is the same type of distribution as the prior. This means that if you have binomial data you can use a beta prior to obtain a beta posterior. Conjugate priors are not required for doing bayesian updating, but they make the calculations a lot easier so they are nice to use if you can.

A beta prior has two shape parameters that determine what it looks like, and is denoted Beta(α, β). Taking your prior for p (probability of success) as uniform is equivalent to using a Beta distribution with both parameters set to 1.

In order to obtain a posterior, simply use Bayes’s rule:

Posterior $\propto$ Prior x Likelihood

The posterior is proportional to the likelihood multiplied by the prior. What’s nice about working with conjugate distributions is that Bayesian updating really is as simple as basic algebra. We take the formula for the binomial likelihood function,

$Binomial Likelihood \propto p^x (1-p)^{n-x}$

where x is the number of successes in n trials. and then multiply it by the formula for the beta prior with α and β shape parameters,

$Beta Prior \propto p^{\alpha-1} (1-p)^{\beta-1}$

to obtain the following formula for the posterior,

$Beta Posterior \propto p^x(1-p)^{n-x}p^{\alpha-1}(1-p)^{\beta-1}$

You’ll see that we are multiplying together terms with the same base, which means the exponents can be added together. So the posterior formula can be rewritten as,

$Beta Posterior \propto p^xp^{\alpha-1}(1-p)^{n-x}(1-p)^{\beta-1}$

which simplifies to,

$Beta Posterior \propto p^{x+\alpha-1}(1-p)^{n-x+\beta-1}$

Which amounts to: Take the prior, add the successes and failures to the different exponents, and voila. In other words, you take the prior, Beta(α, β), and add the successes from the data, x, to $\alpha$ and the failures, n – x, to $\beta$, and there’s your posterior, Beta($\alpha$+x, $\beta$+n-x).

When you start with a Beta(1,1) as your prior the posterior will have the exact shape of the Binomial likelihood, and the posterior is written Beta(1+x,1+n-x).

Graphs

• Sure. The Beta distribution is just one way of parameterizing a uniform prior. Since the shape of the distribution is characterized by $p^{\alpha-1}(1-p)^{\beta-1}$, plug in $\alpha=1$ and $\beta=1$ and it simplifies to $p^0(1-p)^0$ which is equal to 1 for all values of p (the probability of success). Commented Dec 5, 2015 at 21:38