# Example of maximum a posteriori that does not match the mean of a marginalized posterior

Given a N-parameter likelihood and prior, I can obtain the marginalized posterior for each parameter through Bayesian MCMC.

I can also estimate the maximum a posteriori (MAP) of the N-parameter posterior distribution $$P(\theta|D)$$ (which equals its mode).

I'm having trouble visualizing the fact that, for any given parameter $$\theta_i\; (i=1, N)$$, its MAP value does not necessarily match its mean value (taken from its marginalized posterior).

Can you give an example of a distribution where this is visualized?

Consider the posterior distribution for the mean parameter $$\theta$$ of an Exponential distribution with a prior distribution ($$p$$) uniform on $$(0,100000)$$: $$p(\theta) = {1 \over 100000} \space \text{I}_{(0, 100000)}$$. Let's assume the true parameter value $$\theta = 1$$, which renders the upper bound effectively meaningless when calculating the posterior, as it is far larger than any sample will ever indicate $$\theta$$ might be. The posterior distribution ($$p'$$) for a sample of size $$N$$ then becomes proportional to:
$$p'(\theta) \propto {1\over \theta^N}\text{e}^{-\sum{x}/\theta}\text{I}_{(0,10000)}$$
and, for all practical purposes, we can ignore the upper bound on the range of $$\theta$$. This is an Inverted Gamma distribution with shape parameter $$N-1$$ and scale parameter $$\sum x$$, and has a mean of $${\sum x \over N-2}$$ but mode (MAP value) $$\sum x \over N$$.