# Bayesian Estimation: MCMC vs MAP

I'm still relatively new to understanding the bayesian mentality.

1. 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.

2. 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:

1. 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?

2. 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!

• Much like a maximum likelihood estimator isn't always the preferred estimator for a frequentist (think of variance or standard deviation of a normal distribution), MAP estimation is not going to be the preferred approach for every Bayesian inference problem. You are correct to observe that the full posterior gives richer information. // I'm pretty sure that not every credible interval will contain the MAP point estimate.
– Dave
Sep 18 at 5:24
• $(1)$ The map corresponds to the mode of the posterior distribution. In the case where you have a multimodal posterior, then the optimization for finding the highest mode might be hard. $(2)$ Again in the case of a multimodal posterior, the highest mode, might a noninformative statistic for the multimodal posterior. In the unimodal case I assume that for sure the $MAP$ will be inside the $HDPI$ and not in every credible interval. Sep 18 at 12:59

1. 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.

2. 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)
#  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))
#  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