2 Bayesian statistics 331-Week 2

2.2 Conjugates for likelihoods from the exponential family

A Gamma Likelihood

The Gamma likelihood

(Gamma sample.) Let X1,Xn be independent variables having the Gamma (k,θ) distribution, where k is known. Note that the case k=1 corresponds to the exponential distribution. So

L(θ;x)θnkexp{-θΣxi}.

Now, studying this form, regarded as a function of θ suggests we could take a prior of the form

π(θ) θp-1exp{-qθ}
θ Gamma (p,q)

Bayesian conjugate learning for a Gamma likelihood

π(θx) π(θ)L(θ;x)
θp-1exp{-qθ}θnkexp{-θΣxi}
θp+nk-1exp{-(q+Σxi)θ},

and so

θ|xGamma (p+nk,q+xi)

.

The exponential family

It emerges that the only case where conjugates can be easily obtained is for data models within the exponential family.

The exponential family

That is,

f(x|θ)=h(x)g(θ)exp{t(x)c(θ)}

for functions h,g,t and c.

This might seem restrictive, but in fact includes the exponential distribution, the Poisson distribution, the gamma distribution with known shape parameter, the binomial distribution and the normal distribution with known variance.

The likelihood

Given a random sample x=(x1,x2,,xn) from this general distribution, the likelihood for θ is then

L(θ;x) = i=1n{h(xi)}g(θ)nexp{i=1nt(xi)c(θ)}
g(θ)nexp{i=1nt(xi)c(θ)}.

Conjugates for a likelihood from the exponential family

Thus if we choose a prior of the form

π(θ)g(θ)dexp{bc(θ)},

we obtain

π(θ|x) π(θ)L(θ;x)
g(θ)dexp{bc(θ)}×g(θ)nexp{i=1nt(xi)c(θ)}
= g(θ)n+dexp{[b+i=1nt(xi)]c(θ)}
= g(θ)Dexp{Bc(θ)},

where D=n+d and B=b+t(xi). This results in a posterior in the same family as the prior, but with modified parameters.

Example

f(x|θ) = (nx)θx(1-θ)n-x
= (nx)(1-θ)n(θ1-θ)x
= (nx)(1-θ)nexp{xlog(θ1-θ)}.

So, in exponential family notation we have h(x)=(nx), g(θ)=(1-θ)n, t(x)=x, and c(θ)=log(θ1-θ). Thus, we construct a conjugate prior with the form

π(θ) [(1-θ)n]dexp{blog(θ1-θ)}
= (1-θ)nd-bθb

which is a member of the beta family of distributions.

Standard conjugate analysis

Table 2.1 lists many of the standard prior–likelihood conjugate analysis.

Likelihood Prior Posterior
xBinomial (n,θ) Beta (p,q) Beta (p+x,q+n-x)
x1,,xnGeometric (θ) Beta (p,q) Beta (p+n,q+i=1nxi-n)
xNegative-Binomial (n,θ) Beta (p,q) Beta (p+n,q+x-n)
x1,,xnPoisson (θ) Gamma (p,q) Gamma (p+i=1nxi,q+n)
x1,,xnGamma (k,θ)
(k known) Gamma (p,q) Gamma (p+nk,q+i=1nxi)
x1,,xnNormal (θ,τ-1),
(τ known) Normal (b,c-1) Normal (cb+nτx¯c+nτ,1c+nτ)
Table 2.1: Standard conjugate analysis.

Some of these have been given as examples; the others you should verify.