Bayesian Estimation: MCMC vs MAP I'm still relatively new to understanding the bayesian mentality.

*

*MCMC (e.g metropolis hasting) finds out the posterior distribution of the parameters of interest. MCMC requires taking many samples from the posterior distribution and creating a histogram.


*the MAP estimate can be used to select a value of this parameter from the posterior distribution that well summarizes the posterior distribution. The MAP estimate can be expressed as the argmax(prior * likelihood).
My questions:

*

*Can "argmax(prior * likelihood)" be calculated using any optimization algorithm? For example, the Genetic Algorithm or Gradient Descent? For example, if we wanted to estimate the "lambda" parameter from an exponential distribution, could the Genetic Algorithm be used to evaluate the "argmax(prior * likelihood)" and identify the final lambda value?


*It seems like MAP estimate is used to identify a final value of the parameter, whereas the posterior distribution of the parameter generated by MCMC is used to create a "credible interval" around the MAP estimate of the parameter?
Thanks!

To answer your questions

*

*Yes; although with the usual caveats about using an optimisation procedure regarding convergence. If you want to find the MAP of the probability for data $X\sim\operatorname{Bin}(n=10,p)$, using $X=4$ as an example, with a uniform prior on $p$; the following R code uses the BFGS algorithm to do so using the log-odds transform $z = \log p/1-p$ so the domain is suitable for BFGS purposes:
# log of likelihood * prior for binomial data with 4 success, 10 trials
ln_L_prior <- function(z, size=10, x=4) dbinom(x=x, size=size, 1 / (1 + exp(-z)), log=T)
MAP <- optim(0, ln_L_prior, method='BFGS', control=list(fnscale=-1))$par
# MAP is -0.4054...

We can check the answer because this has posterior $\operatorname{Beta}(5,7)$, with mode $5 - 1 / 5 + 7 - 2 = 0.4$, which we log-odds transform and get the value $\approx -0.4054$ which was returned by R.


*The MAP estimate can be used as a summary of the posterior, however there is also (asymptotic) theory that can be used to describe the posterior near the MAP estimate.
For example, the posterior, under some conditions, is approximately normally distributed with mean at the MAP estimate, $\theta_{\text{MAP}}$, and covariance given by the inverse of the Hessian, $H$, of the posterior evaluated at $\theta_{\text{MAP}}$; this means a credible interval can be approximated using the quantiles of the distribution $\mathcal{N}(\theta_{\text{MAP}}, -H^{-1})$.
The following R code calculates the 2.5th and 97.5th percentiles of the $\operatorname{Beta} (5,7)$ distribution and that of the asymptotic approximation to the posterior:
# exact posterior interval
qbeta(c(0.025, 0.975), 5, 7)
# [1] 0.167 0.692

# asymptotic approximation
sd <- sqrt(solve(-numDeriv::hessian(ln_L_prior, MAP)))
z_interval <- qnorm(c(0.025, 0.975), mean=MAP, sd=sd)
1 / (1 + exp(-z_interval))
# [1] 0.158 0.702

Chapter 4 of Bayesian Data Analysis by Gelman et al. is an easy-ish place to start if you want to know more about asymptotic approximations of the posterior based on modes or the MAP estimate.
Gelman A, Carlin JB, Stern HS, Dunson DB, Vehtari A, Rubin DB. Bayesian Data Analysis. Third edition. New York: Chapman and Hall/CRC; 2013. doi:10.1201/b16018
