Question #1. Determine how one might compute the Bayes estimator θ^Bayes:=∫θ⋅f(θ∣X1,…,Xn)dθ.
Here's the first idea: instead of computing an integral, just sample N points according to the distribution f(θ∣X1,…,Xn) and take their average. But there's a problem—we know what f(θ∣X1,…,Xn) is proportional to, but we know nothing about the exact probabilities. How do we actually sample from this distribution?
Remark. To see why sampling from such a distribution might be hard, consider the following challenge.
Challenge. Randomly shuffle a deck of 52 cards so that the probability of any given ordering is proportional to ∑n=152an⋅πn, where the nth card has rank an.
It's not computationally feasible to sum up all 52! weights.
It turns out that there's a universal solution to sampling from a distribution that we only know up to a proportion. The solution is Markov Chain Monte Carlo (MCMC). We won't explain it here; for further details, see Lecture 21 of 6.1220.
Question #2. Determine how one might compute the maximum a posteriori θ^MAP:=argmaxθf(θ∣X1,…,Xn).
The simplifying trick is to maximize the log of the posterior instead, and do so via gradient ascent. This looks like:
θ(k+1)=θ(k)+ηk⋅[∇ℓn(θ(k))+∇logf(θ(k))].
Question #3. Determine how one might construct a posterior interval.
Well, it's kinda obvious: a (1−α) posterior interval is any interval over which the integral of the posterior is 1−α.
§ Gaussian Conjugate Priors
Example. Suppose our data is sampled i.i.d. as X1,…,Xn∼N(θ,1), and our prior is θ∼N(0,σ2). Compute the posterior.
Solution: Plug it into the posterior formula.
f(θ∣X1,…,Xn)∝exp(−21⋅i=1∑n(Xi−θ)2)⋅exp(−21⋅σ2θ2)=exp(−21[[n+σ21]θ2−2θi=1∑nXi])⋅exp(−21⋅i=1∑nXi2)∝exp−2[n+σ21](θ−[n+σ21]∑i=1nXi)2⋅[constant, non-functions of θ]
We can throw away the constant, non-functions of θ that accumulate when completing the square. The result is:
posterior=N([n+σ21]∑i=1nXi,[n+σ21]1).
There's not much insightful commentary to give here, other than pointing out the obvious conjugate prior.